diff --git a/locales/en.json b/locales/en.json index 89d3be5ac..e60120deb 100644 --- a/locales/en.json +++ b/locales/en.json @@ -93,7 +93,7 @@ "computer": "This computer" }, "showInFolder": "Show in folder", - "viewInAssets": "View in Assets", + "seeAllAssets": "See all assets", "local": { "folderActions": "Folder actions", "howFoldersWork": "How folders work", diff --git a/locales/zh.json b/locales/zh.json index 6dbddb60d..31b3384fa 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -93,7 +93,7 @@ "computer": "这台电脑" }, "showInFolder": "在文件夹中显示", - "viewInAssets": "在资产中查看", + "seeAllAssets": "查看全部资产", "local": { "folderActions": "文件夹操作", "howFoldersWork": "文件夹说明", diff --git a/src/renderer/src/panel/AppsView.test.ts b/src/renderer/src/panel/AppsView.test.ts index 6d4a74ff7..72af2cb11 100644 --- a/src/renderer/src/panel/AppsView.test.ts +++ b/src/renderer/src/panel/AppsView.test.ts @@ -443,7 +443,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 }) @@ -452,10 +452,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 4f438230b..3de106d5c 100644 --- a/src/renderer/src/panel/AppsView.vue +++ b/src/renderer/src/panel/AppsView.vue @@ -21,7 +21,7 @@ const { growBy = 0, obscured = false } = defineProps<{ const emit = defineEmits<{ 'app-open': [open: boolean] 'app-entered': [entered: boolean] - 'view-in-assets': [name: string] + 'see-all-assets': [] }>() const { t } = useI18n() @@ -100,10 +100,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(() => { @@ -123,7 +122,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({ - running: [build('lab', 'Video Lab')], - signedIn: false, - 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') - }) - - 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({ - signedIn: false, - props: { focusName: 'cloud-cutout.png' } - }) + listAssets.mockResolvedValue([ + asset('a', 'forest.png', 'image'), + asset('b', 'cloud-cutout.png', 'image') + ]) + const wrapper = await mountAssets({ signedIn: false, props: { startOnCloud: true } }) useAuthStore().status = { signedIn: true } await flushPromises() - await openThisComputer(wrapper) - finish([asset('new', 'cloud-cutout.png', 'image')]) - await flushPromises() + expect(assetNames(wrapper)).toEqual(['forest.png', 'cloud-cutout.png']) 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({ props: { focusName: 'missing.png' } }) - - expect(assetNames(wrapper)).toEqual(['forest.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 6dad5dc66..4d9d66d1d 100644 --- a/src/renderer/src/panel/AssetsView.vue +++ b/src/renderer/src/panel/AssetsView.vue @@ -44,8 +44,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() @@ -53,7 +52,7 @@ const authStore = useAuthStore() const installationStore = useInstallationStore() 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') @@ -72,7 +71,6 @@ const { y: scrollTop } = useScroll(scroller) const nameTooltipsWarm = ref(false) let warmTimer: ReturnType | undefined const loading = ref(false) -const cloudLoaded = ref(false) const failed = ref(false) const cloudBuildId = computed(() => @@ -169,17 +167,14 @@ async function loadAssets(): Promise { const installationId = cloudBuildId.value if (!installationId) { assets.value = [] - cloudLoaded.value = false return } const listed = await window.api.listAssets(installationId) if (current !== requestId) return assets.value = listed.map((asset) => ({ ...asset, installationId })) - cloudLoaded.value = true } catch { if (current !== requestId) return assets.value = [] - cloudLoaded.value = false failed.value = true } finally { if (current === requestId) loading.value = false @@ -194,37 +189,6 @@ watch(accountContext, () => (assets.value = [])) watch([cloudBuildId, accountContext], () => void loadAssets(), { immediate: true }) -let pendingFocus: string | null = null - -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) - .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 4dad5ed6c..166d74c88 100644 --- a/src/renderer/src/panel/OutputDetailDialog.vue +++ b/src/renderer/src/panel/OutputDetailDialog.vue @@ -56,7 +56,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() @@ -385,11 +385,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')" >