LCOV - code coverage report
Current view: top level - src/components/dialog/content - ConfirmationDialogContent.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 83.3 % 18 15
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           16 : <template>
       2           33 :   <section
       3              :     class="m-2 mt-4 flex flex-col gap-6 wrap-break-word whitespace-pre-wrap"
       4              :   >
       5              :     <div>
       6              :       <span>{{ message }}</span>
       7              :       <ul v-if="itemList?.length" class="m-0 mt-2 flex flex-col gap-2 pl-4">
       8           27 :         <li v-for="item of itemList" :key="item">
       9              :           {{ item }}
      10              :         </li>
      11              :       </ul>
      12              :       <div
      13              :         v-if="hint"
      14              :         role="status"
      15              :         class="mt-2 flex items-start gap-2 text-sm text-muted-foreground"
      16              :       >
      17              :         <i class="mt-0.5 icon-[lucide--info]" aria-hidden="true" />
      18              :         <span>{{ hint }}</span>
      19              :       </div>
      20              :     </div>
      21              :     <div class="flex shrink-0 flex-wrap justify-end gap-4">
      22              :       <div v-if="type === 'overwriteBlueprint'" class="flex flex-col gap-1">
      23              :         <div class="flex gap-4">
      24              :           <input
      25              :             id="doNotAskAgain"
      26              :             v-model="doNotAskAgain"
      27              :             type="checkbox"
      28              :             class="size-4 cursor-pointer"
      29              :           />
      30              :           <label for="doNotAskAgain">{{
      31              :             t('missingModelsDialog.doNotAskAgain')
      32              :           }}</label>
      33              :         </div>
      34              :         <i18n-t
      35              :           v-if="doNotAskAgain"
      36              :           keypath="missingModelsDialog.reEnableInSettings"
      37              :           tag="span"
      38              :           class="ml-8 text-sm text-muted-foreground"
      39              :         >
      40              :           <template #link>
      41              :             <Button
      42              :               variant="muted-textonly"
      43              :               class="p-0 text-sm underline hover:bg-transparent"
      44              :               @click="openBlueprintOverwriteSetting"
      45              :             >
      46              :               {{ t('missingModelsDialog.reEnableInSettingsLink') }}
      47              :             </Button>
      48              :           </template>
      49              :         </i18n-t>
      50              :       </div>
      51              : 
      52              :       <Button
      53              :         v-if="type !== 'info' && type !== 'dirtyClose'"
      54              :         variant="secondary"
      55              :         autofocus
      56              :         @click="onCancel"
      57              :       >
      58              :         <i class="icon-[lucide--undo-2]" />
      59              :         {{ $t('g.cancel') }}
      60              :       </Button>
      61              :       <Button
      62              :         v-if="type === 'default'"
      63              :         variant="primary"
      64              :         @click="handleConfirm"
      65              :       >
      66              :         <i class="icon-[lucide--check]" />
      67              :         {{ $t('g.confirm') }}
      68              :       </Button>
      69              :       <Button
      70              :         v-else-if="type === 'delete'"
      71              :         variant="destructive"
      72              :         @click="handleConfirm"
      73              :       >
      74              :         <i class="icon-[lucide--trash-2]" />
      75              :         {{ $t('g.delete') }}
      76              :       </Button>
      77              :       <Button
      78              :         v-else-if="type === 'overwrite' || type === 'overwriteBlueprint'"
      79              :         variant="destructive"
      80              :         @click="handleConfirm"
      81              :       >
      82              :         <i class="icon-[lucide--save]" />
      83              :         {{ $t('g.overwrite') }}
      84              :       </Button>
      85              :       <template v-else-if="type === 'dirtyClose'">
      86              :         <Button variant="secondary" @click="onDeny">
      87              :           <i class="icon-[lucide--x]" />
      88              :           {{ denyLabel ?? $t('g.no') }}
      89              :         </Button>
      90              :         <Button autofocus @click="handleConfirm">
      91              :           <i class="icon-[lucide--save]" />
      92              :           {{ confirmLabel ?? $t('g.save') }}
      93              :         </Button>
      94              :       </template>
      95              :       <Button
      96              :         v-else-if="type === 'reinstall'"
      97              :         variant="destructive"
      98              :         @click="handleConfirm"
      99              :       >
     100              :         <i class="icon-[lucide--eraser]" />
     101              :         {{ $t('desktopMenu.reinstall') }}
     102              :       </Button>
     103              :       <!-- Info - just show an OK button -->
     104              :       <Button v-else-if="type === 'info'" variant="primary" @click="onCancel">
     105              :         {{ $t('g.ok') }}
     106              :       </Button>
     107              :       <!-- Invalid - just show a close button. -->
     108              :       <Button v-else variant="primary" @click="onCancel">
     109              :         <i class="icon-[lucide--x]" />
     110              :         {{ $t('g.close') }}
     111              :       </Button>
     112              :     </div>
     113              :   </section>
     114              : </template>
     115              : 
     116              : <script setup lang="ts">
     117              : import { ref } from 'vue'
     118              : import { useI18n } from 'vue-i18n'
     119              : 
     120              : import Button from '@comfyorg/design-system/button/Button'
     121              : import { useSettingStore } from '@/platform/settings/settingStore'
     122              : import { useSettingsDialog } from '@/platform/settings/composables/useSettingsDialog'
     123              : import type { ConfirmationDialogType } from '@/components/dialog/content/confirmationDialogTypes'
     124              : import { useDialogStore } from '@/stores/dialogStore'
     125              : 
     126           32 : const props = defineProps<{
     127              :   message: string
     128              :   type: ConfirmationDialogType
     129              :   onConfirm: (value?: boolean) => void
     130              :   itemList?: string[]
     131              :   hint?: string
     132              :   denyLabel?: string
     133              :   confirmLabel?: string
     134              : }>()
     135              : 
     136           32 : const { t } = useI18n()
     137              : 
     138           32 : const onCancel = () => useDialogStore().closeDialog()
     139              : 
     140            0 : function openBlueprintOverwriteSetting() {
     141            0 :   useDialogStore().closeDialog()
     142            0 :   useSettingsDialog().show(undefined, 'Comfy.Workflow.WarnBlueprintOverwrite')
     143              : }
     144              : 
     145           32 : const doNotAskAgain = ref(false)
     146              : 
     147           32 : const onDeny = () => {
     148            1 :   props.onConfirm(false)
     149            1 :   useDialogStore().closeDialog()
     150              : }
     151              : 
     152           32 : const handleConfirm = () => {
     153           23 :   if (props.type === 'overwriteBlueprint' && doNotAskAgain.value)
     154            1 :     void useSettingStore().set('Comfy.Workflow.WarnBlueprintOverwrite', false)
     155           23 :   props.onConfirm(true)
     156           23 :   useDialogStore().closeDialog()
     157              : }
     158              : </script>
        

Generated by: LCOV version 2.0-1