LCOV - code coverage report
Current view: top level - src/platform/workflow/sharing/components/publish - ComfyHubDescribeStep.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 17 17
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           16 : <template>
       2           38 :   <div
       3              :     data-testid="publish-describe-step"
       4              :     class="flex min-h-0 flex-1 flex-col gap-6 px-6 py-4"
       5              :   >
       6              :     <label class="flex flex-col gap-2">
       7              :       <span class="text-sm text-foreground">
       8              :         {{ $t('comfyHubPublish.workflowName') }}
       9              :       </span>
      10              :       <Input
      11              :         data-testid="publish-name-input"
      12              :         :model-value="name"
      13              :         :placeholder="$t('comfyHubPublish.workflowNamePlaceholder')"
      14              :         @update:model-value="$emit('update:name', String($event))"
      15              :       />
      16              :     </label>
      17              : 
      18              :     <label class="flex flex-col gap-2">
      19              :       <span class="text-sm text-foreground">
      20              :         {{ $t('comfyHubPublish.workflowDescription') }}
      21              :       </span>
      22              :       <Textarea
      23              :         :model-value="description"
      24              :         :placeholder="$t('comfyHubPublish.workflowDescriptionPlaceholder')"
      25              :         rows="5"
      26              :         @update:model-value="$emit('update:description', String($event))"
      27              :       />
      28              :     </label>
      29              : 
      30              :     <label class="flex flex-col gap-2">
      31              :       <span class="text-sm text-foreground">
      32              :         {{ $t('comfyHubPublish.tagsDescription') }}
      33              :       </span>
      34              :       <TagEditor
      35              :         data-testid="publish-tags-input"
      36              :         always-editing
      37              :         class="bg-secondary select-none"
      38              :         item-class="backdrop-blur-none"
      39              :         :model-value="tags"
      40              :         @update:model-value="$emit('update:tags', $event)"
      41              :       />
      42              :     </label>
      43              :     <TagsInput disabled class="p-0 hover:bg-transparent">
      44              :       <div
      45              :         v-if="displayedSuggestions.length > 0"
      46              :         class="flex basis-full flex-wrap gap-2"
      47              :       >
      48          794 :         <TagsInputItem
      49              :           v-for="tag in displayedSuggestions"
      50              :           :key="tag"
      51              :           v-auto-animate
      52              :           :value="tag"
      53              :           class="cursor-pointer bg-secondary px-2 text-muted-foreground backdrop-blur-none transition-colors select-none hover:bg-muted"
      54              :           @click="addTag(tag)"
      55              :         >
      56              :           <TagsInputItemText />
      57              :         </TagsInputItem>
      58              :       </div>
      59              :       <Button
      60              :         v-if="shouldShowSuggestionToggle"
      61              :         variant="muted-textonly"
      62              :         size="unset"
      63              :         class="px-0 text-xs hover:bg-transparent"
      64              :         @click="showAllSuggestions = !showAllSuggestions"
      65              :       >
      66              :         {{
      67              :           $t(
      68              :             showAllSuggestions
      69              :               ? 'comfyHubPublish.showLessTags'
      70              :               : 'comfyHubPublish.showMoreTags'
      71              :           )
      72              :         }}
      73              :       </Button>
      74              :     </TagsInput>
      75              :   </div>
      76              : </template>
      77              : 
      78              : <script setup lang="ts">
      79              : import Button from '@comfyorg/design-system/button/Button'
      80              : import Input from '@comfyorg/design-system/input/Input'
      81              : import TagsInput from '@comfyorg/design-system/tags-input/TagsInput'
      82              : import TagEditor from '@/components/common/TagEditor.vue'
      83              : import TagsInputItem from '@comfyorg/design-system/tags-input/TagsInputItem'
      84              : import TagsInputItemText from '@comfyorg/design-system/tags-input/TagsInputItemText'
      85              : import Textarea from '@comfyorg/design-system/textarea/Textarea'
      86              : import { COMFY_HUB_TAG_OPTIONS } from '@/platform/workflow/sharing/constants/comfyHubTags'
      87              : import { useComfyHubService } from '@/platform/workflow/sharing/services/comfyHubService'
      88              : import { computed, onMounted, ref } from 'vue'
      89              : import { vAutoAnimate } from '@formkit/auto-animate/vue'
      90              : 
      91              : const { tags } = defineProps<{
      92              :   name: string
      93              :   description: string
      94              :   tags: string[]
      95              : }>()
      96              : 
      97           32 : const emit = defineEmits<{
      98              :   'update:name': [value: string]
      99              :   'update:description': [value: string]
     100              :   'update:tags': [value: string[]]
     101              : }>()
     102              : 
     103           30 : const INITIAL_TAG_SUGGESTION_COUNT = 10
     104              : 
     105           32 : const showAllSuggestions = ref(false)
     106           32 : const tagOptions = ref<string[]>(COMFY_HUB_TAG_OPTIONS)
     107              : 
     108           32 : const { fetchTagLabels } = useComfyHubService()
     109              : 
     110           32 : onMounted(async () => {
     111           32 :   try {
     112           32 :     tagOptions.value = await fetchTagLabels()
     113              :   } catch {
     114              :     // Fall back to hardcoded tags
     115              :   }
     116              : })
     117              : 
     118           32 : const availableSuggestions = computed(() =>
     119              :   tagOptions.value.filter((tag) => !tags.includes(tag))
     120              : )
     121              : 
     122           32 : const displayedSuggestions = computed(() =>
     123              :   showAllSuggestions.value
     124              :     ? availableSuggestions.value
     125              :     : availableSuggestions.value.slice(0, INITIAL_TAG_SUGGESTION_COUNT)
     126              : )
     127              : 
     128           32 : const hasHiddenSuggestions = computed(
     129              :   () =>
     130              :     !showAllSuggestions.value &&
     131              :     availableSuggestions.value.length > INITIAL_TAG_SUGGESTION_COUNT
     132              : )
     133              : 
     134           32 : const shouldShowSuggestionToggle = computed(
     135              :   () => showAllSuggestions.value || hasHiddenSuggestions.value
     136              : )
     137              : 
     138            1 : function addTag(tag: string) {
     139            1 :   emit('update:tags', [...tags, tag])
     140              : }
     141              : </script>
        

Generated by: LCOV version 2.0-1