From 84375a62d4ecba32f9a0bd199be508918c3bdd68 Mon Sep 17 00:00:00 2001 From: PabloWiedemann Date: Thu, 12 Nov 2026 12:30:28 -0800 Subject: [PATCH] feat(assets): see all assets from a Comfy Cloud app result For app runs made on Comfy Cloud, the output preview button now says "See all assets" and opens the Assets panel on the Comfy Cloud tab. The old button was "View in Assets" and also opened one file by name. That does not fit the new label, so the click no longer carries a name. AssetsView takes a startOnCloud prop in place of focusName, and the code that looked for one file by name is removed. --- locales/en.json | 2 +- locales/zh.json | 2 +- src/renderer/src/panel/AppsView.test.ts | 6 +- src/renderer/src/panel/AppsView.vue | 9 ++- src/renderer/src/panel/AssetsView.test.ts | 61 +++---------------- src/renderer/src/panel/AssetsView.vue | 43 +------------ src/renderer/src/panel/OutputDetailDialog.vue | 8 +-- src/renderer/src/panel/PanelApp.test.ts | 8 +-- src/renderer/src/panel/PanelApp.vue | 13 ++-- 9 files changed, 34 insertions(+), 118 deletions(-) diff --git a/locales/en.json b/locales/en.json index e231614b4..8a9d24f54 100644 --- a/locales/en.json +++ b/locales/en.json @@ -92,7 +92,7 @@ "computer": "This computer" }, "showInFolder": "Show in folder", - "viewInAssets": "View in Assets", + "seeAllAssets": "See all assets", "local": { "folderActions": "Folder actions", "inFolder": "In {name}", diff --git a/locales/zh.json b/locales/zh.json index d811f042f..003e2aed3 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -92,7 +92,7 @@ "computer": "这台电脑" }, "showInFolder": "在文件夹中显示", - "viewInAssets": "在资产中查看", + "seeAllAssets": "查看全部资产", "local": { "folderActions": "文件夹操作", "inFolder": "位于 {name}", diff --git a/src/renderer/src/panel/AppsView.test.ts b/src/renderer/src/panel/AppsView.test.ts index 11fa9489a..524e4f96a 100644 --- a/src/renderer/src/panel/AppsView.test.ts +++ b/src/renderer/src/panel/AppsView.test.ts @@ -422,7 +422,7 @@ describe('AppsView', () => { expect(wrapper.get('[data-testid="output-detail-saved-in"]').text()).toContain( 'remove-background' ) - expect(wrapper.find('[data-testid="output-detail-view-in-assets"]').exists()).toBe(false) + expect(wrapper.find('[data-testid="output-detail-see-all-assets"]').exists()).toBe(false) await wrapper.get('[data-testid="output-detail-show-in-folder"]').trigger('click') expect(appsOutputAction).toHaveBeenLastCalledWith({ action: 'show-in-folder', index: 0 }) @@ -431,10 +431,10 @@ describe('AppsView', () => { 'Comfy Cloud assets' ) expect(wrapper.find('[data-testid="output-detail-show-in-folder"]').exists()).toBe(false) - await wrapper.get('[data-testid="output-detail-view-in-assets"]').trigger('click') + await wrapper.get('[data-testid="output-detail-see-all-assets"]').trigger('click') await flushPromises() - expect(wrapper.emitted('view-in-assets')).toEqual([['cloud-cutout.png']]) + expect(wrapper.emitted('see-all-assets')).toEqual([[]]) expect(wrapper.find('[data-testid="output-detail-panel"]').exists()).toBe(false) }) }) diff --git a/src/renderer/src/panel/AppsView.vue b/src/renderer/src/panel/AppsView.vue index bc83f52e6..74d316cf0 100644 --- a/src/renderer/src/panel/AppsView.vue +++ b/src/renderer/src/panel/AppsView.vue @@ -20,7 +20,7 @@ const { growBy = 0 } = defineProps<{ const emit = defineEmits<{ 'app-open': [open: boolean] 'app-entered': [entered: boolean] - 'view-in-assets': [name: string] + 'see-all-assets': [] }>() const { t } = useI18n() @@ -97,10 +97,9 @@ function appOutputAction(action: AppOutputAction['action'], index: number): void if (action === 'open-workflow') closeAppOutputs() } -function viewInAssets(index: number): void { - const name = appOutputs.value?.items[index]?.name +function seeAllAssets(): void { closeAppOutputs() - if (name) emit('view-in-assets', name) + emit('see-all-assets') } onBeforeUnmount(() => { @@ -120,7 +119,7 @@ onBeforeUnmount(() => { @download="appOutputAction('download', $event)" @open-workflow="appOutputAction('open-workflow', $event)" @show-in-folder="appOutputAction('show-in-folder', $event)" - @view-in-assets="viewInAssets" + @see-all-assets="seeAllAssets" />
{ }) }) -describe('AssetsView opened for one Cloud file', () => { - it('shows the Comfy Cloud assets with the newest Cloud file of that name open, for this visit only', async () => { +describe('AssetsView opened from an app result', () => { + it('shows the Comfy Cloud assets for this visit only, without opening a file', async () => { window.localStorage.setItem('comfy.desktop.assets.place', 'computer') listOutputFolders.mockResolvedValue([]) - listAssets.mockImplementation(async (id: string) => - id === 'cloud' - ? [ - { ...asset('old', 'cloud-cutout.png', 'image'), createdAt: '2026-11-01T12:00:00Z' }, - asset('a', 'forest.png', 'image'), - { ...asset('new', 'cloud-cutout.png', 'image'), createdAt: '2026-11-10T12:00:00Z' } - ] - : [{ ...asset('local', 'cloud-cutout.png', 'image'), createdAt: '2026-11-12T12:00:00Z' }] - ) - - const wrapper = await mountAssets( - [{ ...build('cloud', 'Comfy Cloud'), sourceCategory: 'cloud' }, build('lab', 'Video Lab')], - [], - { props: { focusName: 'cloud-cutout.png' } } - ) - expect(wrapper.find('[data-testid="output-detail-panel"]').exists()).toBe(false) - useAuthStore().status = { signedIn: true } - await flushPromises() - - expect(wrapper.find('[data-testid="assets-grid"]').exists()).toBe(true) - expect(wrapper.get('[data-testid="output-detail-panel"] h2').text()).toBe('cloud-cutout.png') - expect(wrapper.get('[data-testid="output-detail-panel"]').text()).toContain('11/10/2026') - expect(wrapper.emitted('focus-used')).toHaveLength(1) - expect(window.localStorage.getItem('comfy.desktop.assets.place')).toBe('computer') - }) + listAssets.mockResolvedValue([ + asset('a', 'forest.png', 'image'), + asset('b', 'cloud-cutout.png', 'image') + ]) - it('does not open the file if the user moved to This computer before it loaded', async () => { - listOutputFolders.mockResolvedValue([]) - let finish: (assets: AssetSummary[]) => void = () => {} - listAssets.mockImplementation( - () => new Promise((resolve) => (finish = resolve)) - ) const wrapper = await mountAssets( [{ ...build('cloud', 'Comfy Cloud'), sourceCategory: 'cloud' }], [], - { props: { focusName: 'cloud-cutout.png' } } + { props: { startOnCloud: true } } ) - useAuthStore().status = { signedIn: true } await flushPromises() - await openThisComputer(wrapper) - finish([asset('new', 'cloud-cutout.png', 'image')]) - await flushPromises() - - expect(wrapper.find('[data-testid="output-detail-panel"]').exists()).toBe(false) - }) - - it('just shows the Comfy Cloud assets when the file is not there', async () => { - listAssets.mockResolvedValue([asset('a', 'forest.png', 'image')]) - const wrapper = await mountAssets([build('lab', 'Video Lab')], [], { - props: { focusName: 'missing.png' } - }) - - expect(assetNames(wrapper)).toEqual(['forest.png']) + expect(assetNames(wrapper)).toEqual(['forest.png', 'cloud-cutout.png']) expect(wrapper.find('[data-testid="output-detail-panel"]').exists()).toBe(false) - expect(wrapper.emitted('focus-used')).toHaveLength(1) + expect(window.localStorage.getItem('comfy.desktop.assets.place')).toBe('computer') }) }) diff --git a/src/renderer/src/panel/AssetsView.vue b/src/renderer/src/panel/AssetsView.vue index 54535d6ea..8b83c2ea8 100644 --- a/src/renderer/src/panel/AssetsView.vue +++ b/src/renderer/src/panel/AssetsView.vue @@ -46,8 +46,7 @@ type SortOrder = 'newest' | 'oldest' const SKELETON_COUNT = 8 const NAME_TOOLTIP_DELAY_MS = 600 -const { focusName = null } = defineProps<{ focusName?: string | null }>() -const emit = defineEmits<{ 'focus-used': [] }>() +const { startOnCloud = false } = defineProps<{ startOnCloud?: boolean }>() const { t } = useI18n() const modal = useModal() @@ -56,7 +55,7 @@ const installationStore = useInstallationStore() const sessionStore = useSessionStore() const savedPlace = useLocalStorage('comfy.desktop.assets.place', 'cloud') -const place = ref(focusName ? 'cloud' : savedPlace.value) +const place = ref(startOnCloud ? 'cloud' : savedPlace.value) const localFolder = ref(null) const localFolders = useTemplateRef>('localFolders') const kindFilter = ref('all') @@ -198,44 +197,6 @@ watch( { immediate: true } ) -let pendingFocus: string | null = null - -function isCloudId(installationId: string): boolean { - const inst = installationStore.getById(installationId) - return !!inst && isCloudBuild(inst) -} - -const cloudLoaded = computed(() => loadedBuildIds.value.some(isCloudId)) - -watch( - () => focusName, - (name) => { - if (!name) return - pendingFocus = name - place.value = 'cloud' - emit('focus-used') - }, - { immediate: true } -) - -watch( - [visibleAssets, loading, cloudLoaded], - ([list, busy, cloud]) => { - if (!pendingFocus || busy || !cloud) return - const name = pendingFocus - pendingFocus = null - if (place.value !== 'cloud') return - const newest = list - .filter((asset) => asset.name === name && isCloudId(asset.installationId)) - .reduce( - (best, asset) => (best && createdMs(best) >= createdMs(asset) ? best : asset), - null - ) - if (newest) openDetail(newest) - }, - { immediate: true } -) - watch(visibleAssets, (list) => { if (detailKey.value !== null && !list.some((asset) => cardKey(asset) === detailKey.value)) detailKey.value = null diff --git a/src/renderer/src/panel/OutputDetailDialog.vue b/src/renderer/src/panel/OutputDetailDialog.vue index 2978752c4..1f416d167 100644 --- a/src/renderer/src/panel/OutputDetailDialog.vue +++ b/src/renderer/src/panel/OutputDetailDialog.vue @@ -55,7 +55,7 @@ const emit = defineEmits<{ download: [index: number] 'open-workflow': [index: number] 'show-in-folder': [index: number] - 'view-in-assets': [index: number] + 'see-all-assets': [] }>() const { t, locale } = useI18n() @@ -378,11 +378,11 @@ useEventListener(window, 'keydown', (event: KeyboardEvent) => { variant="secondary" size="md" class="gap-1.5 text-ui" - data-testid="output-detail-view-in-assets" - @click="emit('view-in-assets', index)" + data-testid="output-detail-see-all-assets" + @click="emit('see-all-assets')" >