Skip to content

Commit 3728908

Browse files
[QPOv2] Add media assets viewmode toggle (#7729)
Adds a button to toggle the view mode of the media assets panel <img width="530" height="326" alt="image" src="https://github.com/user-attachments/assets/0946e87d-03b0-4606-9142-ac18aae89ecc" /> Part of the QPO v2 iteration, figma design can be found [here](https://www.figma.com/design/LVilZgHGk5RwWOkVN6yCEK/Queue-Progress-Modal?node-id=3330-37286&m=dev). This will be implemented in a series of stacked PRs that can be reviewed and merged individually. main <-- #7729, #7731, #7737, #7743, #7745 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7729-QPOv2-Add-media-assets-viewmode-toggle-2d16d73d365081e5b641efce5a5c1662) by [Unito](https://www.unito.io)
1 parent 14d0ec7 commit 3728908

File tree

8 files changed

+101
-3
lines changed

8 files changed

+101
-3
lines changed

src/components/sidebar/tabs/AssetsSidebarTab.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<MediaAssetFilterBar
4848
v-model:search-query="searchQuery"
4949
v-model:sort-by="sortBy"
50+
v-model:view-mode="viewMode"
5051
v-model:media-type-filters="mediaTypeFilters"
5152
class="pb-1 px-2 2xl:px-4"
5253
:show-generation-time-sort="activeTab === 'output'"
@@ -198,6 +199,7 @@ const activeTab = ref<'input' | 'output'>('output')
198199
const folderPromptId = ref<string | null>(null)
199200
const folderExecutionTime = ref<number | undefined>(undefined)
200201
const isInFolderView = computed(() => folderPromptId.value !== null)
202+
const viewMode = ref<'list' | 'grid'>('grid')
201203
202204
// Track which asset's context menu is open (for single-instance context menu management)
203205
const openContextMenuId = ref<string | null>(null)

src/composables/useCoreCommands.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import { useWorkflowTemplateSelectorDialog } from './useWorkflowTemplateSelector
6767
const { isActiveSubscription, showSubscriptionDialog } = useSubscription()
6868

6969
const moveSelectedNodesVersionAdded = '1.22.2'
70-
7170
export function useCoreCommands(): ComfyCommand[] {
7271
const workflowService = useWorkflowService()
7372
const workflowStore = useWorkflowStore()
@@ -79,13 +78,22 @@ export function useCoreCommands(): ComfyCommand[] {
7978
const executionStore = useExecutionStore()
8079
const telemetry = useTelemetry()
8180
const { staticUrls, buildDocsUrl } = useExternalLink()
81+
const settingStore = useSettingStore()
8282

8383
const bottomPanelStore = useBottomPanelStore()
8484

8585
const { getSelectedNodes, toggleSelectedNodesMode } =
8686
useSelectedLiteGraphItems()
8787
const getTracker = () => workflowStore.activeWorkflow?.changeTracker
8888

89+
function isQueuePanelV2Enabled() {
90+
return settingStore.get('Comfy.Queue.QPOV2')
91+
}
92+
93+
async function toggleQueuePanelV2() {
94+
await settingStore.set('Comfy.Queue.QPOV2', !isQueuePanelV2Enabled())
95+
}
96+
8997
const moveSelectedNodes = (
9098
positionUpdater: (pos: Point, gridSize: number) => Point
9199
) => {
@@ -1191,6 +1199,12 @@ export function useCoreCommands(): ComfyCommand[] {
11911199
await useWorkflowService().reloadCurrentWorkflow() // ensure changes take effect immediately
11921200
}
11931201
},
1202+
{
1203+
id: 'Comfy.ToggleQPOV2',
1204+
icon: 'pi pi-list',
1205+
label: 'Toggle Queue Panel V2',
1206+
function: toggleQueuePanelV2
1207+
},
11941208
{
11951209
id: 'Comfy.ToggleLinear',
11961210
icon: 'pi pi-database',

src/locales/en/commands.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@
263263
"Comfy_ToggleLinear": {
264264
"label": "toggle linear mode"
265265
},
266+
"Comfy_ToggleQPOV2": {
267+
"label": "Toggle Queue Panel V2"
268+
},
266269
"Comfy_ToggleTheme": {
267270
"label": "Toggle Theme (Dark/Light)"
268271
},
@@ -327,4 +330,4 @@
327330
"label": "Toggle Workflows Sidebar",
328331
"tooltip": "Workflows"
329332
}
330-
}
333+
}

src/locales/en/main.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,8 @@
721721
"colonPercent": ": {percent}",
722722
"currentNode": "Current node:",
723723
"viewAllJobs": "View all jobs",
724+
"viewList": "List view",
725+
"viewGrid": "Grid view",
724726
"running": "running",
725727
"preview": "Preview",
726728
"interruptAll": "Interrupt all running jobs",
@@ -2468,4 +2470,4 @@
24682470
"recentReleases": "Recent releases",
24692471
"helpCenterMenu": "Help Center Menu"
24702472
}
2471-
}
2473+
}

