Skip to content
Merged
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: 2 additions & 0 deletions src/components/sidebar/tabs/AssetsSidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<MediaAssetFilterBar
v-model:search-query="searchQuery"
v-model:sort-by="sortBy"
v-model:view-mode="viewMode"
v-model:media-type-filters="mediaTypeFilters"
class="pb-1 px-2 2xl:px-4"
:show-generation-time-sort="activeTab === 'output'"
Expand Down Expand Up @@ -198,6 +199,7 @@ const activeTab = ref<'input' | 'output'>('output')
const folderPromptId = ref<string | null>(null)
const folderExecutionTime = ref<number | undefined>(undefined)
const isInFolderView = computed(() => folderPromptId.value !== null)
const viewMode = ref<'list' | 'grid'>('grid')
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The viewMode state variable is defined but not actually used to control the view display. The VirtualGrid at line 75 always displays in grid mode with a fixed grid layout. Consider either:

  1. Using the viewMode value to conditionally switch between a grid layout and a list layout in the VirtualGrid's grid-style prop
  2. Replacing VirtualGrid with different components based on the viewMode value

This means the toggle button will change the state but won't affect what users see.

Copilot uses AI. Check for mistakes.

// Track which asset's context menu is open (for single-instance context menu management)
const openContextMenuId = ref<string | null>(null)
Expand Down
16 changes: 15 additions & 1 deletion src/composables/useCoreCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import { useWorkflowTemplateSelectorDialog } from './useWorkflowTemplateSelector
const { isActiveSubscription, showSubscriptionDialog } = useSubscription()

const moveSelectedNodesVersionAdded = '1.22.2'

export function useCoreCommands(): ComfyCommand[] {
const workflowService = useWorkflowService()
const workflowStore = useWorkflowStore()
Expand All @@ -75,13 +74,22 @@ export function useCoreCommands(): ComfyCommand[] {
const executionStore = useExecutionStore()
const telemetry = useTelemetry()
const { staticUrls, buildDocsUrl } = useExternalLink()
const settingStore = useSettingStore()

const bottomPanelStore = useBottomPanelStore()

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

function isQueuePanelV2Enabled() {
return settingStore.get('Comfy.Queue.QPOV2')
}

async function toggleQueuePanelV2() {
await settingStore.set('Comfy.Queue.QPOV2', !isQueuePanelV2Enabled())
}

const moveSelectedNodes = (
positionUpdater: (pos: Point, gridSize: number) => Point
) => {
Expand Down Expand Up @@ -1175,6 +1183,12 @@ export function useCoreCommands(): ComfyCommand[] {
await useWorkflowService().reloadCurrentWorkflow() // ensure changes take effect immediately
}
},
{
id: 'Comfy.ToggleQPOV2',
icon: 'pi pi-list',
label: 'Toggle Queue Panel V2',
function: toggleQueuePanelV2
},
Comment on lines +1186 to +1191
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider adding versionAdded for consistency.

Other commands in this file include a versionAdded property to track when they were introduced. This helps with documentation and debugging.

🔎 Suggested change
     {
       id: 'Comfy.ToggleQPOV2',
       icon: 'pi pi-list',
       label: 'Toggle Queue Panel V2',
-      function: toggleQueuePanelV2
+      function: toggleQueuePanelV2,
+      versionAdded: '1.XX.X'
     },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
id: 'Comfy.ToggleQPOV2',
icon: 'pi pi-list',
label: 'Toggle Queue Panel V2',
function: toggleQueuePanelV2
},
{
id: 'Comfy.ToggleQPOV2',
icon: 'pi pi-list',
label: 'Toggle Queue Panel V2',
function: toggleQueuePanelV2,
versionAdded: '1.XX.X'
},
🤖 Prompt for AI Agents
In src/composables/useCoreCommands.ts around lines 1186 to 1191, the command
object for 'Comfy.ToggleQPOV2' is missing the versionAdded property used
elsewhere; add a versionAdded (e.g., versionAdded: 'vX.Y.Z' or the appropriate
version string) to that object to maintain consistency with other command
entries and ensure documentation/debugging tooling can pick it up.

{
id: 'Comfy.ToggleLinear',
icon: 'pi pi-database',
Expand Down
5 changes: 4 additions & 1 deletion src/locales/en/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@
"Comfy_ToggleLinear": {
"label": "toggle linear mode"
},
"Comfy_ToggleQPOV2": {
"label": "Toggle Queue Panel V2"
},
"Comfy_ToggleTheme": {
"label": "Toggle Theme (Dark/Light)"
},
Expand Down Expand Up @@ -324,4 +327,4 @@
"label": "Toggle Workflows Sidebar",
"tooltip": "Workflows"
}
}
}
4 changes: 3 additions & 1 deletion src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,8 @@
"colonPercent": ": {percent}",
"currentNode": "Current node:",
"viewAllJobs": "View all jobs",
"viewList": "List view",
"viewGrid": "Grid view",
"running": "running",
"preview": "Preview",
"interruptAll": "Interrupt all running jobs",
Expand Down Expand Up @@ -2449,4 +2451,4 @@
"recentReleases": "Recent releases",
"helpCenterMenu": "Help Center Menu"
}
}
}
14 changes: 14 additions & 0 deletions src/platform/assets/components/MediaAssetFilterBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,26 @@
/>
</template>
</AssetSortButton>
<MediaAssetViewModeToggle
v-if="isQueuePanelV2Enabled"
v-model:view-mode="viewMode"
/>
</div>
</template>

