Skip to content

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.

fix(webv2): curate layout preset widgets

joshistoastc676e407e614
diff --git a/invokeai/frontend/webv2/src/workbench/graphWidgets.test.ts b/invokeai/frontend/webv2/src/workbench/graphWidgets.test.ts
index 88df00e023..593ab505af 100644
--- a/invokeai/frontend/webv2/src/workbench/graphWidgets.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/graphWidgets.test.ts
@@ -38,18 +38,17 @@ describe('graph widget sources', () => {
expect(graphWidgetSources.map((source) => source.sourceId)).toEqual(['generate', 'canvas', 'upscale', 'workflow']);
});
- it('separates what the layout is showing from what it has placed', () => {
+ it('separates active widgets from placed secondary widgets', () => {
const project = applyPreset('edit');
// Edit shows Generate on the left and Canvas in the centre...
expect([...getVisibleWidgetTypeIds(project)]).toEqual(expect.arrayContaining(['generate', 'canvas']));
expect(getVisibleWidgetTypeIds(project).has('workflow')).toBe(false);
- // ...while Upscale and Workflow are still placed in the same left rail, so
- // routing to them needs no new placement, only revealing.
- expect([...getPlacedWidgetTypeIds(project)]).toEqual(
- expect.arrayContaining(['generate', 'canvas', 'upscale', 'workflow'])
- );
+ // ...while Upscale is still placed second in the left rail, so routing to
+ // it needs no new placement, only revealing. Workflow belongs to Automate.
+ expect([...getPlacedWidgetTypeIds(project)]).toEqual(expect.arrayContaining(['generate', 'canvas', 'upscale']));
+ expect(getPlacedWidgetTypeIds(project).has('workflow')).toBe(false);
});
it('maps each source to its natural output target', () => {
diff --git a/invokeai/frontend/webv2/src/workbench/layoutPresets.test.ts b/invokeai/frontend/webv2/src/workbench/layoutPresets.test.ts
index 9f747c3c80..51c44caea8 100644
--- a/invokeai/frontend/webv2/src/workbench/layoutPresets.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/layoutPresets.test.ts
@@ -41,4 +41,52 @@ describe('built-in layout preset descriptors', () => {
]);
expect(layoutPresets).toEqual(builtInLayoutPresetDescriptors.map(({ preset }) => preset));
});
+
+ it('ships task-focused widget sets in interaction-priority order', () => {
+ const summaries = Object.fromEntries(
+ layoutPresets.map(({ id, snapshot }) => [
+ id,
+ {
+ active: {
+ bottom: snapshot.widgetRegions.bottom.activeInstanceId,
+ center: snapshot.widgetRegions.center.activeInstanceId,
+ left: snapshot.widgetRegions.left.activeInstanceId,
+ right: snapshot.widgetRegions.right.activeInstanceId,
+ },
+ bottom: snapshot.widgetRegions.bottom.instanceIds,
+ center: snapshot.widgetRegions.center.instanceIds,
+ left: snapshot.widgetRegions.left.instanceIds,
+ panels: snapshot.layout.panels,
+ right: snapshot.widgetRegions.right.instanceIds,
+ },
+ ])
+ );
+
+ expect(summaries).toEqual({
+ automate: {
+ active: { bottom: 'gallery:bottom', center: 'workflow:center', left: 'workflow', right: 'queue' },
+ bottom: ['server-status', 'gallery:bottom', 'notifications', 'autosave-status'],
+ center: ['workflow:center', 'preview'],
+ left: ['workflow'],
+ panels: { isBottomOpen: false, isLeftOpen: true, isRightOpen: true },
+ right: ['queue', 'preview', 'gallery'],
+ },
+ compose: {
+ active: { bottom: 'gallery:bottom', center: 'preview', left: 'generate', right: 'gallery' },
+ bottom: ['server-status', 'gallery:bottom', 'notifications', 'autosave-status'],
+ center: ['preview'],
+ left: ['generate', 'upscale'],
+ panels: { isBottomOpen: false, isLeftOpen: true, isRightOpen: true },
+ right: ['gallery', 'queue'],
+ },
+ edit: {
+ active: { bottom: 'gallery:bottom', center: 'canvas', left: 'generate', right: 'layers' },
+ bottom: ['server-status', 'gallery:bottom', 'notifications', 'autosave-status'],
+ center: ['canvas', 'preview'],
+ left: ['generate', 'upscale'],
+ panels: { isBottomOpen: false, isLeftOpen: true, isRightOpen: true },
+ right: ['layers', 'preview', 'gallery', 'queue'],
+ },
+ });
+ });
});
diff --git a/invokeai/frontend/webv2/src/workbench/layoutPresets.ts b/invokeai/frontend/webv2/src/workbench/layoutPresets.ts
index 0351092efe..d336a67fbc 100644
--- a/invokeai/frontend/webv2/src/workbench/layoutPresets.ts
+++ b/invokeai/frontend/webv2/src/workbench/layoutPresets.ts
@@ -13,12 +13,9 @@ import type { WidgetInstanceId, WidgetTypeId } from '@workbench/widgetContracts'
const defaultBottomInstanceIds: WidgetInstanceId[] = [
'server-status',
- 'diagnostics:bottom',
'gallery:bottom',
'notifications',
'autosave-status',
- 'version-status',
- 'workflow:bottom',
];
const defaultInstanceTypes: Record<WidgetInstanceId, WidgetTypeId> = {
@@ -160,17 +157,17 @@ export const builtInLayoutPresetDescriptors: BuiltInLayoutPresetDescriptor[] = [
}),
center: createRegion({
activeInstanceId: 'preview',
- instanceIds: ['preview', 'canvas', 'gallery:center', 'workflow:center'],
+ instanceIds: ['preview'],
sizePx: 0,
}),
left: createRegion({
activeInstanceId: 'generate',
- instanceIds: ['generate', 'workflow', 'upscale'],
+ instanceIds: ['generate', 'upscale'],
sizePx: 450,
}),
right: createRegion({
activeInstanceId: 'gallery',
- instanceIds: ['gallery', 'preview', 'queue', 'layers', 'diagnostics', 'project'],
+ instanceIds: ['gallery', 'queue'],
sizePx: 450,
}),
},
@@ -193,17 +190,17 @@ export const builtInLayoutPresetDescriptors: BuiltInLayoutPresetDescriptor[] = [
}),
center: createRegion({
activeInstanceId: 'canvas',
- instanceIds: ['canvas', 'preview', 'gallery:center', 'workflow:center'],
+ instanceIds: ['canvas', 'preview'],
sizePx: 0,
}),
left: createRegion({
activeInstanceId: 'generate',
- instanceIds: ['generate', 'workflow', 'upscale'],
+ instanceIds: ['generate', 'upscale'],
sizePx: 450,
}),
right: createRegion({
activeInstanceId: 'layers',
- instanceIds: ['layers', 'gallery', 'queue', 'preview', 'diagnostics', 'project'],
+ instanceIds: ['layers', 'preview', 'gallery', 'queue'],
sizePx: 450,
}),
},
@@ -219,24 +216,24 @@ export const builtInLayoutPresetDescriptors: BuiltInLayoutPresetDescriptor[] = [
panels: { isBottomOpen: false, isLeftOpen: true, isRightOpen: true },
widgetRegions: {
bottom: createRegion({
- activeInstanceId: 'workflow:bottom',
+ activeInstanceId: 'gallery:bottom',
instanceIds: defaultBottomInstanceIds,
isCollapsed: true,
sizePx: 180,
}),
center: createRegion({
activeInstanceId: 'workflow:center',
- instanceIds: ['workflow:center', 'canvas', 'preview', 'gallery:center'],
+ instanceIds: ['workflow:center', 'preview'],
sizePx: 0,
}),
left: createRegion({
activeInstanceId: 'workflow',
- instanceIds: ['workflow', 'generate', 'upscale'],
+ instanceIds: ['workflow'],
sizePx: 450,
}),
right: createRegion({
activeInstanceId: 'queue',
- instanceIds: ['queue', 'gallery', 'layers', 'preview', 'diagnostics', 'project'],
+ instanceIds: ['queue', 'preview', 'gallery'],
sizePx: 450,
}),
},
diff --git a/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.test.ts b/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.test.ts
index 3bb6945431..151cdc5e85 100644
--- a/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/projects/syncedPersistence.test.ts
@@ -257,7 +257,7 @@ describe('loadWorkbench session hydration', () => {
const serverAccount = {
...local.account,
layoutPresetMetadataOverrides: { compose: { label: 'Writing' } },
- layoutPresetRouteOverrides: { compose: { destination: 'canvas' as const, sourceId: 'canvas' as const } },
+ layoutPresetRouteOverrides: { compose: { destination: 'canvas' as const, sourceId: 'upscale' as const } },
};
storage.set(
'invokeai:v7:webv2:workbench',
@@ -272,7 +272,7 @@ describe('loadWorkbench session hydration', () => {
snapshot?.state.projects.find((project) => project.id === snapshot.state.activeProjectId)?.invocation
).toMatchObject({
destination: 'canvas',
- sourceId: 'canvas',
+ sourceId: 'upscale',
});
});
@@ -368,7 +368,7 @@ describe('loadWorkbench session hydration', () => {
const account = {
...createInitialWorkbenchState().account,
layoutPresetRouteOverrides: {
- compose: { destination: 'canvas' as const, sourceId: 'canvas' as const },
+ compose: { destination: 'canvas' as const, sourceId: 'upscale' as const },
},
};
@@ -380,7 +380,7 @@ describe('loadWorkbench session hydration', () => {
expect(snapshot?.state.activeProjectId).not.toBe(first.id);
expect(
snapshot?.state.projects.find((project) => project.id === snapshot.state.activeProjectId)?.invocation
- ).toMatchObject({ destination: 'canvas', sourceId: 'canvas' });
+ ).toMatchObject({ destination: 'canvas', sourceId: 'upscale' });
expect(service.hasPendingChanges()).toBe(true);
});
@@ -391,7 +391,7 @@ describe('loadWorkbench session hydration', () => {
account: {
...initial.account,
layoutPresetRouteOverrides: {
- compose: { destination: 'canvas', sourceId: 'canvas' },
+ compose: { destination: 'canvas', sourceId: 'upscale' },
},
},
};
@@ -412,7 +412,7 @@ describe('loadWorkbench session hydration', () => {
expect(snapshot?.state.activeProjectId).not.toBe(cachedProjectId);
expect(
snapshot?.state.projects.find((project) => project.id === snapshot.state.activeProjectId)?.invocation
- ).toMatchObject({ destination: 'canvas', sourceId: 'canvas' });
+ ).toMatchObject({ destination: 'canvas', sourceId: 'upscale' });
});
it('starts an account-resolved draft from an empty offline session', async () => {
@@ -422,7 +422,7 @@ describe('loadWorkbench session hydration', () => {
account: {
...initial.account,
layoutPresetRouteOverrides: {
- compose: { destination: 'canvas', sourceId: 'canvas' },
+ compose: { destination: 'canvas', sourceId: 'upscale' },
},
},
activeProjectId: '',
@@ -438,7 +438,7 @@ describe('loadWorkbench session hydration', () => {
const snapshot = await service.loadWorkbench();
expect(snapshot?.state.projects).toHaveLength(1);
- expect(snapshot?.state.projects[0]?.invocation).toMatchObject({ destination: 'canvas', sourceId: 'canvas' });
+ expect(snapshot?.state.projects[0]?.invocation).toMatchObject({ destination: 'canvas', sourceId: 'upscale' });
});
it('reopens the cached session when the backend is unreachable and no draft was requested', async () => {
diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
index 86cce4055e..41dea82e44 100644
--- a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
@@ -357,13 +357,21 @@ const submitGenerate = (state: WorkbenchState) =>
workbenchReducer(state, { backendSupportsCancellation: true, type: 'submitInvocationSnapshot' });
describe('workbench widget region defaults', () => {
- it('enables Diagnostics in the right side panel rail', () => {
+ it('starts new projects from the curated Compose widget defaults', () => {
const state = createInitialWorkbenchState();
+ const project = getActiveProject(state);
- expect(getActiveProject(state).widgetRegions.right.instanceIds).toContain('diagnostics');
+ expect(project.widgetRegions.left.instanceIds).toEqual(['generate', 'upscale']);
+ expect(project.widgetRegions.right.instanceIds).toEqual(['gallery', 'queue']);
+ expect(project.widgetRegions.bottom.instanceIds).toEqual([
+ 'server-status',
+ 'gallery:bottom',
+ 'notifications',
+ 'autosave-status',
+ ]);
});
- it('hydrates the old default right rail with Diagnostics while preserving customized rails', () => {
+ it('hydrates the old default right rail to the curated Compose defaults while preserving customized rails', () => {
const initial = createInitialWorkbenchState();
const legacyDefault = {
...initial,
@@ -389,14 +397,7 @@ describe('workbench widget region defaults', () => {
const hydratedLegacyDefault = workbenchReducer(initial, { state: legacyDefault, type: 'hydrateWorkbench' });
const hydratedCustomized = workbenchReducer(initial, { state: customized, type: 'hydrateWorkbench' });
- expect(getActiveProject(hydratedLegacyDefault).widgetRegions.right.instanceIds).toEqual([
- 'gallery',
- 'preview',
- 'queue',
- 'layers',
- 'diagnostics',
- 'project',
- ]);
+ expect(getActiveProject(hydratedLegacyDefault).widgetRegions.right.instanceIds).toEqual(['gallery', 'queue']);
expect(getActiveProject(hydratedCustomized).widgetRegions.right.instanceIds).toEqual(['gallery', 'layers']);
});
@@ -643,7 +644,7 @@ describe('workbench layout presets', () => {
},
},
layoutPresetRouteOverrides: {
- compose: { destination: 'canvas', sourceId: 'canvas' },
+ compose: { destination: 'canvas', sourceId: 'upscale' },
},
},
};
@@ -654,7 +655,7 @@ describe('workbench layout presets', () => {
expect(project.invocation).toEqual({
destination: 'canvas',
destinationLocked: false,
- sourceId: 'canvas',
+ sourceId: 'upscale',
sourceLocked: false,
});
expect(project.layout).toMatchObject({ centerViewId: 'gallery', presetId: 'compose' });
@@ -712,13 +713,13 @@ describe('workbench layout presets', () => {
let state = createInitialWorkbenchState();
state = workbenchReducer(state, {
- defaultRoute: { destination: 'canvas', sourceId: 'workflow' },
+ defaultRoute: { destination: 'canvas', sourceId: 'upscale' },
presetId: 'compose',
type: 'setLayoutPresetRoute',
});
state = workbenchReducer(state, { presetId: 'compose', type: 'applyPreset' });
- expect(getActiveProject(state).invocation).toMatchObject({ destination: 'canvas', sourceId: 'workflow' });
+ expect(getActiveProject(state).invocation).toMatchObject({ destination: 'canvas', sourceId: 'upscale' });
});
it('applies preset routing with the edit preference off in the same undo entry as the layout', () => {
@@ -838,33 +839,25 @@ describe('workbench layout presets', () => {
expect(project.layout.panels).toEqual({ isBottomOpen: false, isLeftOpen: true, isRightOpen: true });
expect(project.widgetRegions.left).toMatchObject({
activeInstanceId: 'generate',
- instanceIds: ['generate', 'workflow', 'upscale'],
+ instanceIds: ['generate', 'upscale'],
isCollapsed: false,
sizePx: 450,
});
expect(project.widgetRegions.center).toMatchObject({
activeInstanceId: 'preview',
- instanceIds: ['preview', 'canvas', 'gallery:center', 'workflow:center'],
+ instanceIds: ['preview'],
isCollapsed: false,
sizePx: 0,
});
expect(project.widgetRegions.right).toMatchObject({
activeInstanceId: 'gallery',
- instanceIds: ['gallery', 'preview', 'queue', 'layers', 'diagnostics', 'project'],
+ instanceIds: ['gallery', 'queue'],
isCollapsed: false,
sizePx: 450,
});
expect(project.widgetRegions.bottom).toMatchObject({
activeInstanceId: 'gallery:bottom',
- instanceIds: [
- 'server-status',
- 'diagnostics:bottom',
- 'gallery:bottom',
- 'notifications',
- 'autosave-status',
- 'version-status',
- 'workflow:bottom',
- ],
+ instanceIds: ['server-status', 'gallery:bottom', 'notifications', 'autosave-status'],
isCollapsed: true,
sizePx: 180,
});