truncate name

This commit is contained in:
Mutasem 2022-03-28 13:36:11 +02:00
parent 4c3231e156
commit 6d49f99d16
2 changed files with 8 additions and 2 deletions

View file

@ -15,7 +15,7 @@
</div> </div>
</div> </div>
<span :class="$style.title" slot="reference"> <span :class="$style.title" slot="reference">
{{value}} <WorkflowNameShort :name="value" :limit="40" />
<font-awesome-icon :class="$style.editIcon" icon="pencil-alt" /> <font-awesome-icon :class="$style.editIcon" icon="pencil-alt" />
</span> </span>
</el-popover> </el-popover>
@ -24,8 +24,10 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import WorkflowNameShort from './WorkflowNameShort.vue';
export default Vue.extend({ export default Vue.extend({
components: { WorkflowNameShort },
name: 'NodeTitle', name: 'NodeTitle',
props: { props: {
value: { value: {

View file

@ -1,6 +1,7 @@
<template> <template>
<span :title="name"> <span :title="name">
<slot :shortenedName="shortenedName"></slot> <slot v-if="hasDefaultSlot" :shortenedName="shortenedName"></slot>
{{ shortenedName }}
</span> </span>
</template> </template>
@ -14,6 +15,9 @@ export default Vue.extend({
name: "WorkflowNameShort", name: "WorkflowNameShort",
props: ["name", "limit"], props: ["name", "limit"],
computed: { computed: {
hasDefaultSlot(): boolean {
return !!this.$slots.default;
},
shortenedName(): string { shortenedName(): string {
const name = this.$props.name; const name = this.$props.name;