Skip to content
20 changes: 20 additions & 0 deletions src/components/actionbar/ComfyActionbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@
>
<i class="icon-[lucide--x] size-4" />
</Button>
<Button
v-if="showClearPendingTasksButton"
v-tooltip.bottom="clearPendingTasksTooltipConfig"
variant="destructive"
size="icon"
:disabled="!hasPendingTasks"
:aria-label="$t('menuLabels.Clear Pending Tasks')"
@click="() => commandStore.execute('Comfy.ClearPendingTasks')"
>
<i class="icon-[lucide--list-x] size-4" />
</Button>
</div>
</Panel>
</div>
Expand All @@ -65,17 +76,22 @@ import { useSettingStore } from '@/platform/settings/settingStore'
import { useTelemetry } from '@/platform/telemetry'
import { useCommandStore } from '@/stores/commandStore'
import { useExecutionStore } from '@/stores/executionStore'
import { useQueueStore } from '@/stores/queueStore'
import { cn } from '@/utils/tailwindUtil'

import ComfyRunButton from './ComfyRunButton'

const settingsStore = useSettingStore()
const commandStore = useCommandStore()
const { hasPendingTasks } = storeToRefs(useQueueStore())
const { t } = useI18n()
const { isIdle: isExecutionIdle } = storeToRefs(useExecutionStore())

const position = computed(() => settingsStore.get('Comfy.UseNewMenu'))
const visible = computed(() => position.value !== 'Disabled')
const showClearPendingTasksButton = computed(() =>
settingsStore.get('Comfy.Menu.ShowClearPendingTasksButton')
)

const tabContainer = document.querySelector('.workflow-tabs-container')
const panelRef = ref<HTMLElement | null>(null)
Expand Down Expand Up @@ -286,6 +302,10 @@ const cancelCurrentJob = async () => {
await commandStore.execute('Comfy.Interrupt')
}

const clearPendingTasksTooltipConfig = computed(() =>
buildTooltipConfig(t('menuLabels.Clear Pending Tasks'))
)

const actionbarClass = computed(() =>
cn(
'w-[200px] border-dashed border-blue-500 opacity-80',
Expand Down
6 changes: 5 additions & 1 deletion src/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@
"Top": "Top"
}
},
"Comfy_Menu_ShowClearPendingTasksButton": {
"name": "Show clear pending tasks button in action bar",
"tooltip": "Adds a clear pending tasks button to the action bar."
},
"Comfy_Validation_Workflows": {
"name": "Validate workflows"
},
Expand Down Expand Up @@ -455,4 +459,4 @@
"pysssss_SnapToGrid": {
"name": "Always snap to grid"
}
}
}
8 changes: 8 additions & 0 deletions src/platform/settings/constants/coreSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,14 @@ export const CORE_SETTINGS: SettingParams[] = [
return value
}
},
{
id: 'Comfy.Menu.ShowClearPendingTasksButton',
category: ['Comfy', 'Menu', 'ShowClearPendingTasksButton'],
defaultValue: false,
name: 'Show clear pending tasks button in action bar',
type: 'boolean',
tooltip: 'Adds a clear pending tasks button to the action bar.'
},
{
id: 'Comfy.Workflow.WorkflowTabsPosition',
name: 'Opened workflows position',
Expand Down
1 change: 1 addition & 0 deletions src/schemas/apiSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ const zSettings = z.object({
'Comfy.TextareaWidget.FontSize': z.number(),
'Comfy.TextareaWidget.Spellcheck': z.boolean(),
'Comfy.UseNewMenu': z.enum(['Disabled', 'Top']),
'Comfy.Menu.ShowClearPendingTasksButton': z.boolean(),
'Comfy.TreeExplorer.ItemPadding': z.number(),
'Comfy.Validation.Workflows': z.boolean(),
'Comfy.Workflow.SortNodeIdOnSave': z.boolean(),
Expand Down
Loading