LCOV - code coverage report
Current view: top level - src/renderer/extensions/linearMode - MobileError.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 2.7 % 37 1
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              : 
       5              : import Dialogue from '@comfyorg/design-system/dialog/Dialogue'
       6              : import { useErrorGroups } from '@/platform/workflowErrors/panel/useErrorGroups'
       7              : import Button from '@comfyorg/design-system/button/Button'
       8              : import { useAppMode } from '@/composables/useAppMode'
       9              : import { useCopyToClipboard } from '@/composables/useCopyToClipboard'
      10              : import { useExternalLink } from '@/composables/useExternalLink'
      11              : import { resolveRunErrorMessage } from '@/platform/workflowErrors/errorCatalog/errorMessageResolver'
      12              : import { buildSupportUrl } from '@/platform/support/config'
      13              : import { useAppModeStore } from '@/stores/appModeStore'
      14              : import { useExecutionErrorStore } from '@/stores/executionErrorStore'
      15              : 
      16              : defineEmits<{ navigateControls: [] }>()
      17              : 
      18         2355 : const { t } = useI18n()
      19            0 : const appModeStore = useAppModeStore()
      20            0 : const { setMode } = useAppMode()
      21            0 : const executionErrorStore = useExecutionErrorStore()
      22            0 : const { buildDocsUrl, staticUrls } = useExternalLink()
      23            0 : const { allErrorGroups } = useErrorGroups('')
      24            0 : const { copyToClipboard } = useCopyToClipboard()
      25              : 
      26            0 : const guideUrl = buildDocsUrl('troubleshooting/overview', {
      27              :   includeLocale: true
      28              : })
      29            0 : const supportUrl = buildSupportUrl()
      30              : 
      31            0 : const inputNodeIds = computed(() => {
      32            0 :   const ids = new Set()
      33            0 :   for (const [id] of appModeStore.selectedInputs) ids.add(String(id))
      34            0 :   return ids
      35              : })
      36              : 
      37            0 : const accessibleNodeErrors = computed(() =>
      38              :   Object.keys(executionErrorStore.surfacedNodeErrors ?? {}).filter((k) =>
      39              :     inputNodeIds.value.has(k)
      40              :   )
      41              : )
      42            0 : const accessibleErrors = computed(() =>
      43              :   accessibleNodeErrors.value.flatMap((k) => {
      44            0 :     const nodeError = executionErrorStore.surfacedNodeErrors?.[k]
      45            0 :     if (!nodeError) return []
      46              : 
      47            0 :     return nodeError.errors.flatMap((error) => {
      48            0 :       const { extra_info } = error
      49            0 :       if (!extra_info) return []
      50              : 
      51            0 :       const selectedInput = appModeStore.selectedInputs.find(
      52              :         ([id, name]) => id == k && extra_info.input_name === name
      53              :       )
      54            0 :       if (!selectedInput) return []
      55              : 
      56            0 :       const resolvedDisplay = resolveRunErrorMessage({
      57              :         kind: 'node_validation',
      58              :         error,
      59              :         nodeDisplayName: nodeError.class_type
      60              :       })
      61              : 
      62            0 :       return [
      63              :         resolvedDisplay.displayDetails ??
      64              :           resolvedDisplay.displayMessage ??
      65              :           `${selectedInput[1]}: ${error.message}`
      66              :       ]
      67              :     })
      68              :   })
      69              : )
      70            0 : const allErrors = computed(() =>
      71              :   allErrorGroups.value.flatMap((group) => {
      72            0 :     if (group.type !== 'execution') {
      73            0 :       return [group.displayMessage ?? group.displayTitle]
      74              :     }
      75              : 
      76            0 :     return group.cards.flatMap((c) =>
      77              :       c.errors.map((e) => {
      78            0 :         const resolvedMessage = e.displayDetails ?? e.displayMessage
      79            0 :         if (resolvedMessage) return resolvedMessage
      80              : 
      81            0 :         return e.details
      82              :           ? `${c.title} (${e.details}): ${e.message}`
      83              :           : `${c.title}: ${e.message}`
      84              :       })
      85              :     )
      86              :   })
      87              : )
      88              : 
      89            0 : function copy(obj: unknown) {
      90            0 :   copyToClipboard(JSON.stringify(obj))
      91              : }
      92            0 : </script>
      93              : <template>
      94            0 :   <section class="flex h-full flex-col items-center justify-center gap-2 px-4">
      95              :     <i class="icon-[lucide--circle-alert] size-6 bg-destructive" />
      96              :     {{ t('linearMode.error.header') }}
      97              :     <div class="p-1 text-muted-foreground">
      98              :       <i18n-t
      99              :         v-if="accessibleErrors.length"
     100              :         keypath="linearMode.error.mobileFixable"
     101              :       >
     102              :         <Button @click="$emit('navigateControls')">
     103              :           {{ t('linearMode.mobileControls') }}
     104              :         </Button>
     105              :       </i18n-t>
     106              :       <div v-else class="text-center">
     107              :         <p v-text="t('linearMode.error.requiresGraph')" />
     108              :         <p v-text="t('linearMode.error.promptVisitGraph')" />
     109              :         <p class="*:text-muted-foreground">
     110              :           <i18n-t keypath="linearMode.error.getHelp">
     111              :             <a
     112              :               :href="guideUrl"
     113              :               target="_blank"
     114              :               v-text="t('linearMode.error.guide')"
     115              :             />
     116              :             <a
     117              :               :href="staticUrls.githubIssues"
     118              :               target="_blank"
     119              :               v-text="t('linearMode.error.github')"
     120              :             />
     121              :             <a
     122              :               :href="supportUrl"
     123              :               target="_blank"
     124              :               v-text="t('linearMode.error.support')"
     125              :             />
     126              :           </i18n-t>
     127              :         </p>
     128              :         <Dialogue
     129              :           :title="t('linearMode.error.log')"
     130              :           :close-label="t('g.close')"
     131              :         >
     132              :           <template #button>
     133              :             <Button variant="textonly">
     134              :               {{ t('linearMode.error.promptShow') }}
     135              :               <i class="icon-[lucide--chevron-right] size-5" />
     136              :             </Button>
     137              :           </template>
     138              :           <template #default="{ close }">
     139              :             <article class="flex flex-col gap-2 p-4">
     140              :               <section class="flex max-h-[60vh] flex-col gap-2 overflow-y-auto">
     141            0 :                 <div
     142              :                   v-for="error in allErrors"
     143              :                   :key="error"
     144              :                   class="w-full rounded-lg bg-secondary p-2 text-muted-foreground"
     145              :                   v-text="error"
     146              :                 />
     147              :               </section>
     148              :               <div class="flex items-center justify-end gap-4">
     149              :                 <Button variant="muted-textonly" size="lg" @click="close">
     150              :                   {{ t('g.close') }}
     151              :                 </Button>
     152              :                 <Button size="lg" @click="copy(allErrors)">
     153              :                   {{ t('importFailed.copyError') }}
     154              :                   <i class="icon-[lucide--copy]" />
     155              :                 </Button>
     156              :               </div>
     157              :             </article>
     158              :           </template>
     159              :         </Dialogue>
     160              :       </div>
     161              :     </div>
     162              :     <div
     163              :       v-if="accessibleErrors.length"
     164              :       class="my-8 w-full rounded-lg bg-secondary text-muted-foreground"
     165              :     >
     166              :       <ul>
     167            0 :         <li
     168              :           v-for="error in accessibleErrors"
     169              :           :key="error"
     170              :           class="before:content"
     171              :           v-text="error"
     172              :         />
     173              :       </ul>
     174              :     </div>
     175              :     <div class="flex gap-2">
     176              :       <Button
     177              :         variant="textonly"
     178              :         size="lg"
     179              :         @click="executionErrorStore.dismissErrorOverlay()"
     180              :       >
     181              :         {{ t('g.dismiss') }}
     182              :       </Button>
     183              :       <Button variant="textonly" size="lg" @click="setMode('graph')">
     184              :         {{ t('linearMode.viewGraph') }}
     185              :       </Button>
     186              :       <Button
     187              :         v-if="accessibleErrors.length"
     188              :         size="lg"
     189              :         @click="copy(accessibleErrors)"
     190              :       >
     191              :         {{ t('importFailed.copyError') }}
     192              :         <i class="icon-[lucide--copy]" />
     193              :       </Button>
     194              :     </div>
     195              :   </section>
     196              : </template>
        

Generated by: LCOV version 2.0-1