<script setup lang="ts">
import { computed } from 'vue'

import SearchBox from '@/components/common/SearchBox.vue'
import { isCloud } from '@/platform/distribution/types'
import { useSettingStore } from '@/platform/settings/settingStore'

import MediaAssetFilterButton from './MediaAssetFilterButton.vue'
import MediaAssetFilterMenu from './MediaAssetFilterMenu.vue'
import AssetSortButton from './MediaAssetSortButton.vue'
import MediaAssetSortMenu from './MediaAssetSortMenu.vue'
import type { SortBy } from './MediaAssetSortMenu.vue'
import MediaAssetViewModeToggle from './MediaAssetViewModeToggle.vue'

const { showGenerationTimeSort = false } = defineProps<{
searchQuery: string
Expand All @@ -56,6 +64,12 @@ const emit = defineEmits<{
}>()

const sortBy = defineModel<SortBy>('sortBy', { required: true })
const viewMode = defineModel<'list' | 'grid'>('viewMode', { required: true })

const settingStore = useSettingStore()
const isQueuePanelV2Enabled = computed(() =>
settingStore.get('Comfy.Queue.QPOV2')
)
Comment on lines +67 to +72
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider making viewMode optional when QPOV2 is disabled.

The viewMode model is marked as required: true, but the toggle is only rendered when isQueuePanelV2Enabled is true. This means parent components must always provide a viewMode value even when the feature is disabled.

This works correctly but consider if making it optional would reduce unnecessary bindings in parent components when the feature is off.

-const viewMode = defineModel<'list' | 'grid'>('viewMode', { required: true })
+const viewMode = defineModel<'list' | 'grid'>('viewMode', { default: 'grid' })

Alternatively, the current design is acceptable if you want to ensure consistent state management regardless of feature flag status.

🤖 Prompt for AI Agents
In src/platform/assets/components/MediaAssetFilterBar.vue around lines 67–72,
the viewMode model is always defined with required: true even though the UI
toggle is only shown when isQueuePanelV2Enabled is true; change the
implementation so viewMode is optional when the feature flag is off — either
move/evaluate the feature flag before calling defineModel and pass required:
isQueuePanelV2Enabled (so the prop is only required when the flag is true), or
keep required: false and add null/undefined handling where viewMode is used;
update related consumers/prop checks accordingly.


const handleSearchChange = (value: string | undefined) => {
emit('update:searchQuery', value ?? '')
Expand Down
54 changes: 54 additions & 0 deletions src/platform/assets/components/MediaAssetViewModeToggle.vue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you have to override a lot of the button styles here.
It's also another single use component, which we're trying to move away from.
I think @csongorczezar was also trying to bring this in, but it seems like it'd be the right option here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct, this is the PR addressing what @DrJKL was referring to: #7767

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these are blocking issues so I will merge.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai can you add an issue to refactor this for later?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Create a GitHub issue to track refactoring of MediaAssetViewModeToggle component

gh issue create \
  --title "Refactor MediaAssetViewModeToggle to use toggle-group component" \
  --body "## Context

The \`MediaAssetViewModeToggle\` component in \`src/platform/assets/components/MediaAssetViewModeToggle.vue\` was added in PR #7729. During review, it was noted that:

- The component overrides many button styles
- It's a single-use component, which we're trying to move away from

## Proposed Solution

Refactor this component to use the toggle-group component being introduced in PR #7767, which is based on [shadcn-vue's toggle-group](https://www.shadcn-vue.com/docs/components/toggle-group#single).

## References

- Original PR: #7729
- Comment thread: https://github.com/Comfy-Org/ComfyUI_frontend/pull/7729#discussion_r2663151326
- Toggle-group PR: #7767
- Requested by: @benceruleanlu" \
  --assignee benceruleanlu

Length of output: 57


@benceruleanlu, I've created issue #7863 to track the refactoring of MediaAssetViewModeToggle to use the toggle-group component from PR #7767. The issue has been assigned to you and includes references to this PR and the relevant discussion.


🧠 Learnings used
Learnt from: CR
Repo: Comfy-Org/ComfyUI_frontend PR: 0
File: src/components/CLAUDE.md:0-0
Timestamp: 2025-11-24T19:47:45.616Z
Learning: Applies to src/components/**/*.vue : Replace PrimeVue InputSwitch component with ToggleSwitch

Learnt from: christian-byrne
Repo: Comfy-Org/ComfyUI_frontend PR: 6300
File: src/platform/updates/components/WhatsNewPopup.vue:5-13
Timestamp: 2025-12-09T03:50:03.127Z
Learning: In the Comfy-Org/ComfyUI_frontend repository, when avoiding PrimeVue components, prefer using the repo's common button components from src/components/button/ (IconButton.vue, TextButton.vue, IconTextButton.vue) rather than plain HTML buttons. These components wrap PrimeVue with custom design system styling.

Learnt from: DrJKL
Repo: Comfy-Org/ComfyUI_frontend PR: 7649
File: src/platform/cloud/subscription/components/PricingTable.vue:185-201
Timestamp: 2025-12-22T21:36:16.031Z
Learning: In the Comfy-Org/ComfyUI_frontend repository, avoid creating single-use variants for the Button component (and other UI components). Variants should be reusable across multiple use cases. It's acceptable to use a mix of variant props and manual Tailwind classes temporarily when a specific styling need exists in only one place, with consolidation deferred to a later phase when patterns emerge.

Learnt from: benceruleanlu
Repo: Comfy-Org/ComfyUI_frontend PR: 7297
File: src/components/actionbar/ComfyActionbar.vue:33-43
Timestamp: 2025-12-09T21:40:19.792Z
Learning: In the Comfy-Org/ComfyUI_frontend repository, inline Tailwind CSS class strings, even when long, are acceptable and preferred over extracting them to computed properties when the classes are static. This is a common Tailwind pattern and doesn't need to be flagged as a readability issue.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<template>
<div
class="inline-flex items-center gap-1 rounded-lg bg-secondary-background p-1"
role="group"
>
Comment on lines +2 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add accessible label to the toggle group.

The role="group" wrapper should include an aria-label to describe the purpose of this group of controls for screen reader users.

🔎 Suggested fix
  <div
    class="inline-flex items-center gap-1 rounded-lg bg-secondary-background p-1"
    role="group"
+   :aria-label="t('sideToolbar.queueProgressOverlay.viewMode')"
  >

Note: You'll need to add the corresponding key to src/locales/en/main.json:

"viewMode": "View mode"

Based on learnings, in this repository, buttons with visible labels don't need aria-label, but this group wrapper needs a label to convey the purpose of the grouped controls to assistive technology users.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div
class="inline-flex items-center gap-1 rounded-lg bg-secondary-background p-1"
role="group"
>
<div
class="inline-flex items-center gap-1 rounded-lg bg-secondary-background p-1"
role="group"
:aria-label="t('sideToolbar.queueProgressOverlay.viewMode')"
>
🤖 Prompt for AI Agents
In src/platform/assets/components/MediaAssetViewModeToggle.vue around lines 2-5,
the wrapper div with role="group" lacks an accessible label; add an aria-label
that uses the existing i18n key for the view mode (e.g., $t('main.viewMode'))
and update src/locales/en/main.json to include "viewMode": "View mode" so screen
readers can describe the purpose of the control group.

<Button
type="button"
variant="muted-textonly"
size="icon"
:aria-label="t('sideToolbar.queueProgressOverlay.viewList')"
:aria-pressed="viewMode === 'list'"
:class="
cn(
'rounded-lg',
viewMode === 'list'
? 'bg-secondary-background-selected text-text-primary hover:bg-secondary-background-selected'
: 'text-text-secondary hover:bg-secondary-background-hover'
)
"
@click="viewMode = 'list'"
>
<i class="icon-[lucide--table-of-contents] size-4" />
</Button>
<Button
type="button"
variant="muted-textonly"
size="icon"
:aria-label="t('sideToolbar.queueProgressOverlay.viewGrid')"
:aria-pressed="viewMode === 'grid'"
:class="
cn(
'rounded-lg',
viewMode === 'grid'
? 'bg-secondary-background-selected text-text-primary hover:bg-secondary-background-selected'
: 'text-text-secondary hover:bg-secondary-background-hover'
)
"
@click="viewMode = 'grid'"
>
<i class="icon-[lucide--layout-grid] size-4" />
</Button>
</div>
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n'

import Button from '@/components/ui/button/Button.vue'
import { cn } from '@/utils/tailwindUtil'

const viewMode = defineModel<'list' | 'grid'>('viewMode', { required: true })

const { t } = useI18n()
</script>
8 changes: 8 additions & 0 deletions src/platform/settings/constants/coreSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1139,5 +1139,13 @@ export const CORE_SETTINGS: SettingParams[] = [
type: 'hidden',
defaultValue: false,
versionAdded: '1.34.1'
},
{
id: 'Comfy.Queue.QPOV2',
name: 'Queue Panel V2',
type: 'hidden',
tooltip: 'Enable the new Assets Panel design with list/grid view toggle',
defaultValue: false,
experimental: true
Comment on lines +1143 to +1149
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider adding versionAdded for consistency.

Other recently added settings in this file include a versionAdded property (e.g., Comfy.VersionCompatibility.DisableWarnings at line 1141 has versionAdded: '1.34.1'). Adding this property helps track when features were introduced.

🔎 Suggested change
   {
     id: 'Comfy.Queue.QPOV2',
     name: 'Queue Panel V2',
     type: 'hidden',
     tooltip: 'Enable the new Assets Panel design with list/grid view toggle',
     defaultValue: false,
-    experimental: true
+    experimental: true,
+    versionAdded: '1.XX.X'
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
id: 'Comfy.Queue.QPOV2',
name: 'Queue Panel V2',
type: 'hidden',
tooltip: 'Enable the new Assets Panel design with list/grid view toggle',
defaultValue: false,
experimental: true
{
id: 'Comfy.Queue.QPOV2',
name: 'Queue Panel V2',
type: 'hidden',
tooltip: 'Enable the new Assets Panel design with list/grid view toggle',
defaultValue: false,
experimental: true,
versionAdded: '1.XX.X'
}
🤖 Prompt for AI Agents
In src/platform/settings/constants/coreSettings.ts around lines 1143 to 1149,
the new Comfy.Queue.QPOV2 setting is missing a versionAdded property for
consistency with other recently added settings; add a versionAdded field (e.g.,
versionAdded: '1.34.1') to the setting object, placing it alongside
experimental/defaultValue entries to indicate when this feature was introduced.

}
]
1 change: 1 addition & 0 deletions src/schemas/apiSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ const zSettings = z.object({
'Comfy.VueNodes.Enabled': z.boolean(),
'Comfy.VueNodes.AutoScaleLayout': z.boolean(),
'Comfy.Assets.UseAssetAPI': z.boolean(),
'Comfy.Queue.QPOV2': z.boolean(),
'Comfy-Desktop.AutoUpdate': z.boolean(),
'Comfy-Desktop.SendStatistics': z.boolean(),
'Comfy-Desktop.WindowStyle': z.string(),
Expand Down
Loading