Fix record page layout BE (#17758)

## Context
- Add missing conditional display
- Set default tab as null for most of the page layout, letting the FE
handle that
- Fix duplicate "Note" widget in both task and note pages
- Simplify typing, removing redundant layoutName
This commit is contained in:
Weiko
2026-02-06 19:34:35 +01:00
committed by GitHub
parent 30cbf0e40e
commit cc86b9acae
25 changed files with 278 additions and 144 deletions
@@ -7,6 +7,7 @@ export type SeederFlatPageLayoutWidget = Pick<
| 'title'
| 'type'
| 'gridPosition'
| 'position'
| 'configuration'
| 'objectMetadataId'
>;
@@ -1,6 +1,7 @@
import { CalendarStartDay } from 'twenty-shared/constants';
import { isDefined } from 'twenty-shared/utils';
import { STANDARD_OBJECTS } from 'twenty-shared/metadata';
import { PageLayoutTabLayoutMode } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
@@ -69,6 +70,13 @@ export const getPageLayoutWidgetDataSeedsV2 = (
title: 'Revenue Forecast',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 7, rowSpan: 8, columnSpan: 5 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 7,
rowSpan: 8,
columnSpan: 5,
},
configuration: {
configurationType: WidgetConfigurationType.LINE_CHART,
aggregateFieldMetadataId: opportunityAmountFieldId,
@@ -98,6 +106,13 @@ export const getPageLayoutWidgetDataSeedsV2 = (
title: 'New Customers Over Time',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 3, rowSpan: 6, columnSpan: 5 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 3,
rowSpan: 6,
columnSpan: 5,
},
configuration: {
configurationType: WidgetConfigurationType.LINE_CHART,
aggregateFieldMetadataId: companyIdFieldId,
@@ -127,6 +142,13 @@ export const getPageLayoutWidgetDataSeedsV2 = (
title: 'Revenue Distribution',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 4, rowSpan: 2, columnSpan: 3 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 4,
rowSpan: 2,
columnSpan: 3,
},
configuration: {
configurationType: WidgetConfigurationType.PIE_CHART,
aggregateFieldMetadataId: companyArrFieldId,
@@ -155,6 +177,13 @@ export const getPageLayoutWidgetDataSeedsV2 = (
title: 'Average ARR',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 7, rowSpan: 6, columnSpan: 5 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 7,
rowSpan: 6,
columnSpan: 5,
},
configuration: {
configurationType: WidgetConfigurationType.GAUGE_CHART,
aggregateFieldMetadataId: companyArrFieldId,
@@ -181,6 +210,13 @@ export const getPageLayoutWidgetDataSeedsV2 = (
title: 'Companies by LinkedIn (Field Permission Test)',
type: WidgetType.GRAPH,
gridPosition: { row: 6, column: 0, rowSpan: 4, columnSpan: 6 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 6,
column: 0,
rowSpan: 4,
columnSpan: 6,
},
configuration: {
configurationType: WidgetConfigurationType.PIE_CHART,
aggregateFieldMetadataId: companyIdFieldId,
@@ -210,6 +246,13 @@ export const getPageLayoutWidgetDataSeedsV2 = (
title: 'Contact Roles',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 0, rowSpan: 4, columnSpan: 6 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 0,
rowSpan: 4,
columnSpan: 6,
},
configuration: {
configurationType: WidgetConfigurationType.PIE_CHART,
aggregateFieldMetadataId: personIdFieldId,
@@ -1,6 +1,7 @@
import { CalendarStartDay } from 'twenty-shared/constants';
import { isDefined } from 'twenty-shared/utils';
import { STANDARD_OBJECTS } from 'twenty-shared/metadata';
import { PageLayoutTabLayoutMode } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
@@ -87,6 +88,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Total Pipeline Value',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 0, rowSpan: 2, columnSpan: 3 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 0,
rowSpan: 2,
columnSpan: 3,
},
configuration: {
configurationType: WidgetConfigurationType.AGGREGATE_CHART,
aggregateFieldMetadataId: opportunityAmountFieldId,
@@ -111,6 +119,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Rocket Count (Object Permission Test)',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 3, rowSpan: 4, columnSpan: 4 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 3,
rowSpan: 4,
columnSpan: 4,
},
configuration: {
configurationType: WidgetConfigurationType.AGGREGATE_CHART,
aggregateFieldMetadataId: rocketIdFieldId,
@@ -137,6 +152,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Pipeline Value by Close Date (Stacked by Stage)',
type: WidgetType.GRAPH,
gridPosition: { row: 4, column: 0, rowSpan: 8, columnSpan: 6 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 4,
column: 0,
rowSpan: 8,
columnSpan: 6,
},
configuration: {
configurationType: WidgetConfigurationType.BAR_CHART,
aggregateFieldMetadataId: opportunityAmountFieldId,
@@ -169,6 +191,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Rockets by Created Date (Object Permission Test)',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 0, rowSpan: 5, columnSpan: 5 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 0,
rowSpan: 5,
columnSpan: 5,
},
configuration: {
configurationType: WidgetConfigurationType.BAR_CHART,
aggregateFieldMetadataId: rocketIdFieldId,
@@ -198,6 +227,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Opportunity Count',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 5, rowSpan: 5, columnSpan: 7 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 5,
rowSpan: 5,
columnSpan: 7,
},
configuration: {
configurationType: WidgetConfigurationType.AGGREGATE_CHART,
aggregateFieldMetadataId: opportunityIdFieldId,
@@ -224,6 +260,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Total Customers',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 0, rowSpan: 2, columnSpan: 3 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 0,
rowSpan: 2,
columnSpan: 3,
},
configuration: {
configurationType: WidgetConfigurationType.AGGREGATE_CHART,
aggregateFieldMetadataId: companyIdFieldId,
@@ -250,6 +293,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Companies by Size (Stacked by City)',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 8, rowSpan: 10, columnSpan: 8 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 8,
rowSpan: 10,
columnSpan: 8,
},
configuration: {
configurationType: WidgetConfigurationType.BAR_CHART,
aggregateFieldMetadataId: companyIdFieldId,
@@ -285,6 +335,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Annual Recurring Revenue',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 0, rowSpan: 4, columnSpan: 4 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 0,
rowSpan: 4,
columnSpan: 4,
},
configuration: {
configurationType: WidgetConfigurationType.AGGREGATE_CHART,
aggregateFieldMetadataId: companyArrFieldId,
@@ -309,6 +366,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'LinkedIn Profiles Count (Field Permission Test)',
type: WidgetType.GRAPH,
gridPosition: { row: 2, column: 0, rowSpan: 4, columnSpan: 3 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 2,
column: 0,
rowSpan: 4,
columnSpan: 3,
},
configuration: {
configurationType: WidgetConfigurationType.AGGREGATE_CHART,
aggregateFieldMetadataId: companyLinkedinLinkFieldId,
@@ -332,6 +396,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Team Size',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 0, rowSpan: 5, columnSpan: 6 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 0,
rowSpan: 5,
columnSpan: 6,
},
configuration: {
configurationType: WidgetConfigurationType.AGGREGATE_CHART,
aggregateFieldMetadataId: personIdFieldId,
@@ -356,6 +427,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Geographic Distribution',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 6, rowSpan: 5, columnSpan: 6 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 6,
rowSpan: 5,
columnSpan: 6,
},
configuration: {
configurationType: WidgetConfigurationType.BAR_CHART,
aggregateFieldMetadataId: personIdFieldId,
@@ -387,6 +465,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Open Tasks',
type: WidgetType.GRAPH,
gridPosition: { row: 0, column: 6, rowSpan: 6, columnSpan: 6 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 0,
column: 6,
rowSpan: 6,
columnSpan: 6,
},
configuration: {
configurationType: WidgetConfigurationType.AGGREGATE_CHART,
aggregateFieldMetadataId: taskIdFieldId,
@@ -409,6 +494,13 @@ export const getPageLayoutWidgetDataSeeds = (
title: 'Front Component',
type: WidgetType.FRONT_COMPONENT,
gridPosition: { row: 2, column: 7, rowSpan: 2, columnSpan: 5 },
position: {
layoutMode: PageLayoutTabLayoutMode.GRID,
row: 2,
column: 7,
rowSpan: 2,
columnSpan: 5,
},
configuration: {
configurationType: WidgetConfigurationType.FRONT_COMPONENT,
frontComponentId: '6cdf2607-4b28-40e6-8c53-cc06799ddc88',
@@ -38,6 +38,7 @@ export const seedPageLayoutWidgets = async ({
...widget,
workspaceId,
gridPosition: widget.gridPosition,
position: widget.position,
configuration: widget.configuration,
universalIdentifier: v4(),
applicationId: workspaceCustomApplicationId,
@@ -54,6 +55,7 @@ export const seedPageLayoutWidgets = async ({
'title',
'type',
'gridPosition',
'position',
'configuration',
'objectMetadataId',
'workspaceId',