LCOV - code coverage report
Current view: top level - src/components/queue/dialogs - QueueClearHistoryDialog.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 16 16
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : <template>
       2            9 :   <AppDialogPanel
       3              :     size="compact"
       4              :     class="w-90"
       5              :     body-class="flex flex-col gap-4 text-[14px] text-muted-foreground"
       6              :     @close="onCancel"
       7              :   >
       8              :     <template #title>
       9              :       {{ t('sideToolbar.queueProgressOverlay.clearHistoryDialogTitle') }}
      10              :     </template>
      11              : 
      12              :     <p class="m-0">
      13              :       {{ t('sideToolbar.queueProgressOverlay.clearHistoryDialogDescription') }}
      14              :     </p>
      15              :     <p class="m-0">
      16              :       {{ t('sideToolbar.queueProgressOverlay.clearHistoryDialogAssetsNote') }}
      17              :     </p>
      18              : 
      19              :     <template #footer>
      20              :       <div class="flex items-center gap-4 leading-none">
      21              :         <Button variant="muted-textonly" size="lg" @click="onCancel">
      22              :           {{ t('g.cancel') }}
      23              :         </Button>
      24              :         <Button
      25              :           variant="secondary"
      26              :           size="lg"
      27              :           :disabled="isClearing"
      28              :           @click="onConfirm"
      29              :           >{{ t('g.clear') }}</Button
      30              :         >
      31              :       </div>
      32              :     </template>
      33              :   </AppDialogPanel>
      34              : </template>
      35              : 
      36              : <script setup lang="ts">
      37              : import AppDialogPanel from '@/components/dialog/AppDialogPanel.vue'
      38              : import { ref } from 'vue'
      39              : import { useI18n } from 'vue-i18n'
      40              : 
      41              : import Button from '@comfyorg/design-system/button/Button'
      42              : import { useErrorHandling } from '@/composables/useErrorHandling'
      43              : import { useDialogStore } from '@/stores/dialogStore'
      44              : import { useQueueStore } from '@/stores/queueStore'
      45              : 
      46            9 : const dialogStore = useDialogStore()
      47            9 : const queueStore = useQueueStore()
      48            9 : const { t } = useI18n()
      49            9 : const { wrapWithErrorHandlingAsync } = useErrorHandling()
      50              : 
      51            9 : const isClearing = ref(false)
      52              : 
      53            9 : const clearHistory = wrapWithErrorHandlingAsync(
      54              :   async () => {
      55            2 :     await queueStore.clear(['history'])
      56            2 :     dialogStore.closeDialog()
      57              :   },
      58              :   undefined,
      59              :   () => {
      60            2 :     isClearing.value = false
      61              :   }
      62              : )
      63              : 
      64            9 : const onConfirm = async () => {
      65            2 :   if (isClearing.value) return
      66            2 :   isClearing.value = true
      67            2 :   await clearHistory()
      68              : }
      69              : 
      70            9 : const onCancel = () => {
      71            3 :   dialogStore.closeDialog()
      72              : }
      73              : </script>
        

Generated by: LCOV version 2.0-1