src/platform/assets/components/MediaAssetFilterBar.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,26 @@
3131
/>
3232
</template>
3333
</AssetSortButton>
34+
<MediaAssetViewModeToggle
35+
v-if="isQueuePanelV2Enabled"
36+
v-model:view-mode="viewMode"
37+
/>
3438
</div>
3539
</template>
3640

3741
<script setup lang="ts">
42+
import { computed } from 'vue'
43+
3844
import SearchBox from '@/components/common/SearchBox.vue'
3945
import { isCloud } from '@/platform/distribution/types'
46+
import { useSettingStore } from '@/platform/settings/settingStore'
4047
4148
import MediaAssetFilterButton from './MediaAssetFilterButton.vue'
4249
import MediaAssetFilterMenu from './MediaAssetFilterMenu.vue'
4350
import AssetSortButton from './MediaAssetSortButton.vue'
4451
import MediaAssetSortMenu from './MediaAssetSortMenu.vue'
4552
import type { SortBy } from './MediaAssetSortMenu.vue'
53+
import MediaAssetViewModeToggle from './MediaAssetViewModeToggle.vue'
4654
4755
const { showGenerationTimeSort = false } = defineProps<{
4856
searchQuery: string
@@ -56,6 +64,12 @@ const emit = defineEmits<{
5664
}>()
5765
5866
const sortBy = defineModel<SortBy>('sortBy', { required: true })
67+
const viewMode = defineModel<'list' | 'grid'>('viewMode', { required: true })
68+
69+
const settingStore = useSettingStore()
70+
const isQueuePanelV2Enabled = computed(() =>
71+
settingStore.get('Comfy.Queue.QPOV2')
72+
)
5973
6074
const handleSearchChange = (value: string | undefined) => {
6175
emit('update:searchQuery', value ?? '')
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<template>
2+
<div
3+
class="inline-flex items-center gap-1 rounded-lg bg-secondary-background p-1"
4+
role="group"
5+
>
6+
<Button
7+
type="button"
8+
variant="muted-textonly"
9+
size="icon"
10+
:aria-label="t('sideToolbar.queueProgressOverlay.viewList')"
11+
:aria-pressed="viewMode === 'list'"
12+
:class="
13+
cn(
14+
'rounded-lg',
15+
viewMode === 'list'
16+
? 'bg-secondary-background-selected text-text-primary hover:bg-secondary-background-selected'
17+
: 'text-text-secondary hover:bg-secondary-background-hover'
18+
)
19+
"
20+
@click="viewMode = 'list'"
21+
>
22+
<i class="icon-[lucide--table-of-contents] size-4" />
23+
</Button>
24+
<Button
25+
type="button"
26+
variant="muted-textonly"
27+
size="icon"
28+
:aria-label="t('sideToolbar.queueProgressOverlay.viewGrid')"
29+
:aria-pressed="viewMode === 'grid'"
30+
:class="
31+
cn(
32+
'rounded-lg',
33+
viewMode === 'grid'
34+
? 'bg-secondary-background-selected text-text-primary hover:bg-secondary-background-selected'
35+
: 'text-text-secondary hover:bg-secondary-background-hover'
36+
)
37+
"
38+
@click="viewMode = 'grid'"
39+
>
40+
<i class="icon-[lucide--layout-grid] size-4" />
41+
</Button>
42+
</div>
43+
</template>
44+
45+
<script setup lang="ts">
46+
import { useI18n } from 'vue-i18n'
47+
48+
import Button from '@/components/ui/button/Button.vue'
49+
import { cn } from '@/utils/tailwindUtil'
50+
51+
const viewMode = defineModel<'list' | 'grid'>('viewMode', { required: true })
52+
53+
const { t } = useI18n()
54+
</script>

src/platform/settings/constants/coreSettings.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,5 +1139,13 @@ export const CORE_SETTINGS: SettingParams[] = [
11391139
type: 'hidden',
11401140
defaultValue: false,
11411141
versionAdded: '1.34.1'
1142+
},
1143+
{
1144+
id: 'Comfy.Queue.QPOV2',
1145+
name: 'Queue Panel V2',
1146+
type: 'hidden',
1147+
tooltip: 'Enable the new Assets Panel design with list/grid view toggle',
1148+
defaultValue: false,
1149+
experimental: true
11421150
}
11431151
]

src/schemas/apiSchema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ const zSettings = z.object({
503503
'Comfy.VueNodes.Enabled': z.boolean(),
504504
'Comfy.VueNodes.AutoScaleLayout': z.boolean(),
505505
'Comfy.Assets.UseAssetAPI': z.boolean(),
506+
'Comfy.Queue.QPOV2': z.boolean(),
506507
'Comfy-Desktop.AutoUpdate': z.boolean(),
507508
'Comfy-Desktop.SendStatistics': z.boolean(),
508509
'Comfy-Desktop.WindowStyle': z.string(),

0 commit comments

Comments
 (0)