LCOV - code coverage report
Current view: top level - src/renderer/extensions/linearMode - LinearArrange.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 86.7 % 15 13
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : <script setup lang="ts">
       2              : import { computed } from 'vue'
       3              : import { useI18n } from 'vue-i18n'
       4              : import { storeToRefs } from 'pinia'
       5              : 
       6              : import Button from '@comfyorg/design-system/button/Button'
       7              : import { useAppMode } from '@/composables/useAppMode'
       8              : import { flattenNodeOutput } from '@/renderer/extensions/linearMode/flattenNodeOutput'
       9              : import MediaOutputPreview from '@/renderer/extensions/linearMode/MediaOutputPreview.vue'
      10              : import { useAppModeStore } from '@/stores/appModeStore'
      11              : import { useNodeOutputStore } from '@/stores/nodeOutputStore'
      12              : import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
      13              : 
      14         2355 : const { t } = useI18n()
      15           12 : const { setMode } = useAppMode()
      16           12 : const appModeStore = useAppModeStore()
      17           12 : const { hasOutputs } = storeToRefs(appModeStore)
      18           12 : const nodeOutputStore = useNodeOutputStore()
      19           12 : const { nodeIdToNodeLocatorId } = useWorkflowStore()
      20              : 
      21           12 : const existingOutput = computed(() => {
      22           12 :   for (const nodeId of appModeStore.selectedOutputs) {
      23           10 :     const locatorId = nodeIdToNodeLocatorId(nodeId)
      24           10 :     const nodeOutput = nodeOutputStore.nodeOutputs[locatorId]
      25           10 :     if (!nodeOutput) continue
      26            0 :     const results = flattenNodeOutput([nodeId, nodeOutput])
      27            0 :     if (results.length > 0) return results[0]
      28              :   }
      29              :   return undefined
      30              : })
      31           12 : </script>
      32              : 
      33              : <template>
      34              :   <MediaOutputPreview
      35           12 :     v-if="existingOutput"
      36              :     :output="existingOutput"
      37              :     class="px-12 py-24"
      38              :   />
      39              :   <div
      40              :     v-else-if="hasOutputs"
      41              :     role="article"
      42              :     data-testid="linear-arrange-preview"
      43              :     class="mx-auto flex h-full w-3/4 flex-col items-center justify-center gap-6 p-8"
      44              :   >
      45              :     <div
      46              :       class="flex h-4/5 w-full flex-col items-center justify-center rounded-2xl border-2 border-dashed border-warning p-12"
      47              :     >
      48              :       <p class="mb-0 font-bold text-foreground">
      49              :         {{ t('linearMode.arrange.outputs') }}
      50              :       </p>
      51              :       <p class="text-center">{{ t('linearMode.arrange.resultsLabel') }}</p>
      52              :     </div>
      53              :   </div>
      54              :   <div
      55              :     v-else
      56              :     role="article"
      57              :     data-testid="linear-arrange-no-outputs"
      58              :     class="mx-auto flex h-full w-lg flex-col items-center justify-center gap-6 p-8 text-center"
      59              :   >
      60              :     <p class="m-0 text-foreground">
      61              :       {{ t('linearMode.arrange.noOutputs') }}
      62              :     </p>
      63              : 
      64              :     <div class="flex w-lg flex-col gap-1 text-[14px] text-muted-foreground">
      65              :       <p class="mt-0">{{ t('linearMode.arrange.switchToOutputs') }}</p>
      66              : 
      67              :       <i18n-t keypath="linearMode.arrange.connectAtLeastOne" tag="div">
      68              :         <template #atLeastOne>
      69              :           <span class="font-bold italic">
      70              :             {{ t('linearMode.arrange.atLeastOne') }}
      71              :           </span>
      72              :         </template>
      73              :       </i18n-t>
      74              : 
      75              :       <p class="mt-0">{{ t('linearMode.arrange.outputExamples') }}</p>
      76              :     </div>
      77              :     <div class="flex gap-2">
      78              :       <Button
      79              :         variant="primary"
      80              :         size="lg"
      81              :         data-testid="linear-arrange-switch-to-outputs"
      82              :         @click="setMode('builder:outputs')"
      83              :       >
      84              :         {{ t('linearMode.arrange.switchToOutputsButton') }}
      85              :       </Button>
      86              :     </div>
      87              :   </div>
      88              : </template>
        

Generated by: LCOV version 2.0-1