5f604a503a
## Context
Phase 1 of removing the legacy `gridPosition` field from
`PageLayoutWidget` in favor of the new `position` discriminated union
(`grid` / `vertical-list` / `canvas`). This PR is purely additive —
`gridPosition` is still required and read everywhere; we just guarantee
that every widget now also has a non-null `position` so a follow-up PR
can drop `gridPosition` cleanly.
## Changes
- **Slow instance command**
`BackfillPageLayoutWidgetPositionSlowInstanceCommand` (2.1.0):
for every `core.pageLayoutWidget` row where `position IS NULL`, copies
`gridPosition`
into `position` with `layoutMode: 'GRID'`. Historically only grid
widgets used
`gridPosition`, so a single SQL update covers every existing row.
- **`PageLayoutDuplicationService`**: when duplicating a widget, also
forwards
`originalWidget.position` (was previously only forwarding
`gridPosition`).
- **Frontend default layouts** (10 `Default*PageLayout.ts` files): added
a `position`
sibling to every widget, matching the parent tab's `layoutMode` —
`VERTICAL_LIST` widgets
get `{ layoutMode, index }`, `CANVAS` widgets get `{ layoutMode }`
<img width="338" height="226" alt="Screenshot 2026-04-24 at 16 23 17"
src="https://github.com/user-attachments/assets/c3319318-f1b8-4271-96b4-196b209a1f5e"
/>
120 lines
3.7 KiB
TypeScript
120 lines
3.7 KiB
TypeScript
import { DEFAULT_WORKFLOW_VERSION_PAGE_LAYOUT_ID } from '@/page-layout/constants/DefaultWorkflowVersionPageLayoutId';
|
|
import { type PageLayout } from '@/page-layout/types/PageLayout';
|
|
import {
|
|
PageLayoutTabLayoutMode,
|
|
PageLayoutType,
|
|
WidgetConfigurationType,
|
|
WidgetType,
|
|
} from '~/generated-metadata/graphql';
|
|
|
|
/**
|
|
* Default WorkflowVersion PageLayout.
|
|
* Specialized layout for workflow version visualization with Fields and Flow tabs.
|
|
*/
|
|
export const DEFAULT_WORKFLOW_VERSION_PAGE_LAYOUT: PageLayout = {
|
|
__typename: 'PageLayout',
|
|
id: DEFAULT_WORKFLOW_VERSION_PAGE_LAYOUT_ID,
|
|
name: 'Default Workflow Version Layout',
|
|
type: PageLayoutType.RECORD_PAGE,
|
|
objectMetadataId: null,
|
|
createdAt: new Date().toISOString(),
|
|
updatedAt: new Date().toISOString(),
|
|
deletedAt: null,
|
|
defaultTabToFocusOnMobileAndSidePanelId: 'workflow-version-tab-flow',
|
|
tabs: [
|
|
// Fields tab (position 100)
|
|
{
|
|
__typename: 'PageLayoutTab',
|
|
applicationId: '',
|
|
id: 'workflow-version-tab-fields',
|
|
isActive: true,
|
|
title: 'Home',
|
|
icon: 'IconHome',
|
|
position: 100,
|
|
layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
|
|
pageLayoutId: DEFAULT_WORKFLOW_VERSION_PAGE_LAYOUT_ID,
|
|
createdAt: new Date().toISOString(),
|
|
updatedAt: new Date().toISOString(),
|
|
deletedAt: null,
|
|
widgets: [
|
|
{
|
|
__typename: 'PageLayoutWidget',
|
|
applicationId: '',
|
|
id: 'workflow-version-widget-fields',
|
|
isActive: true,
|
|
pageLayoutTabId: 'workflow-version-tab-fields',
|
|
title: 'Fields',
|
|
type: WidgetType.FIELDS,
|
|
objectMetadataId: null,
|
|
gridPosition: {
|
|
__typename: 'GridPosition',
|
|
row: 0,
|
|
column: 0,
|
|
rowSpan: 12,
|
|
columnSpan: 12,
|
|
},
|
|
position: {
|
|
__typename: 'PageLayoutWidgetVerticalListPosition',
|
|
layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
|
|
index: 0,
|
|
},
|
|
configuration: {
|
|
__typename: 'FieldsConfiguration',
|
|
configurationType: WidgetConfigurationType.FIELDS,
|
|
viewId: null,
|
|
},
|
|
createdAt: new Date().toISOString(),
|
|
updatedAt: new Date().toISOString(),
|
|
deletedAt: null,
|
|
},
|
|
],
|
|
},
|
|
// Flow tab (position 200)
|
|
{
|
|
__typename: 'PageLayoutTab',
|
|
applicationId: '',
|
|
id: 'workflow-version-tab-flow',
|
|
isActive: true,
|
|
title: 'Flow',
|
|
icon: 'IconSettings',
|
|
position: 200,
|
|
layoutMode: PageLayoutTabLayoutMode.CANVAS,
|
|
pageLayoutId: DEFAULT_WORKFLOW_VERSION_PAGE_LAYOUT_ID,
|
|
createdAt: new Date().toISOString(),
|
|
updatedAt: new Date().toISOString(),
|
|
deletedAt: null,
|
|
widgets: [
|
|
{
|
|
__typename: 'PageLayoutWidget',
|
|
applicationId: '',
|
|
id: 'workflow-version-widget-flow',
|
|
isActive: true,
|
|
pageLayoutTabId: 'workflow-version-tab-flow',
|
|
title: 'Flow',
|
|
type: WidgetType.WORKFLOW_VERSION,
|
|
objectMetadataId: null,
|
|
gridPosition: {
|
|
__typename: 'GridPosition',
|
|
row: 0,
|
|
column: 0,
|
|
rowSpan: 12,
|
|
columnSpan: 12,
|
|
},
|
|
position: {
|
|
__typename: 'PageLayoutWidgetCanvasPosition',
|
|
layoutMode: PageLayoutTabLayoutMode.CANVAS,
|
|
},
|
|
configuration: {
|
|
__typename: 'FieldsConfiguration',
|
|
configurationType: WidgetConfigurationType.FIELDS,
|
|
viewId: null,
|
|
},
|
|
createdAt: new Date().toISOString(),
|
|
updatedAt: new Date().toISOString(),
|
|
deletedAt: null,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|