Skip to content
Closed
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
2 changes: 1 addition & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"computer": "这台电脑"
},
"showInFolder": "在文件夹中显示",
"viewInAssets": "在资产中查看",
"seeAllAssets": "查看全部资产",
"local": {
"folderActions": "文件夹操作",
"howFoldersWork": "文件夹说明",
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/src/panel/AppsView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })

Expand All @@ -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)
})

Expand Down
9 changes: 4 additions & 5 deletions src/renderer/src/panel/AppsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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(() => {
Expand All @@ -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"
/>
<div
class="flex min-h-0 w-full flex-auto flex-col overflow-y-auto"
Expand Down
62 changes: 10 additions & 52 deletions src/renderer/src/panel/AssetsView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async function mountAssets(
running?: Installation[]
signedIn?: boolean
attachTo?: HTMLElement
props?: { focusName?: string }
props?: { startOnCloud?: boolean }
} = {}
) {
const { running = [], signedIn = true, attachTo, props } = options
Expand Down Expand Up @@ -487,64 +487,22 @@ describe('AssetsView', () => {
})
})

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<AssetSummary[]>((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')
})
})

Expand Down
40 changes: 2 additions & 38 deletions src/renderer/src/panel/AssetsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,15 @@ 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()
const authStore = useAuthStore()
const installationStore = useInstallationStore()

const savedPlace = useLocalStorage<Place>('comfy.desktop.assets.place', 'cloud')
const place = ref<Place>(focusName ? 'cloud' : savedPlace.value)
const place = ref<Place>(startOnCloud ? 'cloud' : savedPlace.value)
const localFolder = ref<string | null>(null)
const localFolders = useTemplateRef<InstanceType<typeof LocalFolders>>('localFolders')
const kindFilter = ref<KindFilter>('all')
Expand All @@ -72,7 +71,6 @@ const { y: scrollTop } = useScroll(scroller)
const nameTooltipsWarm = ref(false)
let warmTimer: ReturnType<typeof setTimeout> | undefined
const loading = ref(false)
const cloudLoaded = ref(false)
const failed = ref(false)

const cloudBuildId = computed(() =>
Expand Down Expand Up @@ -169,17 +167,14 @@ async function loadAssets(): Promise<void> {
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
Expand All @@ -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<GalleryAsset | null>(
(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
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/src/panel/OutputDetailDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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')"
>
<Images :size="15" aria-hidden="true" />
{{ t('assets.viewInAssets') }}
{{ t('assets.seeAllAssets') }}
</Button>
<Button
v-if="item.workflow"
Expand Down
8 changes: 3 additions & 5 deletions src/renderer/src/panel/PanelApp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ describe('PanelApp', () => {
expect(wrapper.get('[data-testid="app-card-studio"]').isVisible()).toBe(true)
})

it('moves to Assets with the Cloud file open when an app result asks for it', async () => {
it('moves to Assets on Comfy Cloud when an app result asks for all assets', async () => {
window.history.replaceState({}, '', '/?panel=chooser&firstUseCompleted=true')
Object.assign(window.api, {
listCatalogApps: vi.fn().mockResolvedValue([]),
Expand All @@ -1334,16 +1334,14 @@ describe('PanelApp', () => {
await wrapper.get('[data-testid="app-sidebar-apps"]').trigger('click')
await flushPromises()

wrapper.getComponent({ name: 'AppsView' }).vm.$emit('view-in-assets', 'cutout.png')
wrapper.getComponent({ name: 'AppsView' }).vm.$emit('see-all-assets')
await flushPromises()

expect(wrapper.find('[data-testid="assets-view"]').exists()).toBe(true)
expect(wrapper.getComponent({ name: 'AssetsView' }).emitted('focus-used')).toHaveLength(1)
expect(wrapper.getComponent({ name: 'AssetsView' }).props('startOnCloud')).toBe(true)
expect(wrapper.get('[data-testid="app-sidebar-assets"]').attributes('aria-current')).toBe(
'page'
)

expect(wrapper.getComponent({ name: 'AssetsView' }).props('focusName')).toBeNull()
})

it('unfolds the sidebar when another page is picked while an app is open', async () => {
Expand Down
13 changes: 6 additions & 7 deletions src/renderer/src/panel/PanelApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const dashboardHomePage = ref<DashboardHomePage>('home')
const appsVisit = ref(0)
const appsAppOpen = ref(false)
const appsAppEntered = ref(false)
const assetsFocusName = ref<string | null>(null)
const assetsStartOnCloud = ref(false)
const sidebarCollapsed = useLocalStorage(SIDEBAR_COLLAPSED_KEY, false)
const appsGrowBy = computed(() => (sidebarCollapsed.value ? 0 : SIDEBAR_WIDTH - SIDEBAR_RAIL_WIDTH))

Expand All @@ -195,13 +195,13 @@ function closeBuildDetails(): void {

watch(activePanel, closeBuildDetails)

function viewInAssets(name: string): void {
function seeAllAssets(): void {
handleSidebarNavigate('assets')
assetsFocusName.value = name
assetsStartOnCloud.value = true
}

function handleSidebarNavigate(page: DashboardPage): void {
assetsFocusName.value = null
assetsStartOnCloud.value = false
if (page === 'apps' && appsAppOpen.value) appsVisit.value++
appsAppOpen.value = false
appsAppEntered.value = false
Expand Down Expand Up @@ -496,12 +496,11 @@ onUnmounted(() => {
:obscured="currentOverlay?.kind === 'takeover'"
@app-open="appsAppOpen = $event"
@app-entered="appsAppEntered = $event"
@view-in-assets="viewInAssets"
@see-all-assets="seeAllAssets"
/>
<AssetsView
v-else-if="dashboardHomePage === 'assets'"
:focus-name="assetsFocusName"
@focus-used="assetsFocusName = null"
:start-on-cloud="assetsStartOnCloud"
/>
<BuildDetailsView
v-else-if="buildDetailsInstall"
Expand Down
Loading