diff --git a/browser_tests/fixtures/helpers/AssetsHelper.ts b/browser_tests/fixtures/helpers/AssetsHelper.ts index 45d8a2f3db0..bbef403b0e1 100644 --- a/browser_tests/fixtures/helpers/AssetsHelper.ts +++ b/browser_tests/fixtures/helpers/AssetsHelper.ts @@ -10,6 +10,7 @@ import type { JobDetail, RawJobListItem } from '@/platform/remote/comfyui/jobs/jobTypes' +import type { AssetDownloadWsMessage } from '@/platform/remote/comfyui/execution/types' const jobsListRoutePattern = '**/api/jobs?*' const assetsListRoutePattern = /\/api\/assets(?:\?.*)?$/ @@ -138,6 +139,12 @@ export class AssetsHelper { constructor(private readonly page: Page) {} + async dispatchDownload(message: AssetDownloadWsMessage): Promise { + await this.page.evaluate((download) => { + window.app!.api.dispatchCustomEvent('asset_download', download) + }, message) + } + async mockOutputHistory(jobs: RawJobListItem[]): Promise { this.generatedJobs = [...jobs] diff --git a/browser_tests/tests/dialogs/modelImportProgressDialog.spec.ts b/browser_tests/tests/dialogs/modelImportProgressDialog.spec.ts new file mode 100644 index 00000000000..e5ac4c86c77 --- /dev/null +++ b/browser_tests/tests/dialogs/modelImportProgressDialog.spec.ts @@ -0,0 +1,320 @@ +import type { TaskResponse } from '@/platform/tasks/services/taskService' + +import { + comfyPageFixture as test, + comfyExpect as expect +} from '@e2e/fixtures/ComfyPage' + +test.describe('Model import progress toast', { tag: ['@screenshot'] }, () => { + test('recovers from a premature failed status once the backend silently retries and completes it (PM-1302)', async ({ + comfyPage + }) => { + const { page } = comfyPage + const taskId = 'pm-1302-repro-task' + const assetName = 'stuck-model.safetensors' + + await test.step('show a running model import', async () => { + await comfyPage.assets.dispatchDownload({ + task_id: taskId, + asset_name: assetName, + bytes_total: 1000, + bytes_downloaded: 200, + progress: 20, + status: 'running' + }) + + await expect( + page.getByText('Importing Models', { exact: true }) + ).toBeVisible() + }) + + const failedFooterText = page.getByText('1 download failed', { + exact: true + }) + + await test.step('show the retryable failure reported by the backend', async () => { + await comfyPage.assets.dispatchDownload({ + task_id: taskId, + asset_name: assetName, + bytes_total: 1000, + bytes_downloaded: 200, + progress: 20, + status: 'failed', + error: 'Source server error' + }) + + await expect(failedFooterText).toBeVisible() + }) + + await test.step('recover after the backend retry succeeds', async () => { + await comfyPage.assets.dispatchDownload({ + task_id: taskId, + asset_name: assetName, + asset_id: 'asset-pm-1302', + bytes_total: 1000, + bytes_downloaded: 1000, + progress: 100, + status: 'completed' + }) + await comfyPage.nextFrame() + + await expect(failedFooterText).toBeHidden() + await expect( + page.getByText('All downloads completed', { exact: true }) + ).toBeVisible() + }) + + const toast = page + .getByRole('status') + .filter({ hasText: 'All downloads completed' }) + + await expect(toast).toHaveScreenshot( + 'model-import-progress-toast-recovered-completed.png', + { mask: [toast.locator('.timestamp')] } + ) + }) + + test('a failed download toast can still be manually dismissed when no later recovery message arrives (PM-1302)', async ({ + comfyPage + }) => { + const { page } = comfyPage + const taskId = 'pm-1302-dismiss-task' + const assetName = 'stuck-model.safetensors' + + await test.step('show a failed model import', async () => { + await comfyPage.assets.dispatchDownload({ + task_id: taskId, + asset_name: assetName, + bytes_total: 1000, + bytes_downloaded: 200, + progress: 20, + status: 'running' + }) + await comfyPage.assets.dispatchDownload({ + task_id: taskId, + asset_name: assetName, + bytes_total: 1000, + bytes_downloaded: 200, + progress: 20, + status: 'failed', + error: 'Source server error' + }) + }) + + const toast = page + .getByRole('status') + .filter({ hasText: '1 download failed' }) + await expect(toast).toBeVisible() + await expect( + page.getByText('1 download failed', { exact: true }) + ).toBeVisible() + + await test.step('dismiss the failed model import', async () => { + await toast.getByRole('button', { name: 'Close' }).click() + await expect(toast).toBeHidden() + }) + }) + + test('cancels a running download and renders the backend terminal state (PM-1309)', async ({ + comfyPage + }) => { + const { page } = comfyPage + const taskId = '1396cc07-bab2-4f12-9b54-741f83f9224c' + const assetName = 'cancelled-model.safetensors' + const cancellationResponse = page.waitForResponse( + (response) => + response.url().endsWith(`/tasks/${taskId}`) && + response.request().method() === 'DELETE' + ) + await page.route(`**/tasks/${taskId}`, async (route) => { + if (route.request().method() === 'DELETE') { + await route.fulfill({ status: 204 }) + return + } + + await route.fulfill({ + json: { + id: taskId, + idempotency_key: taskId, + task_name: 'task:download_file', + payload: {}, + status: 'running', + create_time: new Date().toISOString(), + update_time: new Date().toISOString() + } satisfies TaskResponse + }) + }) + + await test.step('show the running download', async () => { + await comfyPage.assets.dispatchDownload({ + task_id: taskId, + asset_name: assetName, + bytes_total: 1000, + bytes_downloaded: 200, + progress: 20, + status: 'running' + }) + }) + + const toast = page.getByRole('status').filter({ hasText: assetName }) + await expect(toast).toBeVisible() + + await test.step('cancel through user-visible controls', async () => { + await toast.getByRole('button', { name: 'Expand' }).click() + await expect( + toast.getByRole('button', { name: 'Collapse' }) + ).toBeVisible() + const cancelButton = toast.getByRole('button', { + name: 'Cancel Download' + }) + await expect(cancelButton).toBeVisible() + await cancelButton.click() + + const response = await cancellationResponse + expect(response.status()).toBe(204) + await expect( + toast.getByText('Cancelled', { exact: true }).first() + ).toBeVisible() + await expect(toast.getByRole('button', { name: 'Close' })).toBeHidden() + }) + + await test.step('keep the terminal backend state rendered', async () => { + await comfyPage.assets.dispatchDownload({ + task_id: taskId, + asset_name: assetName, + bytes_total: 1000, + bytes_downloaded: 200, + progress: 20, + status: 'cancelled' + }) + + await expect( + toast.getByText('Cancelled', { exact: true }).first() + ).toBeVisible() + await expect( + toast.getByRole('button', { name: 'Cancel Download' }) + ).toBeHidden() + await expect(toast.getByRole('button', { name: 'Close' })).toBeVisible() + }) + }) + + test('a cancelled download whose task row is purged can still be dismissed', async ({ + comfyPage + }) => { + // The store waits a real 10s before its first reconciliation, and this + // case has to observe that reconciliation rather than fake the clock: the + // toast does not render at all under an installed clock. + test.setTimeout(60_000) + + const { page } = comfyPage + const taskId = '1396cc07-bab2-4f12-9b54-741f83f9224d' + const assetName = 'purged-model.safetensors' + // The backend accepts the cancellation, then purges the task row, so no + // terminal WS message and no successful poll will ever arrive. + await page.route(`**/tasks/${taskId}`, async (route) => { + if (route.request().method() === 'DELETE') { + await route.fulfill({ status: 204 }) + return + } + await route.fulfill({ status: 404, json: { detail: 'Task not found' } }) + }) + + const toast = page.getByRole('status').filter({ hasText: assetName }) + + await test.step('cancel a running download', async () => { + await comfyPage.assets.dispatchDownload({ + task_id: taskId, + asset_name: assetName, + bytes_total: 1000, + bytes_downloaded: 200, + progress: 20, + status: 'running' + }) + + await expect(toast).toBeVisible() + await toast.getByRole('button', { name: 'Expand' }).click() + await toast.getByRole('button', { name: 'Cancel Download' }).click() + + await expect( + toast.getByText('Cancelled', { exact: true }).first() + ).toBeVisible() + await expect(toast.getByRole('button', { name: 'Close' })).toBeHidden() + }) + + await test.step('settle the cancellation once the task lookup 404s', async () => { + await page.waitForResponse( + (response) => + response.url().endsWith(`/tasks/${taskId}`) && + response.request().method() === 'GET', + { timeout: 30_000 } + ) + + await expect(toast.getByRole('button', { name: 'Close' })).toBeVisible() + }) + + await test.step('dismiss the settled cancellation', async () => { + await toast.getByRole('button', { name: 'Close' }).click() + await expect(toast).toBeHidden() + }) + }) + + test('closing a failed download while polling does not reopen its toast', async ({ + comfyPage + }) => { + const { page } = comfyPage + const taskId = '1396cc07-bab2-4f12-9b54-741f83f9224b' + const assetName = 'failed-model.safetensors' + let releaseResponse!: () => void + const responseReady = new Promise((resolve) => { + releaseResponse = resolve + }) + const response: TaskResponse = { + id: taskId, + idempotency_key: taskId, + task_name: 'task:download_file', + payload: {}, + status: 'failed', + error_message: 'Download failed', + create_time: new Date().toISOString(), + update_time: new Date().toISOString() + } + await page.route(`**/tasks/${taskId}`, async (route) => { + await responseReady + await route.fulfill({ json: response }) + }) + + await test.step('start reconciling a failed model import', async () => { + await page.clock.install() + await comfyPage.assets.dispatchDownload({ + task_id: taskId, + asset_name: assetName, + bytes_total: 1000, + bytes_downloaded: 200, + progress: 20, + status: 'failed', + error: 'Source server error' + }) + const request = page.waitForRequest(`**/tasks/${taskId}`) + await page.clock.runFor(10_000) + await request + }) + + const toast = page + .getByRole('status') + .filter({ hasText: '1 download failed' }) + + await test.step('dismiss the model import during reconciliation', async () => { + await toast.getByRole('button', { name: 'Close' }).click() + await expect(toast).toBeHidden() + }) + + await test.step('keep the model import dismissed after polling settles', async () => { + const completedResponse = page.waitForResponse(`**/tasks/${taskId}`) + releaseResponse() + await (await completedResponse).finished() + await page.clock.runFor(100) + + await expect(toast).toBeHidden() + }) + }) +}) diff --git a/browser_tests/tests/modelImportProgressDialogStuckDownload.spec.ts-snapshots/model-import-progress-toast-recovered-completed-chromium-linux.png b/browser_tests/tests/dialogs/modelImportProgressDialog.spec.ts-snapshots/model-import-progress-toast-recovered-completed-chromium-linux.png similarity index 100% rename from browser_tests/tests/modelImportProgressDialogStuckDownload.spec.ts-snapshots/model-import-progress-toast-recovered-completed-chromium-linux.png rename to browser_tests/tests/dialogs/modelImportProgressDialog.spec.ts-snapshots/model-import-progress-toast-recovered-completed-chromium-linux.png diff --git a/browser_tests/tests/modelImportProgressDialogStuckDownload.spec.ts b/browser_tests/tests/modelImportProgressDialogStuckDownload.spec.ts deleted file mode 100644 index c3978be1720..00000000000 --- a/browser_tests/tests/modelImportProgressDialogStuckDownload.spec.ts +++ /dev/null @@ -1,226 +0,0 @@ -import type { Page } from '@playwright/test' - -import type { TaskResponse } from '@/platform/tasks/services/taskService' - -import { - comfyPageFixture as test, - comfyExpect as expect -} from '@e2e/fixtures/ComfyPage' - -/** - * REGRESSION COVERAGE PM-1302 / PM-1309 (frontend half): - * - * On the cloud side, `HandleDownloadFile` (download_file.go) can broadcast a - * terminal `failed` message for a retryable error before asynq decides - * whether a retry will happen, then quietly retries. `assetDownloadStore` - * (src/stores/assetDownloadStore.ts) now treats a `failed` status as - * recoverable rather than final, so a later `completed` message for the same - * `task_id` still updates it - keeping the ModelImportProgressDialog toast - * from getting stuck reporting a download as failed forever when it actually - * finished successfully. - * - * This test drives that exact WS sequence through the real `asset_download` - * client event (the same event `assetDownloadStore` listens on in - * production) and proves the toast recovers once the later success message - * arrives. - */ -const TASK_ID = 'pm-1302-repro-task' -const ASSET_NAME = 'stuck-model.safetensors' - -interface AssetDownloadMessage { - task_id: string - asset_name: string - bytes_total: number - bytes_downloaded: number - progress: number - status: 'created' | 'running' | 'completed' | 'failed' - asset_id?: string - error?: string -} - -async function dispatchAssetDownload( - page: Page, - message: AssetDownloadMessage -) { - await page.evaluate((msg) => { - window.app!.api.dispatchCustomEvent('asset_download', msg) - }, message) -} - -test.describe( - 'Model import progress toast - stuck download status', - { tag: ['@screenshot'] }, - () => { - test('recovers from a premature failed status once the backend silently retries and completes it (PM-1302)', async ({ - comfyPage - }) => { - const { page } = comfyPage - - // 1. Download starts. - await dispatchAssetDownload(page, { - task_id: TASK_ID, - asset_name: ASSET_NAME, - bytes_total: 1000, - bytes_downloaded: 200, - progress: 20, - status: 'running' - }) - - const toastHeader = page.getByText('Importing Models', { exact: true }) - await expect(toastHeader).toBeVisible() - - // 2. Backend hits a retryable error and (per the bug in - // download_file.go's HandleDownloadFile) broadcasts a premature - // terminal `failed` message before it decides to retry. - await dispatchAssetDownload(page, { - task_id: TASK_ID, - asset_name: ASSET_NAME, - bytes_total: 1000, - bytes_downloaded: 200, - progress: 20, - status: 'failed', - error: 'Source server error' - }) - - const failedFooterText = page.getByText('1 download failed', { - exact: true - }) - await expect(failedFooterText).toBeVisible() - - // 3. Backend silently retried (asynq's StatusMiddleware reset the task - // to pending) and the retry succeeded - cloud broadcasts the real, - // later `completed` message for the same task_id. - await dispatchAssetDownload(page, { - task_id: TASK_ID, - asset_name: ASSET_NAME, - asset_id: 'asset-pm-1302', - bytes_total: 1000, - bytes_downloaded: 1000, - progress: 100, - status: 'completed' - }) - await comfyPage.nextFrame() - - // The later `completed` message updates the download rather than - // being dropped, so the toast reflects the real, successful outcome. - await expect(failedFooterText).toBeHidden() - await expect( - page.getByText('All downloads completed', { exact: true }) - ).toBeVisible() - - // Scoped to the toast: a full-`body` screenshot also captures the - // canvas graph background, which isn't pixel-stable across CI runs. - const toast = page - .getByRole('status') - .filter({ hasText: 'All downloads completed' }) - - // Visual proof of the recovered, completed toast state. - await expect(toast).toHaveScreenshot( - 'model-import-progress-toast-recovered-completed.png', - { mask: [toast.locator('.timestamp')] } - ) - }) - - test('a failed download toast can still be manually dismissed when no later recovery message arrives (PM-1302)', async ({ - comfyPage - }) => { - const { page } = comfyPage - - // Same premature-failed sequence as above, minus the later `completed` - // message - the point here is only whether the user can get rid of a - // failed toast on their own when the backend never does send a - // recovery message. - await dispatchAssetDownload(page, { - task_id: TASK_ID, - asset_name: ASSET_NAME, - bytes_total: 1000, - bytes_downloaded: 200, - progress: 20, - status: 'running' - }) - await dispatchAssetDownload(page, { - task_id: TASK_ID, - asset_name: ASSET_NAME, - bytes_total: 1000, - bytes_downloaded: 200, - progress: 20, - status: 'failed', - error: 'Source server error' - }) - - // Scoped by footer text: `getByRole('status')` alone also matches the - // top-menu action bar's own status region and is a strict-mode - // violation with two toasts on screen. - const toast = page - .getByRole('status') - .filter({ hasText: '1 download failed' }) - await expect(toast).toBeVisible() - await expect( - page.getByText('1 download failed', { exact: true }) - ).toBeVisible() - - // `isInProgress` is false once a `failed` status lands, so - // ModelImportProgressDialog's close (X) button renders and is - // clickable regardless of whether a later recovery message ever - // arrives. - // - // Scoped to `toast`: `page.getByRole('button', { name: 'Close' })` - // alone also matches the canvas minimap's close button - // (`data-testid="close-minimap-button"`) and is a strict-mode - // violation with the minimap visible. - await toast.getByRole('button', { name: 'Close' }).click() - - await expect(toast).toBeHidden() - }) - - test('closing a failed download while polling does not reopen its toast', async ({ - comfyPage - }) => { - const { page } = comfyPage - const taskId = '1396cc07-bab2-4f12-9b54-741f83f9224b' - let releaseResponse!: () => void - const responseReady = new Promise((resolve) => { - releaseResponse = resolve - }) - const response: TaskResponse = { - id: taskId, - idempotency_key: taskId, - task_name: 'task:download_file', - payload: {}, - status: 'failed', - error_message: 'Download failed', - create_time: new Date().toISOString(), - update_time: new Date().toISOString() - } - await page.route(`**/tasks/${taskId}`, async (route) => { - await responseReady - await route.fulfill({ json: response }) - }) - await page.clock.install() - await dispatchAssetDownload(page, { - task_id: taskId, - asset_name: ASSET_NAME, - bytes_total: 1000, - bytes_downloaded: 200, - progress: 20, - status: 'failed', - error: 'Source server error' - }) - const request = page.waitForRequest(`**/tasks/${taskId}`) - await page.clock.runFor(10_000) - await request - - const toast = page - .getByRole('status') - .filter({ hasText: '1 download failed' }) - await toast.getByRole('button', { name: 'Close' }).click() - await expect(toast).toBeHidden() - const completedResponse = page.waitForResponse(`**/tasks/${taskId}`) - releaseResponse() - await (await completedResponse).finished() - await page.clock.runFor(100) - - await expect(toast).toBeHidden() - }) - } -) diff --git a/eslint-suppressions.json b/eslint-suppressions.json index ea3f6dd2cfa..2900c760e98 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -239,11 +239,6 @@ "count": 1 } }, - "src/platform/tasks/services/taskService.ts": { - "comfy/no-new-error-throw": { - "count": 3 - } - }, "src/platform/workflow/management/stores/comfyWorkflow.ts": { "comfy/no-new-error-throw": { "count": 2 diff --git a/src/components/toast/ProgressToastItem.test.ts b/src/components/toast/ProgressToastItem.test.ts index 14e5b5d867e..ceaf775821c 100644 --- a/src/components/toast/ProgressToastItem.test.ts +++ b/src/components/toast/ProgressToastItem.test.ts @@ -1,4 +1,5 @@ import { render, screen } from '@testing-library/vue' +import userEvent from '@testing-library/user-event' import { describe, expect, it } from 'vitest' import { createI18n } from 'vue-i18n' @@ -15,7 +16,12 @@ const i18n = createI18n({ finished: 'Finished', failed: 'Failed', pending: 'Pending' - } + }, + electronFileDownload: { + cancel: 'Cancel Download', + cancelled: 'Cancelled' + }, + g: { cancel: 'Cancel' } } } }) @@ -49,3 +55,40 @@ describe('ProgressToastItem — completed state', () => { expect(assetName.closest('.opacity-50')).not.toBeNull() }) }) + +describe('ProgressToastItem — cancellation', () => { + it('offers cancellation for running downloads', async () => { + const user = userEvent.setup() + const running = { ...completedJob(), status: 'running' as const } + const { emitted } = render(ProgressToastItem, { + props: { job: running }, + global: { plugins: [i18n] } + }) + + await user.click(screen.getByRole('button', { name: 'Cancel Download' })) + expect(emitted().cancel).toEqual([['task-1']]) + }) + + it('shows cancelled as terminal without another cancel button', () => { + const cancelled = { ...completedJob(), status: 'cancelled' as const } + render(ProgressToastItem, { + props: { job: cancelled }, + global: { plugins: [i18n] } + }) + + expect(screen.getByText('Cancelled')).toBeVisible() + expect(screen.queryByRole('button', { name: 'Cancel Download' })).toBeNull() + }) + + it('disables duplicate cancellation while the request is pending', () => { + const running = { ...completedJob(), status: 'running' as const } + render(ProgressToastItem, { + props: { job: running, isCancelling: true }, + global: { plugins: [i18n] } + }) + + expect( + screen.getByRole('button', { name: 'Cancel Download' }) + ).toBeDisabled() + }) +}) diff --git a/src/components/toast/ProgressToastItem.vue b/src/components/toast/ProgressToastItem.vue index 92a5cef08b1..2a0cde3f115 100644 --- a/src/components/toast/ProgressToastItem.vue +++ b/src/components/toast/ProgressToastItem.vue @@ -4,12 +4,17 @@ import { useI18n } from 'vue-i18n' import Loader from '@/components/loader/Loader.vue' import StatusBadge from '@/components/common/StatusBadge.vue' +import Button from '@/components/ui/button/Button.vue' +import type { TaskId } from '@/platform/tasks/services/taskService' import type { AssetDownload } from '@/stores/assetDownloadStore' +import { isDownloadCancelled } from '@/stores/assetDownloadStore' import { cn } from '@comfyorg/tailwind-utils' -const { job } = defineProps<{ +const { job, isCancelling = false } = defineProps<{ job: AssetDownload + isCancelling?: boolean }>() +const emit = defineEmits<{ cancel: [taskId: TaskId] }>() const { t } = useI18n() @@ -18,6 +23,7 @@ const isCompleted = computed(() => job.status === 'completed') const isFailed = computed(() => job.status === 'failed') const isRunning = computed(() => job.status === 'running') const isPending = computed(() => job.status === 'created') +const isCancelled = computed(() => isDownloadCancelled(job.status)) + + + + diff --git a/src/platform/assets/components/AssetExportProgressDialog.test.ts b/src/platform/assets/components/AssetExportProgressDialog.test.ts new file mode 100644 index 00000000000..91f0491ab21 --- /dev/null +++ b/src/platform/assets/components/AssetExportProgressDialog.test.ts @@ -0,0 +1,56 @@ +import { render, screen } from '@testing-library/vue' +import { createI18n } from 'vue-i18n' +import { describe, expect, it, vi } from 'vitest' +import { nextTick } from 'vue' + +import enMessages from '@/locales/en/main.json' with { type: 'json' } +import { useAssetExportStore } from '@/stores/assetExportStore' + +import AssetExportProgressDialog from './AssetExportProgressDialog.vue' + +vi.mock(import('@/scripts/api'), () => ({ + api: { + fetchApi: vi.fn(), + addEventListener: vi.fn(), + removeEventListener: vi.fn() + } +})) + +const i18n = createI18n({ + legacy: false, + locale: 'en', + messages: { en: enMessages } +}) + +function renderDialog() { + const store = useAssetExportStore() + store.trackExport('task-export-1') + render(AssetExportProgressDialog, { global: { plugins: [i18n] } }) + return store +} + +describe('AssetExportProgressDialog', () => { + it('renders a cancelled export as cancelled rather than pending', async () => { + const store = renderDialog() + + store.exportList[0].status = 'cancelled' + await nextTick() + + // `cancelled` is a reachable export status because `DELETE /tasks/{id}` is + // task-type agnostic. Falling through to the pending branch would report a + // finished export as still queued. + expect(screen.queryByText('Pending')).toBeNull() + expect(screen.getAllByText('Cancelled')).not.toHaveLength(0) + expect(screen.queryByText('All exports completed')).toBeNull() + }) + + it('still reports a completed export as completed', async () => { + const store = renderDialog() + + store.exportList[0].status = 'completed' + store.exportList[0].exportName = 'bundle.zip' + await nextTick() + + expect(screen.getByText('All exports completed')).toBeVisible() + }) +}) diff --git a/src/platform/assets/components/AssetExportProgressDialog.vue b/src/platform/assets/components/AssetExportProgressDialog.vue index f5e4e48d348..4e7b64ef48c 100644 --- a/src/platform/assets/components/AssetExportProgressDialog.vue +++ b/src/platform/assets/components/AssetExportProgressDialog.vue @@ -19,6 +19,9 @@ const exportJobs = computed(() => assetExportStore.exportList) const failedJobs = computed(() => assetExportStore.finishedExports.filter((e) => e.status === 'failed') ) +const cancelledJobs = computed(() => + assetExportStore.finishedExports.filter((e) => e.status === 'cancelled') +) const isInProgress = computed(() => assetExportStore.hasActiveExports) const currentJobName = computed(() => { @@ -38,6 +41,7 @@ const footerLabel = computed(() => { if (isInProgress.value) return currentJobName.value if (failedJobs.value.length > 0) return t('exportToast.exportFailed', { count: failedJobs.value.length }) + if (cancelledJobs.value.length > 0) return t('electronFileDownload.cancelled') return t('exportToast.allExportsCompleted') }) @@ -46,6 +50,8 @@ const footerIconClass = computed(() => { return 'icon-[lucide--loader-circle] animate-spin text-muted-foreground' if (failedJobs.value.length > 0) return 'icon-[lucide--circle-alert] text-destructive-background' + if (cancelledJobs.value.length > 0) + return 'icon-[lucide--circle-x] text-muted-foreground' return 'icon-[lucide--check-circle] text-jade-600' }) @@ -146,6 +152,11 @@ function closeDialog() { /> +