From 5ecec98b36f4aaef594cd6c2dbc17ddb454fe7d6 Mon Sep 17 00:00:00 2001 From: Mariana Martinho Date: Tue, 10 Nov 2026 19:27:49 +0100 Subject: [PATCH 1/5] feat(ui): move Create Snapshot into the Snapshots toolbar Create Snapshot sits next to Import and Export All, as in the design, so the list starts right under the toolbar. The rail card above the list now shows only while a restore runs, its progress and result unchanged; the button is disabled meanwhile, as before when the card replaced it. Co-Authored-By: Claude Opus 5.5 --- e2e/lifecycle-snapshot-restore.test.ts | 15 +++--- locales/en.json | 2 - locales/zh.json | 2 - .../comfyUISettings/SnapshotsView.test.ts | 16 ++++--- .../views/comfyUISettings/SnapshotsView.vue | 46 +++++++++---------- 5 files changed, 38 insertions(+), 43 deletions(-) diff --git a/e2e/lifecycle-snapshot-restore.test.ts b/e2e/lifecycle-snapshot-restore.test.ts index ef99d9781..7b923538c 100644 --- a/e2e/lifecycle-snapshot-restore.test.ts +++ b/e2e/lifecycle-snapshot-restore.test.ts @@ -320,13 +320,12 @@ test('picker-driven restore surfaces inline op-card + auto-dismisses on success .toBe(true) await expect - .poll(async () => popup.evaluate(`!!document.querySelector('.snapshots-rail-cta')`), { - timeout: 8_000, - intervals: [200, 400] - }) + .poll( + async () => + popup.evaluate( + `!document.querySelector('${byTestId(TID.snapshotsOpCard)}') && document.querySelector('${byTestId(TID.snapshotsSaveCta)}')?.disabled === false` + ), + { timeout: 8_000, intervals: [200, 400] } + ) .toBe(true) - - expect( - await popup.evaluate(`!!document.querySelector('${byTestId(TID.snapshotsOpCard)}')`) - ).toBe(false) }) diff --git a/locales/en.json b/locales/en.json index 08133508e..23dafac73 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1167,8 +1167,6 @@ "snapshots": { "empty": "No snapshots yet. Snapshots are captured automatically when ComfyUI starts.", "createSnapshot": "Create Snapshot", - "createNew": "Create Snapshot", - "createLabel": "Create Snapshot", "changesInSnapshot": "What changed in this snapshot", "ifYouRestore": "What restoring this would change", "noSnapshotsToShare": "There are no snapshots to share yet.", diff --git a/locales/zh.json b/locales/zh.json index 941523c9c..c2e8bf8d5 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -1167,8 +1167,6 @@ "snapshots": { "empty": "还没有快照。ComfyUI 启动时会自动捕获快照。", "createSnapshot": "创建快照", - "createNew": "创建快照", - "createLabel": "创建快照", "changesInSnapshot": "此快照中发生的更改", "ifYouRestore": "恢复此快照将改变的内容", "noSnapshotsToShare": "还没有可分享的快照。", diff --git a/src/renderer/src/views/comfyUISettings/SnapshotsView.test.ts b/src/renderer/src/views/comfyUISettings/SnapshotsView.test.ts index a6e805cfc..2d1d4a19d 100644 --- a/src/renderer/src/views/comfyUISettings/SnapshotsView.test.ts +++ b/src/renderer/src/views/comfyUISettings/SnapshotsView.test.ts @@ -97,11 +97,13 @@ describe('comfyUISettings/SnapshotsView', () => { vi.useRealTimers() }) - it('idle: renders the Save New Snapshot CTA and no op-card', async () => { + it('idle: renders the Create Snapshot button in the toolbar and no op-card', async () => { const w = await mountView() expect(w.find(`[data-testid="${TID.snapshotsOpCard}"]`).exists()).toBe(false) - expect(w.find('.snapshots-rail-cta').exists()).toBe(true) - expect(w.find('.snapshots-rail-cta').text()).toContain('Create Snapshot') + expect(w.find('.snapshots-rail-node.is-save').exists()).toBe(false) + const cta = w.find(`[data-testid="${TID.snapshotsSaveCta}"]`) + expect(cta.text()).toContain('Create Snapshot') + expect(cta.attributes('disabled')).toBeUndefined() }) it('in-flight: morphs the slot into the op-card with target label + percent + spinner dot', async () => { @@ -118,7 +120,7 @@ describe('comfyUISettings/SnapshotsView', () => { } }) - expect(w.find('.snapshots-rail-cta').exists()).toBe(false) + expect(w.find(`[data-testid="${TID.snapshotsSaveCta}"]`).attributes('disabled')).toBeDefined() const card = w.find(`[data-testid="${TID.snapshotsOpCard}"]`) expect(card.exists()).toBe(true) @@ -264,7 +266,7 @@ describe('comfyUISettings/SnapshotsView', () => { await w.find(`[data-testid="${TID.snapshotsOpCardRetry}"]`).trigger('click') expect(w.emitted('op-retry')).toHaveLength(1) await nextTick() - expect(w.find('.snapshots-rail-cta').exists()).toBe(true) + expect(w.find(`[data-testid="${TID.snapshotsSaveCta}"]`).attributes('disabled')).toBeUndefined() }) it('error: Dismiss button emits op-dismiss and clears the card', async () => { @@ -322,7 +324,7 @@ describe('comfyUISettings/SnapshotsView', () => { await flushPromises() expect(w.find(`[data-testid="${TID.snapshotsOpCard}"]`).exists()).toBe(false) - expect(w.find('.snapshots-rail-cta').exists()).toBe(true) + expect(w.find(`[data-testid="${TID.snapshotsSaveCta}"]`).attributes('disabled')).toBeUndefined() expect(w.emitted('op-dismiss')).toHaveLength(1) expect(w.emitted('op-retry')).toBeUndefined() }) @@ -392,7 +394,7 @@ describe('comfyUISettings/SnapshotsView', () => { } }) expect(w.find(`[data-testid="${TID.snapshotsOpCard}"]`).exists()).toBe(false) - expect(w.find('.snapshots-rail-cta').exists()).toBe(true) + expect(w.find(`[data-testid="${TID.snapshotsSaveCta}"]`).attributes('disabled')).toBeUndefined() }) it('scrolls the top card into view when restore starts', async () => { diff --git a/src/renderer/src/views/comfyUISettings/SnapshotsView.vue b/src/renderer/src/views/comfyUISettings/SnapshotsView.vue index 3f8c3d7f7..9bfe292e1 100644 --- a/src/renderer/src/views/comfyUISettings/SnapshotsView.vue +++ b/src/renderer/src/views/comfyUISettings/SnapshotsView.vue @@ -2,7 +2,7 @@ import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue' import { useI18n } from 'vue-i18n' import Button from '@comfyorg/design-system/button/Button' -import { ChevronDown, Download, RotateCcw, Trash2, Upload } from 'lucide-vue-next' +import { Camera, ChevronDown, Download, RotateCcw, Trash2, Upload } from 'lucide-vue-next' import { TID } from '../../../../shared/testIds' import { MSG_CANCELLED } from '../../../../shared/operationStatus' import { useDialogs } from '../../composables/useDialogs' @@ -569,6 +569,19 @@ async function handleImport(): Promise {