LCOV - code coverage report
Current view: top level - src/platform/workflowErrors/panel - MissingNodeCard.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 54.2 % 24 13
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : <template>
       2              :   <div data-testid="missing-node-card" class="px-3">
       3              :     <MissingNodeDeploymentOffer v-if="isCloud" />
       4              :     <!-- Core node version warning (OSS only) -->
       5              :     <div
       6              :       v-if="!isCloud && hasMissingCoreNodes"
       7              :       role="alert"
       8              :       class="mb-3 flex gap-2.5 rounded-lg border border-warning/30 bg-warning/10 p-3"
       9              :     >
      10              :       <i
      11              :         aria-hidden="true"
      12              :         class="mt-0.5 icon-[lucide--triangle-alert] text-warning"
      13              :       />
      14              :       <div class="flex flex-col gap-1.5 text-xs/relaxed text-muted-foreground">
      15              :         <p class="m-0">
      16              :           {{
      17              :             currentComfyUIVersion
      18              :               ? t('loadWorkflowWarning.newerVersionRequired', {
      19              :                   version: currentComfyUIVersion
      20              :                 })
      21              :               : t('loadWorkflowWarning.newerVersionRequiredGeneric')
      22              :           }}
      23              :         </p>
      24            0 :         <div
      25              :           v-for="[version, nodes] in sortedMissingCoreNodes"
      26              :           :key="version"
      27              :           class="ml-2"
      28              :         >
      29              :           <span class="font-medium">
      30              :             {{
      31              :               t('loadWorkflowWarning.coreNodesFromVersion', {
      32              :                 version: version || t('loadWorkflowWarning.unknownVersion')
      33              :               })
      34              :             }}
      35              :           </span>
      36              :           <span class="ml-1">{{ getUniqueNodeNames(nodes).join(', ') }}</span>
      37              :         </div>
      38              :       </div>
      39              :     </div>
      40              :     <!-- Manager disabled hint: shown on OSS when manager is not active -->
      41              :     <i18n-t
      42              :       v-if="showManagerHint"
      43              :       keypath="rightSidePanel.missingNodePacks.ossManagerDisabledHint"
      44              :       tag="p"
      45              :       class="m-0 pb-5 text-sm/relaxed text-muted-foreground"
      46              :     >
      47              :       <template #pipCmd>
      48              :         <code
      49              :           class="rounded-sm bg-background px-1 py-0.5 font-mono text-xs text-foreground"
      50              :           >pip install -U --pre comfyui-manager</code
      51              :         >
      52              :       </template>
      53              :       <template #flag>
      54              :         <code
      55              :           class="rounded-sm bg-background px-1 py-0.5 font-mono text-xs text-foreground"
      56              :           >--enable-manager</code
      57              :         >
      58              :       </template>
      59              :     </i18n-t>
      60              :     <div class="-mx-1.5 flex flex-col gap-1 overflow-hidden px-1.5">
      61           31 :       <MissingPackGroupRow
      62              :         v-for="group in missingPackGroups"
      63              :         :key="group.packId ?? '__unknown__'"
      64              :         :group="group"
      65              :         :show-info-button="showInfoButton"
      66              :         :highlighted="
      67              :           someNodeTypeInSelection(group.nodeTypes, highlightedNodeIds)
      68              :         "
      69              :         @locate-node="emit('locateNode', $event)"
      70              :         @open-manager-info="emit('openManagerInfo', $event)"
      71              :       />
      72              :     </div>
      73              :   </div>
      74              : 
      75              :   <!-- Apply Changes: shown when manager enabled and at least one pack install succeeded -->
      76              :   <div v-if="shouldShowManagerButtons" class="px-4">
      77              :     <Button
      78              :       v-if="hasInstalledPacksPendingRestart"
      79              :       variant="secondary"
      80              :       size="sm"
      81              :       :disabled="isRestarting"
      82              :       class="mt-2 h-8 w-full min-w-0 rounded-md"
      83              :       @click="applyChanges()"
      84              :     >
      85              :       <DotSpinner v-if="isRestarting" duration="1s" :size="12" />
      86              :       <i v-else aria-hidden="true" class="icon-[lucide--refresh-cw]" />
      87              :       <span class="min-w-0 truncate">{{
      88              :         t('rightSidePanel.missingNodePacks.applyChanges')
      89              :       }}</span>
      90              :     </Button>
      91              :   </div>
      92              : </template>
      93              : 
      94              : <script setup lang="ts">
      95              : import { computed } from 'vue'
      96              : import { useI18n } from 'vue-i18n'
      97              : import { compare, valid } from 'semver'
      98              : import Button from '@comfyorg/design-system/button/Button'
      99              : import DotSpinner from '@comfyorg/design-system/common/DotSpinner'
     100              : import { isCloud } from '@/platform/distribution/types'
     101              : import { useWorkflowErrorManager } from '@/platform/workflowErrors/workflowErrorManager'
     102              : import { useSystemStatsStore } from '@/stores/systemStatsStore'
     103              : import type { MissingPackGroup } from '@/platform/workflowErrors/panel/useErrorGroups'
     104              : import MissingPackGroupRow from '@/platform/workflowErrors/panel/MissingPackGroupRow.vue'
     105              : import { someNodeTypeInSelection } from '@/platform/workflowErrors/panel/selectionEmphasis'
     106              : import MissingNodeDeploymentOffer from '@/platform/workspace/components/MissingNodeDeploymentOffer.vue'
     107              : 
     108              : const { showInfoButton, missingPackGroups } = defineProps<{
     109              :   showInfoButton: boolean
     110              :   missingPackGroups: MissingPackGroup[]
     111              :   /** Execution node ids to emphasize (current canvas selection). */
     112              :   highlightedNodeIds?: Set<string>
     113              : }>()
     114              : 
     115           15 : const emit = defineEmits<{
     116              :   locateNode: [nodeId: string]
     117              :   openManagerInfo: [packId: string]
     118              : }>()
     119              : 
     120           15 : const { t } = useI18n()
     121              : 
     122           15 : const manager = useWorkflowErrorManager()
     123           15 : const { missingCoreNodes } = manager.useMissingNodes()
     124           15 : const systemStatsStore = useSystemStatsStore()
     125              : 
     126           15 : const hasMissingCoreNodes = computed(
     127              :   () => Object.keys(missingCoreNodes.value).length > 0
     128              : )
     129              : 
     130           15 : const currentComfyUIVersion = computed<string | null>(() => {
     131            0 :   if (!hasMissingCoreNodes.value) return null
     132            0 :   return systemStatsStore.systemStats?.system?.comfyui_version ?? null
     133              : })
     134              : 
     135           15 : const sortedMissingCoreNodes = computed(() =>
     136              :   Object.entries(missingCoreNodes.value).sort(([a], [b]) => {
     137            0 :     const aValid = valid(a)
     138            0 :     const bValid = valid(b)
     139            0 :     if (!aValid && !bValid) return 0
     140            0 :     if (!aValid) return 1
     141            0 :     if (!bValid) return -1
     142            0 :     return compare(b, a)
     143              :   })
     144              : )
     145              : 
     146            0 : function getUniqueNodeNames(nodes: { type: string }[]): string[] {
     147              :   const types = new Set(nodes.map((node) => node.type).filter(Boolean))
     148            0 :   return [...types].sort()
     149              : }
     150              : 
     151           15 : const { isRestarting, applyChanges } = manager.useApplyChanges()
     152           15 : const { shouldShowManagerButtons } = manager.useManagerState()
     153              : 
     154              : /**
     155              :  * Show the --enable-manager hint when:
     156              :  * - Not on Cloud (OSS/local only)
     157              :  * - Manager is disabled (showInfoButton is false)
     158              :  */
     159           15 : const showManagerHint = computed(() => !isCloud && !showInfoButton)
     160              : 
     161              : /**
     162              :  * Show Apply Changes when any pack from the error group is already installed
     163              :  * on disk but ComfyUI hasn't restarted yet to load it.
     164              :  * This is server-state based → persists across browser refreshes.
     165              :  */
     166           15 : const hasInstalledPacksPendingRestart = computed(() =>
     167              :   missingPackGroups.some(
     168              :     (g) => g.packId !== null && manager.isPackInstalled(g.packId)
     169              :   )
     170              : )
     171              : </script>
        

Generated by: LCOV version 2.0-1