LCOV - code coverage report
Current view: top level - src/platform/workflowErrors/missingModel/components - MissingModelDownloadProgress.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 0.0 % 21 0
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : <template>
       2            0 :   <div
       3              :     data-testid="missing-model-download-progress"
       4              :     class="flex min-w-0 items-center gap-2"
       5              :     :title="progressText"
       6              :   >
       7              :     <span
       8              :       role="progressbar"
       9              :       :aria-label="
      10              :         t(
      11              :           'rightSidePanel.missingModels.downloadingModel',
      12              :           { model: modelName },
      13              :           { escapeParameter: false }
      14              :         )
      15              :       "
      16              :       aria-valuemin="0"
      17              :       aria-valuemax="100"
      18              :       :aria-valuenow="progressPercent"
      19              :       :aria-valuetext="progressText"
      20              :       class="block h-1 min-w-0 flex-1 overflow-hidden rounded-full bg-secondary"
      21              :     >
      22              :       <span
      23              :         :class="
      24              :           cn(
      25              :             'block h-full rounded-full bg-primary transition-all duration-200 ease-linear',
      26              :             progressPercent === undefined && 'w-full animate-pulse'
      27              :           )
      28              :         "
      29              :         :style="
      30              :           progressPercent === undefined
      31              :             ? undefined
      32              :             : { width: `${progressPercent}%` }
      33              :         "
      34              :       />
      35              :     </span>
      36              :     <span
      37              :       class="min-w-8 shrink-0 text-center text-2xs/tight text-muted-foreground tabular-nums"
      38              :     >
      39              :       {{ progressLabel }}
      40              :     </span>
      41              :   </div>
      42              : </template>
      43              : 
      44              : <script setup lang="ts">
      45              : import { computed } from 'vue'
      46              : import { useI18n } from 'vue-i18n'
      47              : 
      48              : import { cn } from '@comfyorg/tailwind-utils'
      49              : 
      50              : import type { MissingModelDownloadState } from '@/platform/workflowErrors/missingModel/missingModelDownloadStore'
      51              : import { formatDownloadedBytes } from '@/platform/workflowErrors/missingModel/missingModelDownloadProgress'
      52              : 
      53              : type ActiveDownloadState = Extract<
      54              :   MissingModelDownloadState,
      55              :   { status: 'requested' | 'pending' | 'downloading' }
      56              : >
      57              : 
      58              : const { state, modelName } = defineProps<{
      59              :   state: ActiveDownloadState
      60              :   modelName: string
      61              : }>()
      62              : 
      63            0 : const { t } = useI18n()
      64              : 
      65            0 : const progressPercent = computed(() => {
      66            0 :   if (state.status !== 'downloading' || state.fraction === null)
      67            0 :     return undefined
      68            0 :   return Math.round(Math.min(1, Math.max(0, state.fraction)) * 100)
      69              : })
      70              : 
      71            0 : const progressText = computed(() => {
      72            0 :   if (state.status === 'requested') {
      73            0 :     return t('rightSidePanel.missingModels.downloadQueued')
      74              :   }
      75            0 :   if (state.status === 'pending') {
      76            0 :     return t('rightSidePanel.missingModels.downloadStarting')
      77              :   }
      78            0 :   const bytes = formatDownloadedBytes(state)
      79            0 :   if (state.paused) {
      80            0 :     return bytes
      81              :       ? t(
      82              :           'rightSidePanel.missingModels.downloadPausedProgress',
      83              :           { progress: bytes },
      84              :           { escapeParameter: false }
      85              :         )
      86              :       : t('rightSidePanel.missingModels.downloadPaused')
      87              :   }
      88            0 :   if (bytes) return bytes
      89            0 :   return progressPercent.value === undefined
      90              :     ? t('rightSidePanel.missingModels.downloading')
      91              :     : `${progressPercent.value}%`
      92              : })
      93              : 
      94            0 : const progressLabel = computed(() => {
      95            0 :   if (state.status !== 'downloading') return progressText.value
      96            0 :   if (state.paused) {
      97            0 :     return t('rightSidePanel.missingModels.downloadPaused')
      98              :   }
      99            0 :   return progressPercent.value === undefined
     100              :     ? progressText.value
     101              :     : `${progressPercent.value}%`
     102              : })
     103              : </script>
        

Generated by: LCOV version 2.0-1