Skip to content

Commit 0502889

Browse files
feat: add Comfy.Queue.ToggleOverlay command for job history panel (#7805)
## Summary Move queue overlay expanded state from local ref to useQueueUIStore, enabling command-based control similar to minimap toggle. fix #7803 ## Screenshots https://github.com/user-attachments/assets/d79927ea-0b7e-44c5-bfaf-2f50dcc012ab ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7805-feat-add-Comfy-Queue-ToggleOverlay-command-for-job-history-panel-2d96d73d365081018916ef490d57ce92) by [Unito](https://www.unito.io) --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 87f560c commit 0502889

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

src/components/TopMenuSection.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ import { useCurrentUser } from '@/composables/auth/useCurrentUser'
9292
import { useErrorHandling } from '@/composables/useErrorHandling'
9393
import { buildTooltipConfig } from '@/composables/useTooltipConfig'
9494
import { app } from '@/scripts/app'
95-
import { useQueueStore } from '@/stores/queueStore'
95+
import { useCommandStore } from '@/stores/commandStore'
96+
import { useQueueStore, useQueueUIStore } from '@/stores/queueStore'
9697
import { useRightSidePanelStore } from '@/stores/workspace/rightSidePanelStore'
9798
import { useWorkspaceStore } from '@/stores/workspaceStore'
9899
import { isElectron } from '@/utils/envUtil'
@@ -106,8 +107,10 @@ const { isLoggedIn } = useCurrentUser()
106107
const isDesktop = isElectron()
107108
const { t } = useI18n()
108109
const { toastErrorHandler } = useErrorHandling()
109-
const isQueueOverlayExpanded = ref(false)
110+
const commandStore = useCommandStore()
110111
const queueStore = useQueueStore()
112+
const queueUIStore = useQueueUIStore()
113+
const { isOverlayExpanded: isQueueOverlayExpanded } = storeToRefs(queueUIStore)
111114
const isTopMenuHovered = ref(false)
112115
const queuedCount = computed(() => queueStore.pendingTasks.length)
113116
const queueHistoryTooltipConfig = computed(() =>
@@ -133,7 +136,7 @@ onMounted(() => {
133136
})
134137
135138
const toggleQueueOverlay = () => {
136-
isQueueOverlayExpanded.value = !isQueueOverlayExpanded.value
139+
commandStore.execute('Comfy.Queue.ToggleOverlay')
137140
}
138141
139142
const openCustomNodeManager = async () => {

src/composables/useCoreCommands.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ import { useLitegraphService } from '@/services/litegraphService'
3939
import type { ComfyCommand } from '@/stores/commandStore'
4040
import { useExecutionStore } from '@/stores/executionStore'
4141
import { useHelpCenterStore } from '@/stores/helpCenterStore'
42-
import { useQueueSettingsStore, useQueueStore } from '@/stores/queueStore'
42+
import {
43+
useQueueSettingsStore,
44+
useQueueStore,
45+
useQueueUIStore
46+
} from '@/stores/queueStore'
4347
import { useSubgraphNavigationStore } from '@/stores/subgraphNavigationStore'
4448
import { useSubgraphStore } from '@/stores/subgraphStore'
4549
import { useBottomPanelStore } from '@/stores/workspace/bottomPanelStore'
@@ -423,6 +427,18 @@ export function useCoreCommands(): ComfyCommand[] {
423427
},
424428
active: () => useSettingStore().get('Comfy.Minimap.Visible')
425429
},
430+
{
431+
id: 'Comfy.Queue.ToggleOverlay',
432+
icon: 'pi pi-history',
433+
label: () => t('queue.toggleJobHistory'),
434+
menubarLabel: () => t('queue.jobHistory'),
435+
versionAdded: '1.37.0',
436+
category: 'view-controls' as const,
437+
function: () => {
438+
useQueueUIStore().toggleOverlay()
439+
},
440+
active: () => useQueueUIStore().isOverlayExpanded
441+
},
426442
{
427443
id: 'Comfy.QueuePrompt',
428444
icon: 'pi pi-play',

src/locales/en/main.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,8 @@
10371037
"copyErrorMessage": "Copy error message",
10381038
"reportError": "Report error"
10391039
},
1040+
"toggleJobHistory": "Toggle Job History",
1041+
"jobHistory": "Job History",
10401042
"jobList": {
10411043
"undated": "Undated",
10421044
"sortMostRecent": "Most recent",

src/stores/queueStore.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,3 +618,13 @@ export const useQueueSettingsStore = defineStore('queueSettingsStore', {
618618
batchCount: 1
619619
})
620620
})
621+
622+
export const useQueueUIStore = defineStore('queueUIStore', () => {
623+
const isOverlayExpanded = ref(false)
624+
625+
function toggleOverlay() {
626+
isOverlayExpanded.value = !isOverlayExpanded.value
627+
}
628+
629+
return { isOverlayExpanded, toggleOverlay }
630+
})

0 commit comments

Comments
 (0)