Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(webv2): drop the open-queue item from the queue widget menu
joshistoastc6941e955b99
diff --git a/invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.test.ts b/invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.test.tsindex 3f7864b9af..9c5f3cb0c7 100644--- a/invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.test.ts+++ b/invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.test.ts@@ -3,28 +3,31 @@ import { describe, expect, it, vi } from 'vitest';import { getQueueMenuActions } from './queueMenuActions';describe('getQueueMenuActions', () => {+ const buildInputs = (includeOpenQueue: boolean) => ({+ labels: {+ cancelAll: 'Cancel All Items',+ cancelAllExceptCurrent: 'Cancel all except current item',+ cancelCurrent: 'Cancel Current Item',+ openQueue: 'Open Queue',+ pauseProcessor: 'Pause Processor',+ resumeProcessor: 'Resume Processor',+ },+ cancellableCount: 2,+ canManageProcessor: true,+ hasPendingQueueWork: true,+ hasRunningItem: true,+ includeOpenQueue,+ isConnected: true,+ onCancelAll: vi.fn(),+ onCancelAllExceptCurrent: vi.fn(),+ onCancelCurrent: vi.fn(),+ onOpenQueue: vi.fn(),+ onPauseProcessor: vi.fn(),+ onResumeProcessor: vi.fn(),+ });+it('uses the same cancellation and processor actions for topbar and widget menus', () => {- const actions = getQueueMenuActions({- labels: {- cancelAll: 'Cancel All Items',- cancelAllExceptCurrent: 'Cancel all except current item',- cancelCurrent: 'Cancel Current Item',- openQueue: 'Open Queue',- pauseProcessor: 'Pause Processor',- resumeProcessor: 'Resume Processor',- },- cancellableCount: 2,- canManageProcessor: true,- hasPendingQueueWork: true,- hasRunningItem: true,- isConnected: true,- onCancelAll: vi.fn(),- onCancelAllExceptCurrent: vi.fn(),- onCancelCurrent: vi.fn(),- onOpenQueue: vi.fn(),- onPauseProcessor: vi.fn(),- onResumeProcessor: vi.fn(),- });+ const actions = getQueueMenuActions(buildInputs(true));expect(actions.map((action) => action.label)).toEqual(['Cancel Current Item',@@ -35,4 +38,10 @@ describe('getQueueMenuActions', () => {'Open Queue',]);});++ it('omits the open-queue entry for menus rendered inside the queue widget', () => {+ const actions = getQueueMenuActions(buildInputs(false));++ expect(actions.map((action) => action.label)).not.toContain('Open Queue');+ });});diff --git a/invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.tsx b/invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.tsxindex 2c2d90f1e4..503b53880c 100644--- a/invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.tsx+++ b/invokeai/frontend/webv2/src/features/queue/ui/queueMenuActions.tsx@@ -22,6 +22,8 @@ interface QueueMenuActionInputs {pauseProcessor: string;resumeProcessor: string;};+ /** Only menus rendered outside the queue widget should offer to open it. */+ includeOpenQueue: boolean;cancellableCount: number;hasPendingQueueWork: boolean;hasRunningItem: boolean;@@ -45,6 +47,7 @@ export interface QueueMenuAction {export const getQueueMenuActions = ({labels,+ includeOpenQueue,cancellableCount,hasPendingQueueWork,hasRunningItem,@@ -90,15 +93,21 @@ export const getQueueMenuActions = ({label: labels.pauseProcessor,onClick: onPauseProcessor,},- {- disabled: false,- icon: ListOrderedIcon,- label: labels.openQueue,- onClick: onOpenQueue,- },+ ...(includeOpenQueue+ ? [+ {+ disabled: false,+ icon: ListOrderedIcon,+ label: labels.openQueue,+ onClick: onOpenQueue,+ },+ ]+ : []),];-export const useQueueMenuActions = (): QueueMenuAction[] => {+export const useQueueMenuActions = ({+ includeOpenQueue = false,+}: { includeOpenQueue?: boolean } = {}): QueueMenuAction[] => {const { t } = useTranslation();const counts = useQueueCounts();const { current } = useNowNextItems();@@ -197,6 +206,7 @@ export const useQueueMenuActions = (): QueueMenuAction[] => {canManageProcessor,hasPendingQueueWork,hasRunningItem,+ includeOpenQueue,isConnected,onCancelAll: cancelAll,onCancelAllExceptCurrent: cancelAllExceptCurrent,@@ -213,6 +223,7 @@ export const useQueueMenuActions = (): QueueMenuAction[] => {canManageProcessor,hasPendingQueueWork,hasRunningItem,+ includeOpenQueue,isConnected,openQueue,pauseProcessor,diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsxindex 673757015a..a24b8cb560 100644--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/QueueCluster.tsx@@ -40,7 +40,7 @@ export const QueueCluster = () => {const backendConnectionStatus = useWorkbenchSelector((snapshot) => snapshot.backendConnection.status);const modelLoads = useModelLoads();const openWorkbenchWidget = useOpenWorkbenchWidget();- const actions = useQueueMenuActions();+ const actions = useQueueMenuActions({ includeOpenQueue: true });const cancelCurrent = actions[0];const baseSummary = getQueueSummary(queueItems);