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

            Line data    Source code
       1           16 : <template>
       2            1 :   <div
       3              :     class="relative flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-md bg-muted"
       4              :   >
       5              :     <Skeleton
       6              :       v-if="normalizedPreviewUrl && isLoading"
       7              :       class="absolute inset-0"
       8              :     />
       9              :     <img
      10              :       v-if="normalizedPreviewUrl && !error"
      11              :       :src="normalizedPreviewUrl"
      12              :       :alt="name"
      13              :       :class="
      14              :         cn(
      15              :           'size-full object-cover transition-opacity duration-200',
      16              :           isReady ? 'opacity-100' : 'opacity-0'
      17              :         )
      18              :       "
      19              :       @error="
      20              :         $emit('thumbnailError', { name, previewUrl: normalizedPreviewUrl })
      21              :       "
      22              :     />
      23              :     <i
      24              :       v-if="!normalizedPreviewUrl || error"
      25              :       class="icon-[lucide--image] text-muted-foreground"
      26              :     />
      27              :   </div>
      28              : </template>
      29              : 
      30              : <script setup lang="ts">
      31              : import { computed } from 'vue'
      32              : 
      33              : import Skeleton from '@comfyorg/design-system/skeleton/Skeleton'
      34              : import { useImageQuiet } from '@/composables/useImageQuiet'
      35              : import { cn } from '@comfyorg/tailwind-utils'
      36              : 
      37              : const { name, previewUrl } = defineProps<{
      38              :   name: string
      39              :   previewUrl: string | null | undefined
      40              : }>()
      41              : 
      42              : defineEmits<{
      43              :   thumbnailError: [{ name: string; previewUrl: string | null }]
      44              : }>()
      45              : 
      46            1 : const normalizedPreviewUrl = computed(() => {
      47            1 :   if (typeof previewUrl !== 'string' || previewUrl.length === 0) return null
      48            1 :   try {
      49            0 :     const url = new URL(previewUrl, window.location.origin)
      50            1 :     if (
      51              :       !url.origin.includes('googleapis') &&
      52              :       url.searchParams.has('filename') &&
      53              :       !url.searchParams.has('res')
      54              :     )
      55            0 :       url.searchParams.set('res', '256')
      56            0 :     return url.toString()
      57              :   } catch {
      58            0 :     return previewUrl
      59              :   }
      60              : })
      61              : 
      62            1 : const imageOptions = computed(() => ({
      63              :   src: normalizedPreviewUrl.value ?? ''
      64              : }))
      65              : 
      66            1 : const { isReady, isLoading, error } = useImageQuiet(imageOptions)
      67              : </script>
        

Generated by: LCOV version 2.0-1