LCOV - code coverage report
Current view: top level - src/platform/assets/components - NodeOutputsExportDialog.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 9.1 % 11 1
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           16 : <template>
       2            0 :   <div class="flex w-105 max-w-full flex-col border-t">
       3              :     <label
       4              :       class="flex cursor-pointer items-center justify-between gap-4 px-4 py-3 text-sm"
       5              :     >
       6              :       {{ $t('nodeOutputsExport.downloadAll') }}
       7              :       <Checkbox :model-value="allSelected" @update:model-value="selectAll" />
       8              :     </label>
       9              :     <ul
      10              :       class="m-0 flex max-h-[50vh] list-none flex-col gap-2 overflow-y-auto px-4 py-1"
      11              :     >
      12            0 :       <li v-for="(item, index) in items" :key="index">
      13              :         <label class="flex cursor-pointer items-center gap-3">
      14              :           <img
      15              :             v-if="item.thumbnailUrl && !failedThumbnails.has(index)"
      16              :             data-testid="output-thumbnail"
      17              :             :src="item.thumbnailUrl"
      18              :             alt=""
      19              :             class="size-10 shrink-0 rounded-sm bg-secondary object-cover"
      20              :             @error="failedThumbnails.add(index)"
      21              :           />
      22              :           <div
      23              :             v-else
      24              :             data-testid="output-thumbnail-placeholder"
      25              :             class="flex size-10 shrink-0 items-center justify-center rounded-sm bg-secondary"
      26              :           >
      27              :             <i
      28              :               aria-hidden="true"
      29              :               class="icon-[lucide--image] text-muted-foreground"
      30              :             />
      31              :           </div>
      32              :           <span class="min-w-0 flex-1 truncate text-sm">{{ item.name }}</span>
      33              :           <Checkbox
      34              :             :model-value="selected[index]"
      35              :             @update:model-value="(value) => selectItem(index, value)"
      36              :           />
      37              :         </label>
      38              :       </li>
      39              :     </ul>
      40              :     <div class="flex justify-end gap-2 p-4">
      41              :       <Button variant="muted-textonly" @click="onCancel">
      42              :         {{ $t('g.cancel') }}
      43              :       </Button>
      44              :       <Button
      45              :         variant="inverted"
      46              :         :disabled="selectedIndices.length === 0"
      47              :         @click="onExport(selectedIndices)"
      48              :       >
      49              :         {{
      50              :           $t('nodeOutputsExport.download', { count: selectedIndices.length })
      51              :         }}
      52              :       </Button>
      53              :     </div>
      54              :   </div>
      55              : </template>
      56              : 
      57              : <script setup lang="ts">
      58              : import { computed, ref } from 'vue'
      59              : 
      60              : import Button from '@comfyorg/design-system/button/Button'
      61              : import Checkbox from '@comfyorg/design-system/checkbox/Checkbox'
      62              : 
      63              : interface ExportItem {
      64              :   name: string
      65              :   thumbnailUrl?: string
      66              : }
      67              : 
      68              : const { items, onExport, onCancel } = defineProps<{
      69              :   items: ExportItem[]
      70              :   onExport: (selectedIndices: number[]) => void
      71              :   onCancel: () => void
      72              : }>()
      73              : 
      74            0 : const selected = ref(items.map(() => true))
      75            0 : const failedThumbnails = ref(new Set<number>())
      76              : 
      77            0 : const selectedIndices = computed(() =>
      78              :   items.flatMap((_, index) => (selected.value[index] ? [index] : []))
      79              : )
      80            0 : const allSelected = computed(
      81              :   () => selectedIndices.value.length === items.length
      82              : )
      83              : 
      84            0 : function selectAll(value: boolean | 'indeterminate') {
      85            0 :   selected.value = items.map(() => value === true)
      86              : }
      87              : 
      88            0 : function selectItem(index: number, value: boolean | 'indeterminate') {
      89            0 :   selected.value = selected.value.map((current, i) =>
      90              :     i === index ? value === true : current
      91              :   )
      92              : }
      93              : </script>
        

Generated by: LCOV version 2.0-1