Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion e2e/lifecycle-snapshot-export.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ test('per-row Export writes a valid envelope JSON to disk @windows @macos @linux
const firstFilename = filenames[0]!

await popup.waitForSelector('.snapshot-row.is-expanded', { timeout: 5_000 })
await popup.waitForSelector(byTestId(TID.snapshotRowExport(firstFilename)), { timeout: 5_000 })
await popup.clickUntilVisible(
byTestId(TID.snapshotRowMore(firstFilename)),
byTestId(TID.snapshotRowExport(firstFilename)),
{ timeout: 5_000 }
)

expect(await popup.click(byTestId(TID.snapshotRowExport(firstFilename)))).toBe(true)

Expand Down
15 changes: 7 additions & 8 deletions e2e/lifecycle-snapshot-restore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,12 @@ test('picker-driven restore surfaces inline op-card + auto-dismisses on success
.toBe(true)

await expect
.poll(async () => popup.evaluate<boolean>(`!!document.querySelector('.snapshots-rail-cta')`), {
timeout: 8_000,
intervals: [200, 400]
})
.poll(
async () =>
popup.evaluate<boolean>(
`!document.querySelector('${byTestId(TID.snapshotsOpCard)}') && document.querySelector('${byTestId(TID.snapshotsSaveCta)}')?.disabled === false`
),
{ timeout: 8_000, intervals: [200, 400] }
)
.toBe(true)

expect(
await popup.evaluate<boolean>(`!!document.querySelector('${byTestId(TID.snapshotsOpCard)}')`)
).toBe(false)
})
3 changes: 1 addition & 2 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -1261,6 +1259,7 @@
"importPreviewLabel": "Snapshots",
"importedSnapshot": "Imported snapshot",
"latestBadge": "Latest",
"moreActions": "More actions",
"latestLabel": "Latest:",
"noneYet": "No snapshots yet",
"restoreCancelled": "Restore cancelled",
Expand Down
3 changes: 1 addition & 2 deletions locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,6 @@
"snapshots": {
"empty": "还没有快照。ComfyUI 启动时会自动捕获快照。",
"createSnapshot": "创建快照",
"createNew": "创建快照",
"createLabel": "创建快照",
"changesInSnapshot": "此快照中发生的更改",
"ifYouRestore": "恢复此快照将改变的内容",
"noSnapshotsToShare": "还没有可分享的快照。",
Expand Down Expand Up @@ -1261,6 +1259,7 @@
"importPreviewLabel": "快照",
"importedSnapshot": "导入的快照",
"latestBadge": "最新",
"moreActions": "更多操作",
"latestLabel": "最新:",
"noneYet": "还没有快照",
"restoreCancelled": "恢复已取消",
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/src/assets/design-system-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
--color-subtle-foreground: oklch(0.6 0 0);
--color-border-strong: oklch(1 0 0 / 0.14);
--color-media-overlay: oklch(0 0 0 / 0.55);
--color-snapshot-chip: #202020;
--color-snapshot-ring: #262729;

--text-ui: 13px;
--text-ui--line-height: 20px;
Expand Down
173 changes: 78 additions & 95 deletions src/renderer/src/views/comfyUISettings/SnapshotRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import Button from '@comfyorg/design-system/button/Button'
import { ChevronDown, Tag, Boxes, Package } from 'lucide-vue-next'
import { ChevronRight } from 'lucide-vue-next'
import type { SnapshotSummary } from '../../types/ipc'
import {
triggerLabel as _triggerLabel,
Expand Down Expand Up @@ -81,124 +81,107 @@ const titlePillText = computed(() => {
return props.snapshot.comfyuiVersion
})
const hasTitlePill = computed(() => !!titlePillText.value)
const showVersionChange = computed(() => !hasCustomLabel.value && comfyuiChanged.value)
</script>

<template>
<div class="snapshot-row flex flex-col gap-2" :class="{ 'is-expanded': expanded }">
<Button
type="button"
variant="textonly"
size="unset"
class="snapshot-row-head static flex w-full flex-col items-stretch justify-normal gap-1.5 rounded-lg border-none bg-transparent p-0 text-left text-inherit whitespace-normal [font:inherit] appearance-auto hover:bg-transparent focus-visible:rounded-[4px] focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:[outline-style:solid] focus-visible:outline-[var(--accent-primary)] focus-visible:ring-0"
:aria-expanded="expanded"
:data-testid="toggleTestId"
@click="emit('toggle')"
<div class="snapshot-row flex flex-col" :class="{ 'is-expanded': expanded }">
<div
class="snapshot-row-line flex min-h-11 items-center gap-2 rounded-[10px] pr-1.5 pl-2.5 transition-[background-color] duration-100 ease-[ease] hover:bg-[color-mix(in_oklch,var(--color-foreground)_4%,transparent)] has-[:focus-visible]:bg-[color-mix(in_oklch,var(--color-foreground)_4%,transparent)] has-[.snapshot-row-head:focus-visible]:outline-2 has-[.snapshot-row-head:focus-visible]:-outline-offset-2 has-[.snapshot-row-head:focus-visible]:outline-[var(--accent-primary)]"
>
<div class="snapshot-row-head-top flex items-center justify-between gap-2.5">
<div class="snapshot-row-head-left flex min-w-0 items-center gap-2">
<span
class="snapshot-row-trigger text-[12px] text-neutral-100 data-[tone=state]:text-[var(--warning)]"
:data-tone="triggerTone"
>{{ triggerCopy }}</span
>
<span
v-if="isLatest"
class="snapshot-row-latest shrink-0 rounded-[999px] bg-[color-mix(in_srgb,var(--text)_8%,transparent)] px-1.5 py-px text-[11px] leading-[16.5px] font-medium text-text-muted"
>
{{ t('snapshots.latestBadge') }}
</span>
</div>
<div class="snapshot-row-head-right flex min-w-0 items-center gap-2">
<span
class="snapshot-row-time shrink-0 text-[12px] whitespace-nowrap text-text-muted"
:title="absoluteCopy"
>{{ relativeCopy }}</span
>
<ChevronDown
:size="14"
class="snapshot-row-chevron text-text-muted transition-transform duration-[180ms] ease-[cubic-bezier(0.4,0,0.2,1)]"
:class="{ '[transform:rotate(180deg)]': expanded }"
/>
</div>
</div>
<div
v-if="hasTitlePill || hasNodeChanges || hasPipChanges"
class="snapshot-row-pills flex flex-wrap items-center gap-1.5"
<Button
type="button"
variant="textonly"
size="unset"
class="snapshot-row-head @container static flex h-11 min-w-0 flex-1 items-center overflow-hidden justify-normal gap-2.5 rounded-none border-none bg-transparent p-0 text-left text-inherit whitespace-nowrap [font:inherit] appearance-auto hover:bg-transparent focus-visible:outline-none focus-visible:ring-0"
:aria-expanded="expanded"
:data-testid="toggleTestId"
@click="emit('toggle')"
>
<span
class="snapshot-row-time w-[76px] shrink-0 truncate text-[12px] text-text-muted"
:title="absoluteCopy"
>{{ relativeCopy }}</span
>
<span class="w-5 shrink-0" aria-hidden="true"></span>
<ChevronRight
:size="14"
class="snapshot-row-chevron shrink-0 text-[var(--color-subtle-foreground)] transition-transform duration-150 ease-[ease]"
:class="{ 'rotate-90': expanded }"
aria-hidden="true"
/>
<span
class="snapshot-row-trigger shrink-0 rounded-md bg-[color-mix(in_oklch,var(--color-foreground)_8%,transparent)] px-[7px] py-px text-[12px] text-text-muted data-[tone=state]:bg-[color-mix(in_oklch,var(--color-foreground)_13%,transparent)] data-[tone=state]:text-neutral-100"
:data-tone="triggerTone"
>{{ triggerCopy }}</span
>
<span
v-if="hasTitlePill"
class="snap-pill snap-pill--version inline-flex min-w-0 max-w-full items-center gap-1 rounded-[999px] border border-solid bg-[var(--brand-surface-bg)] px-[7px] py-px text-[11px] leading-4 whitespace-nowrap text-neutral-100 tabular-nums [&>svg]:shrink-0 [&>svg]:opacity-70 [&>span]:min-w-0 [&>span]:truncate"
:class="
comfyuiChanged
? 'is-change border-[color-mix(in_srgb,var(--comfy-yellow,#f0ff41)_45%,var(--chooser-surface-border))]'
: 'border-[var(--chooser-surface-border)]'
"
class="snap-pill snap-pill--version snapshot-row-name min-w-0 truncate text-[13px] font-medium text-neutral-100 tabular-nums"
:class="{ 'is-change': showVersionChange }"
:title="titlePillText"
>
<Tag :size="11" aria-hidden="true" />
<span>{{ titlePillText }}</span>
<template v-if="showVersionChange"
><span class="mr-1 text-text-muted">{{ previousComfyuiVersion }} →</span>
<span class="font-semibold text-[var(--color-foreground)]">{{
snapshot.comfyuiVersion
}}</span></template
>
<template v-else>{{ titlePillText }}</template>
</span>
<span
v-if="hasNodeChanges"
class="snap-pill snap-pill--nodes inline-flex items-center gap-1 rounded-[999px] bg-snapshot-chip px-[7px] py-px text-[11px] leading-4 whitespace-nowrap text-text-muted [&>svg]:shrink-0 [&>svg]:opacity-70"
v-if="isLatest"
class="snapshot-row-latest inline-flex h-5 shrink-0 items-center rounded-full bg-[color-mix(in_oklch,var(--color-foreground)_7%,transparent)] px-2 text-[11px] leading-none font-medium text-text-muted"
>
<Boxes :size="11" aria-hidden="true" />
<span
v-if="nodeDelta.added"
class="snap-delta is-add font-semibold text-[#22c55e] tabular-nums"
>+{{ nodeDelta.added }}</span
>
<span
v-if="nodeDelta.removed"
class="snap-delta is-remove font-semibold text-danger tabular-nums"
>−{{ nodeDelta.removed }}</span
>
<span
v-if="nodeDelta.changed"
class="snap-delta is-change font-semibold text-[var(--warning)] tabular-nums"
>~{{ nodeDelta.changed }}</span
>
<span class="snap-pill-label opacity-70">{{ t('snapshots.nodesLabel') }}</span>
{{ t('snapshots.latestBadge') }}
</span>
<span
v-if="hasPipChanges"
class="snap-pill snap-pill--pkgs inline-flex items-center gap-1 rounded-[999px] bg-snapshot-chip px-[7px] py-px text-[11px] leading-4 whitespace-nowrap text-text-muted [&>svg]:shrink-0 [&>svg]:opacity-70"
v-if="hasNodeChanges || hasPipChanges"
class="snapshot-row-delta hidden shrink-0 items-center @md:inline-flex gap-1.5 text-[12px] text-text-muted tabular-nums"
>
<Package :size="11" aria-hidden="true" />
<span
v-if="pipDelta.added"
class="snap-delta is-add font-semibold text-[#22c55e] tabular-nums"
>+{{ pipDelta.added }}</span
>
<span
v-if="pipDelta.removed"
class="snap-delta is-remove font-semibold text-danger tabular-nums"
>−{{ pipDelta.removed }}</span
>
<span
v-if="pipDelta.changed"
class="snap-delta is-change font-semibold text-[var(--warning)] tabular-nums"
>~{{ pipDelta.changed }}</span
>
<span class="snap-pill-label opacity-70">{{ t('snapshots.pkgsLabel') }}</span>
<span v-if="hasNodeChanges" class="snap-pill snap-pill--nodes inline-flex gap-1">
<span v-if="nodeDelta.added" class="snap-delta is-add text-[var(--success)]"
>+{{ nodeDelta.added }}</span
>
<span v-if="nodeDelta.removed" class="snap-delta is-remove text-danger"
>−{{ nodeDelta.removed }}</span
>
<span v-if="nodeDelta.changed" class="snap-delta is-change text-neutral-100"
>~{{ nodeDelta.changed }}</span
>
<span class="snap-pill-label">{{ t('snapshots.nodesLabel') }}</span>
</span>
<span v-if="hasNodeChanges && hasPipChanges" aria-hidden="true">·</span>
<span v-if="hasPipChanges" class="snap-pill snap-pill--pkgs inline-flex gap-1">
<span v-if="pipDelta.added" class="snap-delta is-add text-[var(--success)]"
>+{{ pipDelta.added }}</span
>
<span v-if="pipDelta.removed" class="snap-delta is-remove text-danger"
>−{{ pipDelta.removed }}</span
>
<span v-if="pipDelta.changed" class="snap-delta is-change text-neutral-100"
>~{{ pipDelta.changed }}</span
>
<span class="snap-pill-label">{{ t('snapshots.pkgsLabel') }}</span>
</span>
</span>
</Button>
<div class="snapshot-row-actions ml-auto flex shrink-0 items-center gap-1">
<slot name="actions" />
</div>
</Button>
</div>

<BaseAccordion :open="expanded">
<div
class="snapshot-row-card flex flex-col rounded-lg border border-solid border-[var(--chooser-surface-border)] bg-[var(--brand-surface-bg)] px-3 py-2.5"
>
<div class="snapshot-row-card flex flex-col gap-2.5 pt-1 pr-4 pb-4 pl-[126px]">
<div
class="snapshot-row-meta flex flex-wrap items-center gap-1.5 px-1.5 py-px text-[11px] text-text-muted [overflow-wrap:anywhere]"
class="snapshot-row-meta flex flex-wrap items-center gap-1.5 text-[12px] text-[var(--color-subtle-foreground)] [overflow-wrap:anywhere]"
>
<span>{{ t('snapshots.nodesCount', { count: snapshot.nodeCount }) }}</span>
<span class="snapshot-row-meta-dot opacity-50">·</span>
<span class="snapshot-row-meta-dot" aria-hidden="true">·</span>
<span>{{ t('snapshots.packagesCount', { count: snapshot.pipPackageCount }) }}</span>
<slot name="meta" />
</div>
<div
class="snapshot-row-expanded mt-1 flex flex-col gap-2.5 border-t border-solid border-border-hover pt-3"
>
<div class="snapshot-row-expanded flex flex-col gap-2.5">
<slot name="expanded" />
</div>
</div>
Expand Down
Loading
Loading