diff --git a/locales/en.json b/locales/en.json index 33d8b9069..beaa05d83 100644 --- a/locales/en.json +++ b/locales/en.json @@ -63,20 +63,9 @@ }, "assets": { "kindLabel": "Asset type", - "buildPickerLabel": "Build", - "browseAssetsOf": "Browse the assets of", + "placeLabel": "Where files are saved", + "cloud": "Comfy Cloud", "thisComputer": "This computer", - "outputFolder": "Output folder", - "buildStatus": "{where} · {state}", - "buildWhere": { - "local": "Local", - "cloud": "Cloud" - }, - "buildState": { - "running": "Running", - "starting": "Starting", - "stopped": "Stopped" - }, "kind": { "all": "All", "image": "Images", @@ -121,6 +110,8 @@ "signedOutTitle": "Log in to see your assets", "signedOutBody": "Assets that you make in Comfy Cloud show here.", "signIn": "Log in to Comfy Cloud", + "noCloudBuildTitle": "This workspace has no Comfy Cloud build yet", + "noCloudBuildBody": "Add Comfy Cloud to this workspace to see its assets here.", "inspect": "Inspect {name}", "detail": { "tags": "Tags", @@ -128,7 +119,8 @@ "createdAt": "Created {date}", "fit": "Fit", "zoom": "Zoom", - "zoomLevel": "Zoom: {level}" + "zoomLevel": "Zoom: {level}", + "savedIn": "Saved in" }, "kindSingular": { "image": "Image", @@ -136,6 +128,18 @@ "audio": "Audio", "3d": "3D", "file": "File" + }, + "local": { + "folderActions": "Folder actions", + "noBuilds": "No build saves here yet", + "savedBy": "Saved here by", + "openFolder": "Open folder", + "path": "Folder path", + "noFoldersTitle": "No output folders yet", + "noFoldersBody": "Files appear here after you run a workflow with ComfyUI on this computer.", + "emptyFolder": "No images, videos, audio or 3D files here.", + "folderFailed": "Couldn't open this folder. It may have been moved or deleted.", + "backToComputer": "Back to This computer" } }, "home": { diff --git a/locales/zh.json b/locales/zh.json index ebe69c26f..817daa6f2 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -63,20 +63,9 @@ }, "assets": { "kindLabel": "资产类型", - "buildPickerLabel": "构建", - "browseAssetsOf": "浏览以下构建的资产", + "placeLabel": "文件保存位置", + "cloud": "Comfy Cloud", "thisComputer": "这台电脑", - "outputFolder": "输出文件夹", - "buildStatus": "{where} · {state}", - "buildWhere": { - "local": "本地", - "cloud": "云端" - }, - "buildState": { - "running": "运行中", - "starting": "启动中", - "stopped": "已停止" - }, "kind": { "all": "全部", "image": "图片", @@ -121,6 +110,8 @@ "signedOutTitle": "登录以查看你的资产", "signedOutBody": "你在 Comfy Cloud 中生成的资产会显示在这里。", "signIn": "登录 Comfy Cloud", + "noCloudBuildTitle": "此工作区还没有 Comfy Cloud 构建", + "noCloudBuildBody": "将 Comfy Cloud 添加到此工作区后,这里会显示它的资产。", "inspect": "查看 {name}", "detail": { "tags": "标签", @@ -128,7 +119,8 @@ "createdAt": "创建于 {date}", "fit": "适应", "zoom": "缩放", - "zoomLevel": "缩放:{level}" + "zoomLevel": "缩放:{level}", + "savedIn": "保存位置" }, "kindSingular": { "image": "图片", @@ -136,6 +128,18 @@ "audio": "音频", "3d": "3D", "file": "文件" + }, + "local": { + "folderActions": "文件夹操作", + "noBuilds": "还没有构建保存到这里", + "savedBy": "保存到这里的构建", + "openFolder": "打开文件夹", + "path": "文件夹路径", + "noFoldersTitle": "还没有输出文件夹", + "noFoldersBody": "在这台电脑上用 ComfyUI 运行工作流后,文件会显示在这里。", + "emptyFolder": "这里没有图片、视频、音频或 3D 文件。", + "folderFailed": "无法打开此文件夹。它可能已被移动或删除。", + "backToComputer": "返回这台电脑" } }, "home": { diff --git a/src/main/lib/ipc/installationsForRenderer.test.ts b/src/main/lib/ipc/installationsForRenderer.test.ts deleted file mode 100644 index 76e64cfab..000000000 --- a/src/main/lib/ipc/installationsForRenderer.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { EventEmitter } from 'events' -import os from 'os' -import type { InstallationRecord } from '../../installations' - -vi.mock('electron', () => ({ - app: { - isPackaged: false, - getPath: () => os.tmpdir(), - getVersion: () => '0.0.0-test', - getLocale: () => 'en' - }, - ipcMain: { handle: vi.fn(), on: vi.fn(), off: vi.fn() }, - dialog: {}, - shell: {}, - session: {}, - WebContentsView: class {}, - BrowserWindow: { getAllWindows: () => [] }, - nativeTheme: { on: vi.fn(), shouldUseDarkColors: false } -})) - -vi.mock('../i18n', () => ({ - t: (key: string) => key, - init: vi.fn(), - getMessages: () => ({}), - getLocale: () => 'en', - getAvailableLocales: () => [] -})) - -vi.mock('../../settings', () => ({ - get: vi.fn(() => undefined), - set: vi.fn(async () => {}), - getAll: vi.fn(() => ({})), - getMirrorConfig: vi.fn(() => ({ pypiMirror: undefined, useChineseMirrors: false })), - defaults: { modelsDirs: ['/unused'], inputDir: '/unused', outputDir: '/unused' } -})) - -vi.mock('../../installations', () => ({ - installationEvents: new EventEmitter(), - CLOUD_SOURCE_ID: 'cloud', - list: vi.fn(async () => []), - get: vi.fn(async () => null), - update: vi.fn(async () => null), - remove: vi.fn(async () => {}) -})) - -import { enrichInstallationsForRenderer } from './registerInstallationHandlers' - -function installation(id: string, sourceId: string): InstallationRecord { - return { - id, - name: id, - sourceId, - installPath: `/installs/${id}`, - status: 'installed', - createdAt: '2026-11-01T00:00:00Z' - } -} - -describe('enrichInstallationsForRenderer', () => { - it('tells the page which builds save to an output folder Desktop can list', () => { - const { enriched } = enrichInstallationsForRenderer([ - installation('standalone', 'standalone'), - installation('from-a-build', 'comfybuilder'), - installation('old-desktop', 'desktop'), - installation('cloud', 'cloud'), - installation('server', 'remote') - ]) - - expect(Object.fromEntries(enriched.map((inst) => [inst.id, inst.hasOutputFolder]))).toEqual({ - standalone: true, - 'from-a-build': true, - 'old-desktop': false, - cloud: false, - server: false - }) - }) -}) diff --git a/src/main/lib/ipc/registerInstallationHandlers.ts b/src/main/lib/ipc/registerInstallationHandlers.ts index 95b2ccbe5..0ebf5642d 100644 --- a/src/main/lib/ipc/registerInstallationHandlers.ts +++ b/src/main/lib/ipc/registerInstallationHandlers.ts @@ -38,7 +38,6 @@ import * as releaseCache from '../release-cache' import { runStartupReleaseChecks } from '../release-cache-startup' import { _broadcastToRenderer } from './shared' import { hasGitDir } from '../git' -import { hasOutputFolder } from '../outputFolders' import { parseUrl } from '../util' import { restoreSnapshotIntoInstallation } from '../standaloneMigration' import * as mainTelemetry from '../telemetry' @@ -130,7 +129,6 @@ export function enrichInstallationsForRenderer(allInstalls: InstallationRecord[] sourceLabel: source.label, sourceCategory: source.category, hasConsole: source.hasConsole !== false, - hasOutputFolder: hasOutputFolder(inst), ...(buildVersion ? { distributionVersion: buildVersion } : {}), ...(listPreview != null ? { listPreview } : {}), ...(statusTag ? { statusTag } : {}) diff --git a/src/main/lib/outputFolders.test.ts b/src/main/lib/outputFolders.test.ts index 60341690f..c719b996c 100644 --- a/src/main/lib/outputFolders.test.ts +++ b/src/main/lib/outputFolders.test.ts @@ -82,14 +82,13 @@ vi.mock('./assets', () => ({ import type { InstallationRecord } from '../installations' import { - MAX_FOLDER_DEPTH, MAX_LOCAL_ASSETS, THUMBNAIL_WAIT_MS, copyOutputImage, hasOutputFolder, revealOutputFile, trashOutputFile, - listLocalAssets, + listOutputFolder, listOutputFolders, outputDirOverride, outputFilePath, @@ -179,37 +178,47 @@ describe('hasOutputFolder', () => { }) describe('listOutputFolders', () => { - it('lists each real output folder once, leaving out Cloud and builds that manage their own paths', async () => { + it('lists each real output folder once with the builds that save there, leaving out Cloud and builds that manage their own paths', async () => { expect(await listOutputFolders()).toEqual([ - sharedDir, - ownDir, - path.join(installDir, 'ComfyUI', 'output') + { + path: sharedDir, + builds: ['Test Instance', 'My Local 1'], + buildIds: ['Test Instance', 'My Local 1'] + }, + { path: ownDir, builds: ['Apps'], buildIds: ['Apps'] }, + { path: path.join(installDir, 'ComfyUI', 'output'), builds: ['Bare'], buildIds: ['Bare'] } ]) }) - it('leaves out folders that do not exist yet', async () => { + it('leaves out folders that do not exist yet, and keeps the shared folder when no build saves there', async () => { installs.mockResolvedValue([ install('Gone', { useSharedOutput: false, outputDir: path.join(root, 'missing') }) ]) - expect(await listOutputFolders()).toEqual([sharedDir]) + expect(await listOutputFolders()).toEqual([{ path: sharedDir, builds: [], buildIds: [] }]) }) }) -describe('listLocalAssets', () => { - it("lists the media in the picked build's output folder and its subfolders, newest first", async () => { +describe('listOutputFolder', () => { + it('lists the subfolders by name and the media files newest first, leaving out hidden and other files', async () => { write(path.join(sharedDir, 'old.png'), 'x', new Date('2026-10-01T00:00:00Z')) - write(path.join(sharedDir, 'video', 'new.mp4'), 'xx', new Date('2026-11-05T00:00:00Z')) + write(path.join(sharedDir, 'new.mp4'), 'xx', new Date('2026-11-05T00:00:00Z')) write(path.join(sharedDir, 'mesh.glb'), 'x', new Date('2026-11-02T00:00:00Z')) - write(path.join(ownDir, 'voice.wav'), 'xxx', new Date('2026-11-03T00:00:00Z')) + write(path.join(sharedDir, 'video', 'inside.mp4')) + write(path.join(sharedDir, 'Apps', 'inside.png')) write(path.join(sharedDir, 'notes.txt')) write(path.join(sharedDir, '.hidden.png')) write(path.join(sharedDir, '.cache', 'inside-hidden.png')) + await listOutputFolders() - const assets = await listLocalAssets('Test Instance') + const listing = await listOutputFolder(sharedDir) - expect(assets.map((a) => a.name)).toEqual(['new.mp4', 'mesh.glb', 'old.png']) - const newVideo = path.join(sharedDir, 'video', 'new.mp4') - expect(assets[0]).toEqual({ + expect(listing!.folders).toEqual([ + { name: 'Apps', path: path.join(sharedDir, 'Apps') }, + { name: 'video', path: path.join(sharedDir, 'video') } + ]) + expect(listing!.files.map((a) => a.name)).toEqual(['new.mp4', 'mesh.glb', 'old.png']) + const newVideo = path.join(sharedDir, 'new.mp4') + expect(listing!.files[0]).toEqual({ id: newVideo, name: 'new.mp4', kind: 'video', @@ -224,19 +233,21 @@ describe('listLocalAssets', () => { durationSeconds: null }) const oldPicture = path.join(sharedDir, 'old.png') - expect(assets[2]!.thumbnailUrl, 'an image thumbnail link changes when the file does').toBe( - outputFileUrl(oldPicture, fs.statSync(oldPicture).mtimeMs) - ) - expect(assets[1]!.previewUrl, '3D files have no preview').toBeNull() + expect( + listing!.files[2]!.thumbnailUrl, + 'an image thumbnail link changes when the file does' + ).toBe(outputFileUrl(oldPicture, fs.statSync(oldPicture).mtimeMs)) + expect(listing!.files[1]!.previewUrl, '3D files have no preview').toBeNull() }) it('reports the size of each picture and video, and how long a video runs, before they load', async () => { write(path.join(sharedDir, 'portrait.png'), pngHeader(640, 960)) write(path.join(sharedDir, 'clip.webm'), fs.readFileSync(SAMPLE_VIDEO)) write(path.join(sharedDir, 'broken.png'), 'not a picture') + await listOutputFolders() const facts = Object.fromEntries( - (await listLocalAssets('Test Instance')).map((a) => [ + (await listOutputFolder(sharedDir))!.files.map((a) => [ a.name, [a.width, a.height, a.durationSeconds && Math.round(a.durationSeconds)] ]) @@ -249,25 +260,21 @@ describe('listLocalAssets', () => { }) }) - it('shows each build the files in its own output folder', async () => { - write(path.join(sharedDir, 'shared.png')) - write(path.join(ownDir, 'own.png')) - write(path.join(installDir, 'ComfyUI', 'output', 'install.png')) - const namesFor = async (id: string) => (await listLocalAssets(id)).map((a) => a.name) + it('lists a subfolder, and refuses folders outside the output folders', async () => { + write(path.join(ownDir, 'nested', 'still.png')) + write(path.join(outsideDir, 'secret.png')) + await listOutputFolders() - expect(await namesFor('Test Instance'), 'a build on the shared folder').toEqual(['shared.png']) - expect(await namesFor('My Local 1'), 'another build on the shared folder').toEqual([ - 'shared.png' - ]) - expect(await namesFor('Apps'), 'a build with its own folder').toEqual(['own.png']) - expect(await namesFor('Bare'), 'a build that saves inside its install').toEqual(['install.png']) - expect(await namesFor('Cloud'), 'Cloud has no folder on this computer').toEqual([]) - expect(await namesFor('Old Desktop'), 'a build that manages its own paths').toEqual([]) - expect(await namesFor('deleted'), 'a build that is gone').toEqual([]) + const nested = await listOutputFolder(path.join(ownDir, 'nested')) + expect(nested!.files.map((a) => a.name)).toEqual(['still.png']) + expect(await listOutputFolder(outsideDir), 'a folder outside').toBeNull() expect( - (await listLocalAssets()).map((a) => a.name), - 'no build: the shared output folder' - ).toEqual(['shared.png']) + await listOutputFolder(path.join(ownDir, '..', 'outside')), + 'a path that climbs out' + ).toBeNull() + expect(await listOutputFolder('nested'), 'a relative path').toBeNull() + expect(await listOutputFolder(path.join(ownDir, 'missing')), 'a folder that is gone').toBeNull() + expect(await listOutputFolder(42), 'not a path').toBeNull() }) it('opens a file it listed for a build added a moment ago', async () => { @@ -277,7 +284,8 @@ describe('listLocalAssets', () => { write(file) installs.mockResolvedValue([install('New', { useSharedOutput: false, outputDir: newDir })]) try { - const [listed] = await listLocalAssets('New') + await listOutputFolders() + const [listed] = (await listOutputFolder(newDir))!.files expect(listed!.id).toBe(file) expect(await outputFilePath(listed!.id)).toBe(file) @@ -286,26 +294,25 @@ describe('listLocalAssets', () => { } }) - it('keeps only the newest files when the folders are very large', async () => { + it('keeps only the newest files when a folder is very large', async () => { for (let i = 0; i <= MAX_LOCAL_ASSETS; i++) write(path.join(sharedDir, `f${i}.png`), '', new Date(Date.UTC(2026, 0, 1, 0, 0, i))) + await listOutputFolders() - const assets = await listLocalAssets('Test Instance') + const listing = await listOutputFolder(sharedDir) - expect(assets).toHaveLength(MAX_LOCAL_ASSETS) - expect(assets.map((a) => a.name)).not.toContain('f0.png') + expect(listing!.files).toHaveLength(MAX_LOCAL_ASSETS) + expect(listing!.files.map((a) => a.name)).not.toContain('f0.png') }) - it('does not follow links out of an output folder or walk without end', async () => { + it('does not follow links out of an output folder', async () => { write(path.join(outsideDir, 'secret.png')) fs.symlinkSync(outsideDir, path.join(sharedDir, 'escape')) - const deep = path.join( - sharedDir, - ...Array.from({ length: MAX_FOLDER_DEPTH + 1 }, (_, i) => `d${i}`) - ) - write(path.join(deep, 'too-deep.png')) + fs.symlinkSync(path.join(outsideDir, 'secret.png'), path.join(sharedDir, 'secret.png')) + await listOutputFolders() - expect(await listLocalAssets('Test Instance')).toEqual([]) + expect(await listOutputFolder(sharedDir)).toEqual({ folders: [], files: [] }) + expect(await listOutputFolder(path.join(sharedDir, 'escape'))).toBeNull() }) }) diff --git a/src/main/lib/outputFolders.ts b/src/main/lib/outputFolders.ts index 1b0ead901..f9d7e3f2d 100644 --- a/src/main/lib/outputFolders.ts +++ b/src/main/lib/outputFolders.ts @@ -1,5 +1,4 @@ import fsp from 'fs/promises' -import type { Dirent } from 'fs' import path from 'path' import { pathToFileURL } from 'url' import { ipcMain, nativeImage, net, protocol, shell } from 'electron' @@ -12,13 +11,18 @@ import { mediaFactsFromFile } from './mediaFacts' import { runPool } from '../sources/standalone/templateDownloadCore' import { installOutputDir } from './models' import { sourceMap } from './ipc/shared' -import type { AssetSummary } from '../../types/ipc' +import type { + AssetSummary, + OutputFolder, + OutputFolderListing, + OutputSubfolder +} from '../../types/ipc' export const OUTPUT_FILES_SCHEME = 'comfy-output' -const LIST_LOCAL_CHANNEL = 'assets:list-local' +const LIST_FOLDERS_CHANNEL = 'assets:output-folders' +const LIST_FOLDER_CHANNEL = 'assets:output-folder' export const MAX_LOCAL_ASSETS = 500 -export const MAX_FOLDER_DEPTH = 6 const THUMBNAIL_SIZE = 480 const MAX_CACHED_THUMBNAILS = 400 const THUMBNAILS_AT_ONCE = 2 @@ -61,29 +65,23 @@ async function realDir(dir: string): Promise { return stat?.isDirectory() ? real : null } -interface OutputFolders { - all: string[] - shared: string | null - ofBuild: Map -} - -async function findOutputFolders(): Promise { +export async function listOutputFolders(): Promise { const sharedDir = sharedOutputDir() const shared = await realDir(sharedDir) - const ofBuild = new Map() + const byPath = new Map() + if (shared) byPath.set(shared, { path: shared, builds: [], buildIds: [] }) for (const inst of await installations.list()) { const dir = outputDirFor(inst, sharedDir) const real = dir ? await realDir(dir) : null - if (real) ofBuild.set(inst.id, real) + if (!real) continue + const folder = byPath.get(real) ?? { path: real, builds: [], buildIds: [] } + folder.builds.push(inst.name) + folder.buildIds.push(inst.id) + byPath.set(real, folder) } - const all = [...new Set([...(shared ? [shared] : []), ...ofBuild.values()])] - allowedRoots = all + allowedRoots = [...byPath.keys()] allowedRootsAt = Date.now() - return { all, shared, ofBuild } -} - -export async function listOutputFolders(): Promise { - return (await findOutputFolders()).all + return [...byPath.values()] } function isInsideRoot(target: string, root: string): boolean { @@ -93,7 +91,7 @@ function isInsideRoot(target: string, root: string): boolean { async function allowedPath(target: string): Promise { if (!path.isAbsolute(target)) return null - if (Date.now() - allowedRootsAt > ROOTS_FRESH_MS) await findOutputFolders() + if (Date.now() - allowedRootsAt > ROOTS_FRESH_MS) await listOutputFolders() const real = await fsp.realpath(target).catch(() => null) if (!real) return null return allowedRoots.some((root) => isInsideRoot(real, root)) ? real : null @@ -134,25 +132,6 @@ export function outputFileUrl(file: string, thumbnailOf?: number): string { return thumbnailOf === undefined ? url : `${url}?thumbnail=${Math.round(thumbnailOf)}` } -async function collectMediaFiles(root: string): Promise { - const files: string[] = [] - const walk = async (dir: string, depth: number): Promise => { - const dirents: Dirent[] = await fsp.readdir(dir, { withFileTypes: true }).catch(() => []) - const subfolders: string[] = [] - for (const dirent of dirents) { - if (dirent.name.startsWith('.')) continue - const full = path.join(dir, dirent.name) - if (dirent.isDirectory()) subfolders.push(full) - else if (dirent.isFile() && assetKind(dirent.name) !== null) files.push(full) - } - if (depth < MAX_FOLDER_DEPTH) { - for (const sub of subfolders) await walk(sub, depth + 1) - } - } - await walk(root, 0) - return files -} - function localSummary(file: string, sizeBytes: number, modifiedMs: number): AssetSummary { const kind = assetKind(file) return { @@ -175,13 +154,22 @@ async function addMediaFacts(asset: AssetSummary): Promise { Object.assign(asset, await mediaFactsFromFile(asset.id, asset.kind)) } -export async function listLocalAssets(installationId?: string): Promise { - const folders = await findOutputFolders() - const folder = installationId === undefined ? folders.shared : folders.ofBuild.get(installationId) - const files = folder ? await collectMediaFiles(folder) : [] +export async function listOutputFolder(target: unknown): Promise { + if (typeof target !== 'string') return null + const dir = await allowedPath(target) + const dirents = dir ? await fsp.readdir(dir, { withFileTypes: true }).catch(() => null) : null + if (!dir || !dirents) return null + const folders: OutputSubfolder[] = [] + const files: string[] = [] + for (const dirent of dirents) { + if (dirent.name.startsWith('.')) continue + const full = path.join(dir, dirent.name) + if (dirent.isDirectory()) folders.push({ name: dirent.name, path: full }) + else if (dirent.isFile() && assetKind(dirent.name) !== null) files.push(full) + } const found: AssetSummary[] = [] await runPool(files, STATS_AT_ONCE, async (file) => { - const stat = await fsp.stat(file).catch(() => null) + const stat = await fsp.lstat(file).catch(() => null) if (!stat?.isFile()) return const modifiedMs = Number.isFinite(stat.mtimeMs) ? stat.mtimeMs : 0 found.push(localSummary(file, stat.size, modifiedMs)) @@ -190,7 +178,7 @@ export async function listLocalAssets(installationId?: string): Promise b.createdAt!.localeCompare(a.createdAt!)) .slice(0, MAX_LOCAL_ASSETS) await runPool(newest, STATS_AT_ONCE, addMediaFacts) - return newest + return { folders: folders.sort((a, b) => a.name.localeCompare(b.name)), files: newest } } function linuxThumbnailSource(file: string, sizeBytes: number): Electron.NativeImage | null { @@ -319,7 +307,6 @@ export function registerOutputFilesScheme(): void { export function registerOutputFolderHandlers(): void { protocol.handle(OUTPUT_FILES_SCHEME, serveOutputFile) - ipcMain.handle(LIST_LOCAL_CHANNEL, (_event, installationId: unknown) => - listLocalAssets(typeof installationId === 'string' ? installationId : undefined) - ) + ipcMain.handle(LIST_FOLDERS_CHANNEL, () => listOutputFolders()) + ipcMain.handle(LIST_FOLDER_CHANNEL, (_event, target: unknown) => listOutputFolder(target)) } diff --git a/src/preload/api.ts b/src/preload/api.ts index 7e726b16a..7130d7a1a 100644 --- a/src/preload/api.ts +++ b/src/preload/api.ts @@ -95,8 +95,8 @@ export function buildElectronApi(): ElectronApi { signalOverlayReady: () => ipcRenderer.send('comfy-window:overlay-ready'), navigatePanel: (page) => ipcRenderer.send('comfy-window:navigate-panel', page), listAssets: (installationId) => ipcRenderer.invoke('assets:list', installationId), - listLocalAssets: (installationId?: string) => - ipcRenderer.invoke('assets:list-local', installationId), + listOutputFolders: () => ipcRenderer.invoke('assets:output-folders'), + listOutputFolder: (folderPath) => ipcRenderer.invoke('assets:output-folder', folderPath), downloadAsset: (source, assetId, fileName) => ipcRenderer.invoke('assets:download', source, assetId, fileName), revealAsset: (source, assetId) => ipcRenderer.invoke('assets:reveal', source, assetId), diff --git a/src/renderer/src/composables/usePlatform.ts b/src/renderer/src/composables/usePlatform.ts index 36e9f4834..431682161 100644 --- a/src/renderer/src/composables/usePlatform.ts +++ b/src/renderer/src/composables/usePlatform.ts @@ -7,6 +7,17 @@ export function normalizePlatform(platform: string | undefined | null): Renderer return 'unknown' } +export function revealInFolderKey(platform: string | undefined | null): string { + switch (normalizePlatform(platform)) { + case 'mac': + return 'assets.showInFinder' + case 'windows': + return 'assets.showInExplorer' + default: + return 'assets.showInFolder' + } +} + export function revealInFolderLabel(platform: string | undefined | null): string { switch (normalizePlatform(platform)) { case 'mac': diff --git a/src/renderer/src/panel/AssetsView.test.ts b/src/renderer/src/panel/AssetsView.test.ts index f29cbd080..141d55d2a 100644 --- a/src/renderer/src/panel/AssetsView.test.ts +++ b/src/renderer/src/panel/AssetsView.test.ts @@ -8,13 +8,21 @@ import Tooltip from '../components/ui/Tooltip.vue' import { useAuthStore } from '../stores/authStore' import { useDashboardScopeStore } from '../stores/dashboardScopeStore' import { useInstallationStore } from '../stores/installationStore' -import { useSessionStore } from '../stores/sessionStore' -import type { AssetSummary, Installation, RunningInstance } from '../types/ipc' +import type { + AssetSummary, + Installation, + OutputFolder, + OutputFolderListing, + OutputSubfolder +} from '../types/ipc' const listAssets = vi.fn() -const listLocalAssets = vi.fn() +const listOutputFolders = vi.fn() +const listOutputFolder = vi.fn() const downloadAsset = vi.fn() const revealAsset = vi.fn() +const revealPath = vi.fn() +const openPath = vi.fn() const copyAsset = vi.fn() const trashAsset = vi.fn() const alert = vi.fn() @@ -27,6 +35,9 @@ const getSetting = vi.fn() const MASONRY_GAP = 14 const FOUR_COLUMN_PAGE_WIDTH = 1100 const TALL_PAGE_HEIGHT = 3000 +const OUTPUT = '/Users/me/ComfyUI-Shared/output' + +type Wrapper = Awaited> let page: HTMLElement @@ -69,23 +80,16 @@ function asset( } } -function cloudBuild(id: string, name = id): Installation { - return { id, name, sourceLabel: 'Comfy Cloud', sourceCategory: 'cloud' } +function listing(files: AssetSummary[], folders: OutputSubfolder[] = []): OutputFolderListing { + return { folders, files } } -function localBuild(id: string, name = id, extra: Partial = {}): Installation { - return { - id, - name, - sourceLabel: 'Standalone', - sourceCategory: 'local', - hasOutputFolder: true, - ...extra - } +function cloudBuild(id: string, name = id): Installation { + return { id, name, sourceLabel: 'Comfy Cloud', sourceCategory: 'cloud' } } -function oldDesktopBuild(id: string, name = id): Installation { - return localBuild(id, name, { sourceLabel: 'Desktop', hasOutputFolder: false }) +function localBuild(id: string, name = id): Installation { + return { id, name, sourceLabel: 'Standalone', sourceCategory: 'local' } } function teamBuild(build: Installation): Installation { @@ -99,37 +103,43 @@ function signedInToPersonalWithTeamDashboard(): void { ) } -async function mountAssets( - local: AssetSummary[] | Promise = [], - { - builds = [localBuild('lab')], - installationId - }: { builds?: Installation[]; installationId?: string } = {} -) { +function outputFolder(path: string, builds: string[] = []): OutputFolder { + return { path, builds, buildIds: builds.map((name) => name.toLowerCase()) } +} + +async function mountPage({ + builds = [localBuild('lab')], + folders = [outputFolder(OUTPUT, ['lab'])], + installationId +}: { builds?: Installation[]; folders?: OutputFolder[]; installationId?: string } = {}) { const installationStore = useInstallationStore() installationStore.installations = builds installationStore.loading = false - listLocalAssets.mockReturnValue(Promise.resolve(local)) + listOutputFolders.mockResolvedValue(folders) const wrapper = mount(AssetsView, { attachTo: page, props: { installationId } }) await flushPromises() return wrapper } -async function openBuildPicker(wrapper: Awaited>): Promise { - await wrapper.get('[data-testid="assets-build-picker"]').trigger('keydown', { key: 'Enter' }) - await flushPromises() +async function mountAssets(files: AssetSummary[] = [], options: { builds?: Installation[] } = {}) { + listOutputFolder.mockResolvedValue(listing(files)) + const wrapper = await mountPage(options) + await openFolder(wrapper, OUTPUT) + return wrapper } -function buildRows(): string[] { - return [ - ...document.querySelectorAll( - '[data-testid^="assets-build-"]:not([data-testid="assets-build-picker"])' - ) - ].map((row) => row.textContent?.replace(/\s+/g, ' ').trim() ?? '') +async function mountCloud(builds: Installation[] = [cloudBuild('cloud')]) { + window.localStorage.setItem('comfy.desktop.assets.place', 'cloud') + return mountPage({ builds }) +} + +async function openFolder(wrapper: Wrapper, path: string): Promise { + await wrapper.get(`[data-testid="local-folder-${path}"]`).trigger('click') + await flushPromises() } -async function pickBuild(id: string): Promise { - document.querySelector(`[data-testid="assets-build-${id}"]`)!.click() +async function choose(wrapper: Wrapper, place: 'cloud' | 'computer'): Promise { + await wrapper.get(`[data-testid="assets-place-${place}"]`).trigger('click') await flushPromises() } @@ -163,13 +173,29 @@ async function rightClick(element: Element): Promise { return event } -function assetNames(wrapper: Awaited>): string[] { +function assetNames(wrapper: Wrapper): string[] { return wrapper .get('[data-testid="assets-grid"]') .findAllComponents(Tooltip) .map((tip) => tip.props('text') as string) } +function shownText(element: Element | null | undefined): string { + return ((element as HTMLElement | null)?.innerText ?? '').replace(/\s+/g, ' ').trim() +} + +function text(wrapper: Wrapper, testId: string): string { + const element = [...wrapper.element.querySelectorAll('[data-testid]')].find( + (candidate) => candidate.getAttribute('data-testid') === testId + ) + expect(element, `${testId} is on the page`).toBeDefined() + return shownText(element) +} + +function signedInToPersonal(): void { + getAuthStatus.mockResolvedValue({ signedIn: true, workspaceId: 'me', workspaceType: 'personal' }) +} + function viewer(): HTMLElement | null { return document.querySelector('[data-testid="output-detail"]') } @@ -191,7 +217,8 @@ beforeEach(() => { document.body.append(page) vi.clearAllMocks() window.localStorage.clear() - listLocalAssets.mockResolvedValue([]) + listOutputFolders.mockResolvedValue([]) + listOutputFolder.mockResolvedValue(listing([])) listWorkspaces.mockResolvedValue([ { id: 'me', name: 'Personal Workspace', type: 'personal' }, { id: 'team-b', name: 'Team B', type: 'team' } @@ -204,9 +231,12 @@ beforeEach(() => { getSetting.mockResolvedValue(undefined) ;(window as unknown as { api: unknown }).api = { listAssets, - listLocalAssets, + listOutputFolders, + listOutputFolder, downloadAsset, revealAsset, + revealPath, + openPath, copyAsset, trashAsset, platform: 'darwin', @@ -338,128 +368,269 @@ describe('AssetsView', () => { expect(wrapper.get('[data-testid="asset-a"]').text()).not.toContain('a.svg') }) - it('shows the files of a local build without it running or a Cloud login', async () => { - const wrapper = await mountAssets([ - asset('/out/surfer.mp4', 'surfer.mp4', 'video'), - asset('/out/forest.png', 'forest.png', 'image') - ]) + it('opens on This computer with a card per output folder: its real name, a short path and the builds that save there', async () => { + const wrapper = await mountPage({ + folders: [ + outputFolder(OUTPUT, ['ComfyUI', 'Video Lab', 'Apps', 'Sketches']), + outputFolder('/Users/me/Installs/Bare/ComfyUI/output') + ] + }) - expect(listLocalAssets).toHaveBeenCalledExactlyOnceWith('lab') - expect(listAssets).not.toHaveBeenCalled() - expect(assetNames(wrapper)).toEqual(['surfer.mp4', 'forest.png']) + expect(listOutputFolders).toHaveBeenCalledOnce() + expect(listAssets, 'nothing is read from Comfy Cloud').not.toHaveBeenCalled() + expect(listOutputFolder, 'no folder is read before one is opened').not.toHaveBeenCalled() + expect(text(wrapper, `local-folder-heading-${OUTPUT}`)).toBe('ComfyUI, Video Lab +2') + expect(text(wrapper, `local-folder-${OUTPUT}`)).toBe('output /Users/…/ComfyUI-Shared') + expect( + wrapper.get(`[data-testid="local-folder-${OUTPUT}"]`).attributes('title'), + 'the full path on hover' + ).toBe(OUTPUT) + expect(text(wrapper, 'local-folder-heading-/Users/me/Installs/Bare/ComfyUI/output')).toBe( + 'No build saves here yet' + ) + expect(text(wrapper, 'local-folder-/Users/me/Installs/Bare/ComfyUI/output')).toBe( + 'output /Users/…/ComfyUI' + ) + expect( + wrapper.find('[data-testid="assets-kind-all"]').exists(), + 'the type tabs show only where they act' + ).toBe(false) + expect(wrapper.find('input').exists(), 'so does the search').toBe(false) }) - it('shows an image card from its small thumbnail', async () => { - const wrapper = await mountAssets([ - asset('/out/forest.png', 'forest.png', 'image', { - previewUrl: 'comfy-output://file/full', - thumbnailUrl: 'comfy-output://file/full?thumbnail=1' - }) + it('shortens Windows drive and network paths the same way', async () => { + const paths = ['C:\\Users\\me\\ComfyUI\\output', 'D:\\output', '\\\\nas\\share\\comfy\\output'] + const wrapper = await mountPage({ folders: paths.map((path) => outputFolder(path)) }) + + expect(paths.map((path) => text(wrapper, `local-folder-${path}`))).toEqual([ + 'output C:\\…\\ComfyUI', + 'output D:\\', + 'output \\\\nas\\share\\comfy' ]) + }) - expect(wrapper.get('img').attributes('src')).toBe('comfy-output://file/full?thumbnail=1') + it('names every build that saves to a folder when its +N button is focused', async () => { + const builds = ['Build 1', 'Build 2', 'Build 3'] + const wrapper = await mountPage({ folders: [outputFolder(OUTPUT, builds)] }) + + const more = wrapper.get(`[data-testid="local-folder-more-${OUTPUT}"]`) + expect(more.text()).toBe('+1') + await more.trigger('focusin') + await flushPromises() + + const bubble = document.querySelector('.tooltip-bubble')?.textContent ?? '' + expect(bubble).toContain('Saved here by') + expect(bubble).toContain('Build 3') }) - it("opens on the window's build, lists every build with where it runs, and switches to the one picked", async () => { - useSessionStore().runningInstances.set('lab', { installationId: 'lab' } as RunningInstance) - listAssets.mockResolvedValue([asset('c1', 'cloud.png', 'image')]) - const wrapper = await mountAssets([asset('/out/mine.png', 'mine.png', 'image')], { - builds: [ - localBuild('mine', 'My Local 1'), - localBuild('lab', 'Video Lab'), - { - ...cloudBuild('cloud', 'Comfy Cloud'), - statusTag: { style: 'update', label: 'Update available' } - } - ], - installationId: 'mine' - }) + it('says when there is no output folder yet', async () => { + const wrapper = await mountPage({ folders: [] }) - useAuthStore().status = { signedIn: true } + expect(text(wrapper, 'local-folders-empty')).toContain('No output folders yet') + }) + + it('walks into a folder and its subfolders, and back with the path', async () => { + listOutputFolder.mockImplementation(async (path: string) => + path === OUTPUT + ? listing( + [asset(`${OUTPUT}/top.png`, 'top.png', 'image')], + [{ name: 'video', path: `${OUTPUT}/video` }] + ) + : listing([asset(`${OUTPUT}/video/clip.mp4`, 'clip.mp4', 'video')]) + ) + const wrapper = await mountPage() + + await openFolder(wrapper, OUTPUT) + expect(listOutputFolder).toHaveBeenLastCalledWith(OUTPUT) + expect(shownText(wrapper.get('nav').element)).toBe('This computer output') + expect(assetNames(wrapper)).toEqual(['top.png']) + expect(wrapper.find('[data-testid="assets-kind-all"]').exists()).toBe(true) + + await wrapper.get('[data-testid="local-subfolder-video"]').trigger('click') await flushPromises() + expect(listOutputFolder).toHaveBeenLastCalledWith(`${OUTPUT}/video`) + expect(shownText(wrapper.get('nav').element)).toBe('This computer output video') + expect(assetNames(wrapper)).toEqual(['clip.mp4']) - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('My Local 1') - expect( - listLocalAssets.mock.calls.flat(), - 'only the window build is read, and logging in does not read it again' - ).toEqual(['mine']) - expect(listAssets).not.toHaveBeenCalled() - expect(assetNames(wrapper)).toEqual(['mine.png']) + await wrapper.get('[data-testid="local-crumb-1"]').trigger('click') + await flushPromises() + expect(assetNames(wrapper)).toEqual(['top.png']) - await openBuildPicker(wrapper) - expect(document.body.textContent).toContain('Browse the assets of') - expect(buildRows()).toEqual([ - 'My Local 1 Local · Stopped', - 'Video Lab Local · Running', - 'Comfy Cloud Cloud · Running' - ]) + await wrapper.get('[data-testid="local-crumb-0"]').trigger('click') + await flushPromises() + expect(wrapper.find(`[data-testid="local-folder-${OUTPUT}"]`).exists()).toBe(true) + expect(wrapper.find('[data-testid="assets-grid"]').exists()).toBe(false) + }) - await pickBuild('cloud') + it('shows no empty message in a folder that holds only subfolders', async () => { + listOutputFolder.mockResolvedValue(listing([], [{ name: 'video', path: `${OUTPUT}/video` }])) + const wrapper = await mountPage() - expect(listAssets).toHaveBeenCalledExactlyOnceWith('cloud') - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('Comfy Cloud') - expect(assetNames(wrapper), "only the picked build's files show").toEqual(['cloud.png']) + await openFolder(wrapper, OUTPUT) + + expect(wrapper.find('[data-testid="local-subfolder-video"]').exists()).toBe(true) + expect(wrapper.find('[data-testid="assets-empty"]').exists()).toBe(false) + }) + + it('says a folder has nothing to show', async () => { + const wrapper = await mountAssets([]) + + expect(text(wrapper, 'assets-empty')).toBe('No images, videos, audio or 3D files here.') }) - it('reopens on the last picked build in a window with no build of its own', async () => { - const builds = [localBuild('mine', 'My Local 1'), localBuild('lab', 'Video Lab')] - const first = await mountAssets([], { builds }) - await openBuildPicker(first) - await pickBuild('lab') + it('shows any folder or subfolder in Finder from its menu, and opens the folder it is in', async () => { + listOutputFolder.mockResolvedValue(listing([], [{ name: 'video', path: `${OUTPUT}/video` }])) + const wrapper = await mountPage() + + await wrapper + .get(`[data-testid="local-folder-menu-${OUTPUT}"]`) + .trigger('keydown', { key: 'Enter' }) + await flushPromises() + const reveal = document.querySelector('[data-testid="local-folder-reveal"]')! + expect(reveal.textContent?.trim()).toBe('Show in Finder') + reveal.click() + await flushPromises() + expect(revealPath).toHaveBeenCalledExactlyOnceWith(OUTPUT) + + await openFolder(wrapper, OUTPUT) + await wrapper + .get('[data-testid="local-subfolder-menu-video"]') + .trigger('keydown', { key: 'Enter' }) + await flushPromises() + document.querySelector('[data-testid="local-folder-reveal"]')!.click() + await flushPromises() + expect(revealPath).toHaveBeenLastCalledWith(`${OUTPUT}/video`) + + await wrapper.get('[data-testid="local-open-folder"]').trigger('click') + expect(openPath).toHaveBeenCalledExactlyOnceWith(OUTPUT) + }) + + it('says a folder could not be opened, with a way back to This computer', async () => { + listOutputFolder.mockResolvedValue(null) + const wrapper = await mountPage() + + await openFolder(wrapper, OUTPUT) + expect(wrapper.get('[data-testid="assets-empty"] h2').text()).toBe( + "Couldn't open this folder. It may have been moved or deleted." + ) + await wrapper.get('[data-testid="assets-empty-action"]').trigger('click') + await flushPromises() + + expect(wrapper.find(`[data-testid="local-folder-${OUTPUT}"]`).exists()).toBe(true) + }) + + it('says the output folders could not be read', async () => { + listOutputFolders.mockRejectedValue(new Error('disk')) + const wrapper = mount(AssetsView, { attachTo: page }) + await flushPromises() + + expect(text(wrapper, 'local-folders-empty')).toBe("Couldn't load assets") + }) + + it('remembers the place the user chose', async () => { + const first = await mountPage({ builds: [cloudBuild('cloud')] }) + await choose(first, 'cloud') first.unmount() - listLocalAssets.mockClear() - const again = await mountAssets([], { builds }) + const again = await mountPage({ builds: [cloudBuild('cloud')] }) - expect(again.get('[data-testid="assets-build-picker"]').text()).toBe('Video Lab') - expect(listLocalAssets).toHaveBeenCalledExactlyOnceWith('lab') + expect(again.get('[data-testid="assets-place-cloud"]').attributes('data-state')).toBe('on') + expect(again.find('[data-testid="local-folders"]').exists()).toBe(false) }) - it('leaves out builds from other workspaces, and servers and builds whose files Desktop cannot list', async () => { - const wrapper = await mountAssets([], { - builds: [ - localBuild('mine', 'My Local 1'), - teamBuild(localBuild('team', 'Team build')), - { id: 'remote', name: 'Office server', sourceLabel: 'Remote', sourceCategory: 'remote' }, - oldDesktopBuild('old', 'Old Desktop') - ] + it("opens a Cloud build's window on Comfy Cloud without changing the saved place", async () => { + const wrapper = await mountPage({ + builds: [localBuild('lab'), cloudBuild('cloud')], + installationId: 'cloud' }) - await openBuildPicker(wrapper) - - expect(buildRows()).toEqual(['My Local 1 Local · Stopped']) + expect(wrapper.get('[data-testid="assets-place-cloud"]').attributes('data-state')).toBe('on') + expect(listOutputFolders, 'This computer is not read').not.toHaveBeenCalled() + expect(window.localStorage.getItem('comfy.desktop.assets.place')).not.toBe('cloud') }) - it('opens on a build it can list, not on a running build that keeps its files to itself', async () => { - useSessionStore().runningInstances.set('old', { installationId: 'old' } as RunningInstance) - const wrapper = await mountAssets([asset('/out/forest.png', 'forest.png', 'image')], { - builds: [oldDesktopBuild('old', 'Old Desktop'), localBuild('lab', 'Video Lab')] + it("opens a local build's window inside that build's output folder, and keeps the saved place", async () => { + window.localStorage.setItem('comfy.desktop.assets.place', 'cloud') + listOutputFolder.mockResolvedValue(listing([asset(`${OUTPUT}/mine.png`, 'mine.png', 'image')])) + const wrapper = await mountPage({ + builds: [localBuild('lab'), localBuild('other'), cloudBuild('cloud')], + folders: [outputFolder('/Users/me/Other/output', ['other']), outputFolder(OUTPUT, ['lab'])], + installationId: 'lab' }) - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('Video Lab') - expect(listLocalAssets).toHaveBeenCalledExactlyOnceWith('lab') - expect(assetNames(wrapper)).toEqual(['forest.png']) + expect(wrapper.get('[data-testid="assets-place-computer"]').attributes('data-state')).toBe('on') + expect(listOutputFolder).toHaveBeenCalledExactlyOnceWith(OUTPUT) + expect(assetNames(wrapper)).toEqual(['mine.png']) + expect(window.localStorage.getItem('comfy.desktop.assets.place')).toBe('cloud') }) - it('waits for the builds before it reads any folder', async () => { + it('waits for the builds before it reads anything in a build window', async () => { const installationStore = useInstallationStore() - const wrapper = mount(AssetsView, { attachTo: page, props: { installationId: 'mine' } }) + mount(AssetsView, { attachTo: page, props: { installationId: 'cloud' } }) await flushPromises() - expect(listLocalAssets, 'no folder is read before the builds are known').not.toHaveBeenCalled() - expect(wrapper.find('[data-testid="assets-build-picker"]').exists()).toBe(false) + expect(listOutputFolders).not.toHaveBeenCalled() + expect(listAssets).not.toHaveBeenCalled() + + installationStore.installations = [cloudBuild('cloud')] + installationStore.loading = false + await flushPromises() + + expect(listOutputFolders, 'the Cloud build window opens on Comfy Cloud').not.toHaveBeenCalled() + }) + + it('saves the place the user picks in a build window', async () => { + const wrapper = await mountPage({ builds: [cloudBuild('cloud')], installationId: 'cloud' }) + + await choose(wrapper, 'computer') + + expect(window.localStorage.getItem('comfy.desktop.assets.place')).toBe('computer') + expect(wrapper.find(`[data-testid="local-folder-${OUTPUT}"]`).exists()).toBe(true) + }) + + it('reloads only the place the user is on when Refresh is pressed', async () => { + const wrapper = await mountPage() + + await wrapper.get('[data-testid="assets-refresh"]').trigger('click') + await flushPromises() + + expect(listOutputFolders).toHaveBeenCalledTimes(2) + expect(listOutputFolder).not.toHaveBeenCalled() + expect(listAssets).not.toHaveBeenCalled() + }) + + it('shows an image card from its small thumbnail', async () => { + const wrapper = await mountAssets([ + asset('/out/forest.png', 'forest.png', 'image', { + previewUrl: 'comfy-output://file/full', + thumbnailUrl: 'comfy-output://file/full?thumbnail=1' + }) + ]) + + expect(wrapper.get('img').attributes('src')).toBe('comfy-output://file/full?thumbnail=1') + }) + + it('waits for the builds before it lists Comfy Cloud', async () => { + window.localStorage.setItem('comfy.desktop.assets.place', 'cloud') + signedInToPersonal() + const installationStore = useInstallationStore() + const wrapper = mount(AssetsView, { attachTo: page }) + await flushPromises() + + expect(listAssets, 'Comfy Cloud is not read before the builds are known').not.toHaveBeenCalled() expect(wrapper.findAll('[data-testid="assets-skeleton"] > li')).toHaveLength(8) - installationStore.installations = [localBuild('lab'), localBuild('mine', 'My Local 1')] + listAssets.mockResolvedValue([asset('c', 'cloud.png', 'image')]) + installationStore.installations = [cloudBuild('cloud')] installationStore.loading = false await flushPromises() - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('My Local 1') - expect(listLocalAssets).toHaveBeenCalledExactlyOnceWith('mine') + expect(listAssets).toHaveBeenCalledExactlyOnceWith('cloud') }) it('keeps an empty page in place while the builds refresh', async () => { - const wrapper = await mountAssets() + const wrapper = await mountCloud() + await signInWith([]) useInstallationStore().loading = true await flushPromises() @@ -468,6 +639,49 @@ describe('AssetsView', () => { expect(wrapper.find('[data-testid="assets-skeleton"]').exists()).toBe(false) }) + it('keeps the toolbar on one row: search turns into a button, then the type tabs into a menu', async () => { + page.style.width = '1400px' + const wrapper = await mountAssets([asset('b', 'forest.png', 'image')]) + const shown = (testId: string) => wrapper.find(`[data-testid="${testId}"]`).exists() + const toolbarRow = () => wrapper.get('[data-testid="assets-toolbar"] > div').element + + await vi.waitFor(() => expect(shown('assets-kind-all')).toBe(true)) + expect(shown('assets-search-toggle')).toBe(false) + expect(shown('assets-kind-menu')).toBe(false) + + page.style.width = '700px' + await vi.waitFor(() => expect(shown('assets-kind-menu')).toBe(true)) + expect(shown('assets-kind-all')).toBe(false) + expect(shown('assets-search-toggle')).toBe(true) + expect(toolbarRow().scrollWidth).toBeLessThanOrEqual(toolbarRow().clientWidth) + + page.style.width = '1400px' + await vi.waitFor(() => expect(shown('assets-kind-all')).toBe(true)) + expect(shown('assets-search-toggle')).toBe(false) + }) + + it('keeps the compact search open while a query changes the counts', async () => { + page.style.width = '700px' + const wrapper = await mountAssets([ + asset('a', 'surfer.mp4', 'video'), + asset('b', 'forest.png', 'image') + ]) + const toggle = () => wrapper.find('[data-testid="assets-search-toggle"]') + await vi.waitFor(() => expect(toggle().exists()).toBe(true)) + await toggle().trigger('click') + const input = () => + document.querySelector('[data-testid="assets-search-compact"] input') + await vi.waitFor(() => expect(input()).not.toBeNull()) + const typedInto = input()! + + typedInto.value = 'forest' + typedInto.dispatchEvent(new Event('input')) + await flushPromises() + + expect(assetNames(wrapper)).toEqual(['forest.png']) + expect(input(), 'the same input stays on the page').toBe(typedInto) + }) + it('filters by asset type and by name', async () => { const wrapper = await mountAssets([ asset('a', 'surfer.mp4', 'video'), @@ -498,41 +712,9 @@ describe('AssetsView', () => { ]) }) - it('shows the output folder as This computer when there is no local build', async () => { - const wrapper = await mountAssets([asset('/out/forest.png', 'forest.png', 'image')], { - builds: [cloudBuild('cloud', 'Comfy Cloud')] - }) - - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('This computer') - expect( - listLocalAssets, - 'the shared output folder, not a build' - ).toHaveBeenCalledExactlyOnceWith() - expect(assetNames(wrapper)).toEqual(['forest.png']) - await openBuildPicker(wrapper) - expect(buildRows()).toEqual(['Comfy Cloud Cloud · Running', 'This computer Output folder']) - }) - - it('reopens on This computer, not the saved Comfy Cloud pick, after signing out', async () => { - const builds = [cloudBuild('cloud', 'Comfy Cloud')] - const first = await mountAssets([], { builds }) - useAuthStore().status = { signedIn: true } - await flushPromises() - await openBuildPicker(first) - await pickBuild('cloud') - first.unmount() - - useAuthStore().status = { signedIn: false } - const again = await mountAssets([asset('/out/forest.png', 'forest.png', 'image')], { builds }) - - expect(again.get('[data-testid="assets-build-picker"]').text()).toBe('This computer') - expect(assetNames(again)).toEqual(['forest.png']) - }) - - it('asks a signed-out user who picked Comfy Cloud to log in', async () => { - const wrapper = await mountAssets([], { builds: [cloudBuild('cloud')] }) - await openBuildPicker(wrapper) - await pickBuild('cloud') + it('asks a signed-out user on Comfy Cloud to log in', async () => { + const wrapper = await mountPage({ builds: [cloudBuild('cloud')] }) + await choose(wrapper, 'cloud') expect(listAssets).not.toHaveBeenCalled() expect(wrapper.get('[data-testid="assets-empty"] h2').text()).toBe('Log in to see your assets') @@ -547,9 +729,7 @@ describe('AssetsView', () => { it('ignores a cancelled log-in', async () => { signIn.mockRejectedValueOnce(new Error('cancelled')) - const wrapper = await mountAssets([], { builds: [cloudBuild('cloud')] }) - await openBuildPicker(wrapper) - await pickBuild('cloud') + const wrapper = await mountCloud() await wrapper.get('[data-testid="assets-empty-action"]').trigger('click') await flushPromises() @@ -560,7 +740,7 @@ describe('AssetsView', () => { }) it('tells a signed-in user with no assets where they come from', async () => { - const wrapper = await mountAssets() + const wrapper = await mountCloud() await signInWith([]) expect(wrapper.get('[data-testid="assets-empty"] h2').text()).toBe('No assets yet') @@ -568,8 +748,24 @@ describe('AssetsView', () => { expect(wrapper.find('[data-testid="assets-empty-action"]').exists()).toBe(false) }) + it('says the workspace has no Comfy Cloud build yet', async () => { + const wrapper = await mountCloud([localBuild('lab')]) + useAuthStore().status = { signedIn: true, workspaceId: 'me', workspaceType: 'personal' } + await flushPromises() + + expect(listAssets).not.toHaveBeenCalled() + expect(wrapper.get('[data-testid="assets-empty"] h2').text()).toBe( + 'This workspace has no Comfy Cloud build yet' + ) + expect(wrapper.get('[data-testid="assets-empty"] p').text()).toBe( + 'Add Comfy Cloud to this workspace to see its assets here.' + ) + }) + it('shows a skeleton card per slot while the first load is pending', async () => { - const wrapper = await mountAssets(new Promise(() => {})) + listOutputFolder.mockReturnValue(new Promise(() => {})) + const wrapper = await mountPage() + await openFolder(wrapper, OUTPUT) expect(wrapper.findAll('[data-testid="assets-skeleton"] > li')).toHaveLength(8) }) @@ -586,7 +782,7 @@ describe('AssetsView', () => { }) it('downloads a Cloud file through the Cloud build', async () => { - const wrapper = await mountAssets() + const wrapper = await mountCloud() await signInWith([asset('c', 'cloud.png', 'image')]) await wrapper.get('[data-testid="asset-download-c"]').trigger('click') @@ -623,14 +819,14 @@ describe('AssetsView', () => { }) }) - it('does not reload when another build changes but the picked build stays the same', async () => { + it('does not read the folder again when a build changes or the user logs in', async () => { await mountAssets([asset('a', 'forest.png', 'image')]) useInstallationStore().installations = [localBuild('lab'), localBuild('other', 'Video Lab')] - useSessionStore().runningInstances.set('lab', { installationId: 'lab' } as RunningInstance) + useAuthStore().status = { signedIn: true } await flushPromises() - expect(listLocalAssets).toHaveBeenCalledOnce() + expect(listOutputFolder).toHaveBeenCalledOnce() }) it('delays the first name tooltip, then shows the rest at once until the pointer leaves', async () => { @@ -638,60 +834,39 @@ describe('AssetsView', () => { asset('a', 'surfer.mp4', 'video'), asset('b', 'forest.png', 'image') ]) - const delays = () => wrapper.findAllComponents(Tooltip).map((tip) => tip.props('delayMs')) + const grid = wrapper.get('[data-testid="assets-grid"]') + const delays = () => grid.findAllComponents(Tooltip).map((tip) => tip.props('delayMs')) expect(delays()).toEqual([600, 600]) vi.useFakeTimers() try { - await wrapper.get('[data-testid="assets-grid"]').trigger('pointerenter') + await grid.trigger('pointerenter') await vi.advanceTimersByTimeAsync(600) expect(delays()).toEqual([0, 0]) - await wrapper.get('[data-testid="assets-grid"]').trigger('pointerleave') + await grid.trigger('pointerleave') expect(delays()).toEqual([600, 600]) } finally { vi.useRealTimers() } }) - it('stays on the build it opened on when another build starts', async () => { - const wrapper = await mountAssets([asset('a', 'forest.png', 'image')], { - builds: [ - localBuild('mine', 'My Local 1', { lastLaunchedAt: 1 }), - localBuild('lab', 'Video Lab', { lastLaunchedAt: 2 }) - ] - }) - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('Video Lab') - - useSessionStore().runningInstances.set('mine', { installationId: 'mine' } as RunningInstance) - useInstallationStore().installations = [ - localBuild('mine', 'My Local 1', { lastLaunchedAt: 3 }), - localBuild('lab', 'Video Lab', { lastLaunchedAt: 2 }) - ] - await flushPromises() - - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('Video Lab') - expect(listLocalAssets).toHaveBeenCalledExactlyOnceWith('lab') - }) - - it('switches to the builds of the workspace the user moves to', async () => { + it('lists the Cloud build of the workspace the user moves to', async () => { listAssets.mockResolvedValue([asset('t1', 'team.png', 'image')]) - const wrapper = await mountAssets([asset('a', 'forest.png', 'image')], { - builds: [localBuild('lab', 'Video Lab'), teamBuild(cloudBuild('team-cloud', 'Team Cloud'))] - }) + const wrapper = await mountCloud([ + localBuild('lab', 'Video Lab'), + teamBuild(cloudBuild('team-cloud', 'Team Cloud')) + ]) useAuthStore().status = { signedIn: true, workspaceId: 'team-b' } await flushPromises() - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('Team Cloud') expect(listAssets).toHaveBeenCalledExactlyOnceWith('team-cloud') expect(assetNames(wrapper)).toEqual(['team.png']) }) - it("moves the Cloud session to the picked Cloud build's workspace before listing its assets", async () => { - const wrapper = await mountAssets([], { - builds: [teamBuild(cloudBuild('team-cloud', 'Team Cloud'))] - }) + it("moves the Cloud session to the Cloud build's workspace before listing its assets", async () => { + const wrapper = await mountCloud([teamBuild(cloudBuild('team-cloud', 'Team Cloud'))]) useAuthStore().status = { signedIn: true, workspaceId: 'me', workspaceType: 'personal' } await flushPromises() listAssets.mockImplementation(async () => @@ -701,7 +876,6 @@ describe('AssetsView', () => { useDashboardScopeStore().selectWorkspace('team-b') await flushPromises() - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('Team Cloud') expect(switchWorkspace).toHaveBeenCalledExactlyOnceWith('team-b', 'chosen') expect(assetNames(wrapper), "the team's files, not the personal workspace's").toEqual([ 'team.png' @@ -711,13 +885,12 @@ describe('AssetsView', () => { it("says the load failed instead of showing another workspace's files when the personal workspace is unknown", async () => { listAssets.mockResolvedValue([asset('t1', 'team.png', 'image')]) listWorkspaces.mockResolvedValue([{ id: 'team-b', name: 'Team B', type: 'team' }]) - const wrapper = await mountAssets([], { builds: [cloudBuild('cloud', 'Comfy Cloud')] }) + const wrapper = await mountCloud([cloudBuild('cloud', 'Comfy Cloud')]) useAuthStore().status = { signedIn: true, workspaceId: 'team-b', workspaceType: 'team' } await flushPromises() useDashboardScopeStore().selectWorkspace('personal') await flushPromises() - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('Comfy Cloud') expect(listAssets).not.toHaveBeenCalled() expect(wrapper.get('[data-testid="assets-empty"]').text()).toContain("Couldn't load assets") }) @@ -725,7 +898,7 @@ describe('AssetsView', () => { it('does not list Cloud files with a session tied to no known workspace', async () => { listAssets.mockResolvedValue([asset('x1', 'unknown.png', 'image')]) listWorkspaces.mockResolvedValue([{ id: 'team-b', name: 'Team B', type: 'team' }]) - const wrapper = await mountAssets([], { builds: [cloudBuild('cloud', 'Comfy Cloud')] }) + const wrapper = await mountCloud([cloudBuild('cloud', 'Comfy Cloud')]) useAuthStore().status = { signedIn: true } await flushPromises() @@ -737,11 +910,8 @@ describe('AssetsView', () => { signedInToPersonalWithTeamDashboard() listAssets.mockResolvedValue([asset('t1', 'team.png', 'image')]) - const wrapper = await mountAssets([], { - builds: [teamBuild(cloudBuild('team-cloud', 'Team Cloud'))] - }) + const wrapper = await mountCloud([teamBuild(cloudBuild('team-cloud', 'Team Cloud'))]) - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('Team Cloud') expect(switchWorkspace).toHaveBeenCalledExactlyOnceWith('team-b', 'restored') expect(assetNames(wrapper)).toEqual(['team.png']) }) @@ -755,9 +925,7 @@ describe('AssetsView', () => { workspaceType: 'personal', workspaceSwitchFailure: 'retryable' }) - const wrapper = await mountAssets([], { - builds: [teamBuild(cloudBuild('team-cloud', 'Team Cloud'))] - }) + const wrapper = await mountCloud([teamBuild(cloudBuild('team-cloud', 'Team Cloud'))]) expect(listAssets, "the personal workspace's files are not listed").not.toHaveBeenCalled() expect(wrapper.get('[data-testid="assets-empty"]').text()).toContain("Couldn't load assets") @@ -772,33 +940,28 @@ describe('AssetsView', () => { expect(assetNames(wrapper)).toEqual(['team.png']) }) - it("moves the session to a Cloud build's workspace as the user's choice when they pick the build", async () => { + it("moves the session to the Cloud build's workspace as the user's choice when they pick Comfy Cloud", async () => { signedInToPersonalWithTeamDashboard() listAssets.mockResolvedValue([asset('t1', 'team.png', 'image')]) - const wrapper = await mountAssets([], { - builds: [ - teamBuild(localBuild('team-lab', 'Team Lab', { lastLaunchedAt: 5 })), - teamBuild(cloudBuild('team-cloud', 'Team Cloud')) - ] + const wrapper = await mountPage({ + builds: [teamBuild(localBuild('team-lab', 'Team Lab')), teamBuild(cloudBuild('team-cloud'))] }) - expect(wrapper.get('[data-testid="assets-build-picker"]').text()).toBe('Team Lab') - expect(switchWorkspace, 'a local build needs no workspace').not.toHaveBeenCalled() + expect(switchWorkspace, 'This computer needs no workspace').not.toHaveBeenCalled() - await openBuildPicker(wrapper) - await pickBuild('team-cloud') + await choose(wrapper, 'cloud') expect(switchWorkspace).toHaveBeenCalledExactlyOnceWith('team-b', 'chosen') expect(assetNames(wrapper)).toEqual(['team.png']) }) - it('clears the previous workspace assets while the new workspace loads', async () => { + it('clears the files of the place the user left while the next one loads', async () => { + signedInToPersonal() listAssets.mockReturnValue(new Promise(() => {})) const wrapper = await mountAssets([asset('a', 'forest.png', 'image')], { - builds: [localBuild('lab'), teamBuild(cloudBuild('team-cloud'))] + builds: [cloudBuild('cloud')] }) - useAuthStore().status = { signedIn: true, workspaceId: 'team-b' } - await flushPromises() + await choose(wrapper, 'cloud') expect(wrapper.find('[data-testid="assets-grid"]').exists()).toBe(false) expect(wrapper.find('[data-testid="assets-skeleton"]').exists()).toBe(true) @@ -812,8 +975,10 @@ describe('AssetsView', () => { expect(wrapper.get('[data-testid="assets-empty"]').text()).toContain('No matching assets') }) - it('reports a failed load', async () => { - const wrapper = await mountAssets(Promise.reject(new Error('disk'))) + it('reports a failed Cloud load', async () => { + signedInToPersonal() + listAssets.mockRejectedValue(new Error('offline')) + const wrapper = await mountCloud() expect(wrapper.get('[data-testid="assets-empty"]').text()).toContain("Couldn't load assets") }) @@ -830,7 +995,7 @@ describe('AssetsView', () => { }) it('offers only Download and Copy for a Cloud file, from the more actions button', async () => { - const wrapper = await mountAssets() + const wrapper = await mountCloud() await signInWith([picture('c', 300)]) await wrapper.get('[data-testid="asset-more-c"]').trigger('click') @@ -899,6 +1064,34 @@ describe('AssetsView', () => { expect(document.activeElement).toBe(card.element) }) + it('tells where a file on this computer is saved in the viewer, and shows it in Finder', async () => { + const wrapper = await mountAssets([asset(`${OUTPUT}/forest.png`, 'forest.png', 'image')]) + + await wrapper.get(`[data-testid="asset-open-${OUTPUT}/forest.png"]`).trigger('click') + await flushPromises() + + expect(shownText(viewer()!.querySelector('[data-testid="output-detail-saved-in"]'))).toBe( + 'SAVED IN output /Users/me/ComfyUI-Shared' + ) + const show = viewer()!.querySelector( + '[data-testid="output-detail-show-in-folder"]' + )! + expect(show.textContent?.trim()).toBe('Show in Finder') + show.click() + expect(revealAsset).toHaveBeenCalledExactlyOnceWith('local', `${OUTPUT}/forest.png`) + }) + + it('does not say where a Cloud file is saved in the viewer', async () => { + const wrapper = await mountCloud() + await signInWith([asset('c', 'cloud.png', 'image')]) + + await wrapper.get('[data-testid="asset-open-c"]').trigger('click') + await flushPromises() + + expect(viewer()!.querySelector('[data-testid="output-detail-saved-in"]')).toBeNull() + expect(viewer()!.querySelector('[data-testid="output-detail-show-in-folder"]')).toBeNull() + }) + it('steps through the files in page order with the arrow keys and the filmstrip', async () => { const wrapper = await mountAssets([ asset('new', 'new.png', 'image', { createdAt: '2026-11-03T00:00:00Z' }), diff --git a/src/renderer/src/panel/AssetsView.vue b/src/renderer/src/panel/AssetsView.vue index aa0f38239..ba14da2ef 100644 --- a/src/renderer/src/panel/AssetsView.vue +++ b/src/renderer/src/panel/AssetsView.vue @@ -1,20 +1,18 @@ + + diff --git a/src/renderer/src/panel/LocalFolders.vue b/src/renderer/src/panel/LocalFolders.vue new file mode 100644 index 000000000..ad73b9294 --- /dev/null +++ b/src/renderer/src/panel/LocalFolders.vue @@ -0,0 +1,244 @@ + + + diff --git a/src/renderer/src/panel/OutputDetailDialog.vue b/src/renderer/src/panel/OutputDetailDialog.vue index 9eee9bd55..ac20238f6 100644 --- a/src/renderer/src/panel/OutputDetailDialog.vue +++ b/src/renderer/src/panel/OutputDetailDialog.vue @@ -3,7 +3,7 @@ import { computed, nextTick, ref, useTemplateRef, watch } from 'vue' import { useI18n } from 'vue-i18n' import { useEventListener, usePreferredReducedMotion } from '@vueuse/core' import { DropdownMenuRadioGroup } from 'reka-ui' -import { AudioLines, Box, Check, ChevronDown, Download, File, X } from '@lucide/vue' +import { AudioLines, Box, Check, ChevronDown, Download, File, FolderSearch, X } from '@lucide/vue' import Button from '@comfyorg/design-system/button/Button' import Tag from '@comfyorg/design-system/chip/Tag' import AudioPreview from '@comfyorg/design-system/media/AudioPreview' @@ -13,6 +13,7 @@ import DesktopDialogSurface from '../components/ui/DesktopDialogSurface.vue' import InfoTooltip from '../components/InfoTooltip.vue' import OutputDetailThumb from './OutputDetailThumb.vue' import { formatBytes } from '../lib/downloadFormatters' +import { revealInFolderKey } from '../composables/usePlatform' import type { AssetKind } from '../types/ipc' export interface OutputDetailItem { @@ -24,6 +25,7 @@ export interface OutputDetailItem { tags: string[] previewUrl: string | null thumbnailUrl: string | null + savedIn?: string | null } type Zoom = 'fit' | 0.5 | 1 | 2 @@ -39,9 +41,11 @@ const index = defineModel('index', { required: true }) const emit = defineEmits<{ close: [] download: [index: number] + 'show-in-folder': [index: number] }>() const { t, locale } = useI18n() +const revealKey = revealInFolderKey(window.api.platform) const preferredMotion = usePreferredReducedMotion() const filmstrip = useTemplateRef('filmstrip') const natural = ref<{ width: number; height: number } | null>(null) @@ -72,6 +76,12 @@ const facts = computed(() => item.value.sizeBytes === null ? null : formatBytes(item.value.sizeBytes) ].filter((fact): fact is string => !!fact) ) +const savedFolder = computed(() => { + const folder = item.value.savedIn + if (!folder) return null + const cut = Math.max(folder.lastIndexOf('/'), folder.lastIndexOf('\\')) + return { name: folder.slice(cut + 1) || folder, parent: cut > 0 ? folder.slice(0, cut) : '' } +}) const percent = computed(() => new Intl.NumberFormat(locale.value, { style: 'percent' })) const zoomLabel = computed(() => zoom.value === 'fit' ? t('assets.detail.fit') : percent.value.format(zoom.value) @@ -269,6 +279,18 @@ useEventListener(window, 'keydown', (event: KeyboardEvent) => { +
+
+ {{ t('assets.detail.savedIn') }} +
+
+ {{ savedFolder.name }} + {{ + savedFolder.parent + }} +
+
+
+
diff --git a/src/renderer/src/preview/fakeBridge.ts b/src/renderer/src/preview/fakeBridge.ts index 21033098f..9c13a04c8 100644 --- a/src/renderer/src/preview/fakeBridge.ts +++ b/src/renderer/src/preview/fakeBridge.ts @@ -250,7 +250,8 @@ export function createFakeBridge(seed: BridgeSeed = {}): FakeBridge { signalOverlayReady: () => {}, navigatePanel: () => {}, listAssets: async () => [], - listLocalAssets: async () => [], + listOutputFolders: async () => [], + listOutputFolder: async () => null, downloadAsset: async () => true, revealAsset: async () => true, copyAsset: async () => true, diff --git a/src/renderer/src/preview/fixtures.ts b/src/renderer/src/preview/fixtures.ts index 628de722f..d1291543b 100644 --- a/src/renderer/src/preview/fixtures.ts +++ b/src/renderer/src/preview/fixtures.ts @@ -5,6 +5,7 @@ import type { FieldOption, GPUInfo, Installation, + OutputFolder, ProgressStep, Source, SystemInfo @@ -311,6 +312,16 @@ export const HOME_WORKFLOWS: CatalogWorkflow[] = [ } ] +export function outputFolders(machine: PreviewMachine): OutputFolder[] { + return [ + { + path: joinPath(machine, 'output'), + builds: ['ComfyUI', 'Video experiments'], + buildIds: ['inst-comfyui', 'inst-video-experiments'] + } + ] +} + export function localAssets(): AssetSummary[] { return ['harbor-at-dusk.png', 'paper-crane.png', 'studio-portrait.png'].map((name, index) => ({ id: `asset-${index + 1}`, diff --git a/src/renderer/src/preview/scenarios.ts b/src/renderer/src/preview/scenarios.ts index b31f40fab..3bd63e0f9 100644 --- a/src/renderer/src/preview/scenarios.ts +++ b/src/renderer/src/preview/scenarios.ts @@ -1,5 +1,11 @@ import type { BridgeSeed, FakeBridge } from './fakeBridge' -import { INSTALL_STEPS, everydayBuilds, localAssets, type PreviewMachine } from './fixtures' +import { + INSTALL_STEPS, + everydayBuilds, + localAssets, + outputFolders, + type PreviewMachine +} from './fixtures' export interface PreviewStage { bridge: FakeBridge @@ -120,7 +126,10 @@ export const SCENARIOS: PreviewScenario[] = [ ready: '[data-testid="app-sidebar-assets"][aria-current="page"]', seed: (machine) => ({ installations: everydayBuilds(machine), - replies: { listLocalAssets: async () => localAssets() } + replies: { + listOutputFolders: async () => outputFolders(machine), + listOutputFolder: async () => ({ folders: [], files: localAssets() }) + } }), arrange: async ({ click }) => { await click('[data-testid="app-sidebar-assets"]') diff --git a/src/renderer/src/types/ipc.ts b/src/renderer/src/types/ipc.ts index 351549c76..d86238ad3 100644 --- a/src/renderer/src/types/ipc.ts +++ b/src/renderer/src/types/ipc.ts @@ -5,6 +5,9 @@ export type { AppPageStatus, AssetKind, AssetSummary, + OutputFolder, + OutputFolderListing, + OutputSubfolder, CatalogWorkflow, Unsubscribe, BetaActivationNotice, diff --git a/src/types/ipc.ts b/src/types/ipc.ts index 263658151..eb9d5cc6e 100644 --- a/src/types/ipc.ts +++ b/src/types/ipc.ts @@ -121,7 +121,6 @@ export interface Installation { launchMode?: string launchArgs?: string hasConsole?: boolean - hasOutputFolder?: boolean installPath?: string status?: string lastLaunchedAt?: number @@ -175,6 +174,22 @@ export interface AssetSummary { durationSeconds: number | null } +export interface OutputFolder { + path: string + builds: string[] + buildIds: string[] +} + +export interface OutputSubfolder { + name: string + path: string +} + +export interface OutputFolderListing { + folders: OutputSubfolder[] + files: AssetSummary[] +} + export interface BuildStorageSnapshot { sharedDirectoriesFields: Record[] modelsDirs: { path: string; isPrimary: boolean }[] @@ -1161,7 +1176,8 @@ export interface ElectronApi { signalOverlayReady(): void navigatePanel(page: DashboardPage): void listAssets(installationId: string): Promise - listLocalAssets(installationId?: string): Promise + listOutputFolders(): Promise + listOutputFolder(folderPath: string): Promise downloadAsset(source: string, assetId: string, fileName: string): Promise revealAsset(source: string, assetId: string): Promise copyAsset(source: string, assetId: string): Promise