4949 class =" px-3"
5050 data-testid =" queue-overlay-toggle"
5151 @click =" toggleQueueOverlay"
52+ @contextmenu.stop.prevent =" showQueueContextMenu"
5253 >
5354 <span class =" text-sm font-normal tabular-nums" >
5455 {{ activeJobsLabel }}
5758 {{ t('sideToolbar.queueProgressOverlay.expandCollapsedQueue') }}
5859 </span >
5960 </Button >
61+ <ContextMenu ref =" queueContextMenu" :model =" queueContextMenuItems" />
6062 <CurrentUserButton
6163 v-if =" isLoggedIn && !isIntegratedTabBar"
6264 class =" shrink-0"
8486
8587<script setup lang="ts">
8688import { storeToRefs } from ' pinia'
89+ import ContextMenu from ' primevue/contextmenu'
90+ import type { MenuItem } from ' primevue/menuitem'
8791import { computed , onMounted , ref } from ' vue'
8892import { useI18n } from ' vue-i18n'
8993
@@ -101,6 +105,7 @@ import { useSettingStore } from '@/platform/settings/settingStore'
101105import { useReleaseStore } from ' @/platform/updates/common/releaseStore'
102106import { app } from ' @/scripts/app'
103107import { useCommandStore } from ' @/stores/commandStore'
108+ import { useExecutionStore } from ' @/stores/executionStore'
104109import { useQueueStore , useQueueUIStore } from ' @/stores/queueStore'
105110import { useRightSidePanelStore } from ' @/stores/workspace/rightSidePanelStore'
106111import { useWorkspaceStore } from ' @/stores/workspaceStore'
@@ -119,6 +124,7 @@ const { t, n } = useI18n()
119124const { toastErrorHandler } = useErrorHandling ()
120125const commandStore = useCommandStore ()
121126const queueStore = useQueueStore ()
127+ const executionStore = useExecutionStore ()
122128const queueUIStore = useQueueUIStore ()
123129const { activeJobsCount } = storeToRefs (queueStore )
124130const { isOverlayExpanded : isQueueOverlayExpanded } = storeToRefs (queueUIStore )
@@ -144,6 +150,18 @@ const queueHistoryTooltipConfig = computed(() =>
144150const customNodesManagerTooltipConfig = computed (() =>
145151 buildTooltipConfig (t (' menu.customNodesManager' ))
146152)
153+ const queueContextMenu = ref <InstanceType <typeof ContextMenu > | null >(null )
154+ const queueContextMenuItems = computed <MenuItem []>(() => [
155+ {
156+ label: t (' sideToolbar.queueProgressOverlay.clearQueueTooltip' ),
157+ icon: ' icon-[lucide--list-x] text-destructive-background' ,
158+ class: ' *:text-destructive-background' ,
159+ disabled: queueStore .pendingTasks .length === 0 ,
160+ command : () => {
161+ void handleClearQueue ()
162+ }
163+ }
164+ ])
147165
148166// Use either release red dot or conflict red dot
149167const shouldShowRedDot = computed ((): boolean => {
@@ -170,6 +188,19 @@ const toggleQueueOverlay = () => {
170188 commandStore .execute (' Comfy.Queue.ToggleOverlay' )
171189}
172190
191+ const showQueueContextMenu = (event : MouseEvent ) => {
192+ queueContextMenu .value ?.show (event )
193+ }
194+
195+ const handleClearQueue = async () => {
196+ const pendingPromptIds = queueStore .pendingTasks
197+ .map ((task ) => task .promptId )
198+ .filter ((id ): id is string => typeof id === ' string' && id .length > 0 )
199+
200+ await commandStore .execute (' Comfy.ClearPendingTasks' )
201+ executionStore .clearInitializationByPromptIds (pendingPromptIds )
202+ }
203+
173204const openCustomNodeManager = async () => {
174205 try {
175206 await managerState .openManager ({
0 commit comments