Implement page layout override (#18472)

This commit is contained in:
Weiko
2026-03-09 18:21:08 +01:00
committed by GitHub
parent 309fd7a526
commit c433b2b73f
90 changed files with 1270 additions and 57 deletions
@@ -10,4 +10,5 @@ export type SeederFlatPageLayoutWidget = Pick<
| 'position'
| 'configuration'
| 'objectMetadataId'
| 'overrides'
>;
@@ -11,7 +11,10 @@ type PageLayoutTabSeed = {
position: number;
pageLayoutId: string;
workspaceId: string;
} & Pick<FlatPageLayoutTab, 'applicationId' | 'universalIdentifier'>;
} & Pick<
FlatPageLayoutTab,
'applicationId' | 'universalIdentifier' | 'overrides'
>;
export const getPageLayoutTabDataSeeds = ({
applicationId,
@@ -31,6 +34,7 @@ export const getPageLayoutTabDataSeeds = ({
workspaceId,
universalIdentifier: v4(),
applicationId,
overrides: null,
},
{
id: generateSeedId(workspaceId, PAGE_LAYOUT_TAB_SEEDS.SALES_DETAILS),
@@ -43,6 +47,7 @@ export const getPageLayoutTabDataSeeds = ({
workspaceId,
universalIdentifier: v4(),
applicationId,
overrides: null,
},
{
id: generateSeedId(workspaceId, PAGE_LAYOUT_TAB_SEEDS.CUSTOMER_OVERVIEW),
@@ -55,6 +60,7 @@ export const getPageLayoutTabDataSeeds = ({
workspaceId,
universalIdentifier: v4(),
applicationId,
overrides: null,
},
{
id: generateSeedId(workspaceId, PAGE_LAYOUT_TAB_SEEDS.CUSTOMER_ANALYTICS),
@@ -67,6 +73,7 @@ export const getPageLayoutTabDataSeeds = ({
workspaceId,
universalIdentifier: v4(),
applicationId,
overrides: null,
},
{
id: generateSeedId(workspaceId, PAGE_LAYOUT_TAB_SEEDS.TEAM_OVERVIEW),
@@ -76,6 +83,7 @@ export const getPageLayoutTabDataSeeds = ({
workspaceId,
universalIdentifier: v4(),
applicationId,
overrides: null,
},
{
id: generateSeedId(workspaceId, PAGE_LAYOUT_TAB_SEEDS.TEAM_METRICS),
@@ -85,5 +93,6 @@ export const getPageLayoutTabDataSeeds = ({
workspaceId,
universalIdentifier: v4(),
applicationId,
overrides: null,
},
];
@@ -91,6 +91,7 @@ export const getPageLayoutWidgetDataSeedsV2 = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: opportunityObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -127,6 +128,7 @@ export const getPageLayoutWidgetDataSeedsV2 = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: companyObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -162,6 +164,7 @@ export const getPageLayoutWidgetDataSeedsV2 = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: companyObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -195,6 +198,7 @@ export const getPageLayoutWidgetDataSeedsV2 = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: companyObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -231,6 +235,7 @@ export const getPageLayoutWidgetDataSeedsV2 = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: companyObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -266,6 +271,7 @@ export const getPageLayoutWidgetDataSeedsV2 = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: personObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
].filter(isDefined);
@@ -106,6 +106,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: opportunityObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
isDefined(rocketIdFieldId)
@@ -137,6 +138,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: rocketObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
isDefined(opportunityAmountFieldId) &&
@@ -176,6 +178,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: opportunityObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -214,6 +217,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: rocketObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
isDefined(opportunityIdFieldId)
@@ -245,6 +249,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: opportunityObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -278,6 +283,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: companyObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
isDefined(companyIdFieldId) &&
@@ -320,6 +326,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: companyObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -353,6 +360,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: companyObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
isDefined(companyLinkedinLinkFieldId)
@@ -384,6 +392,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: companyObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -414,6 +423,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: personObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
isDefined(personIdFieldId) && isDefined(personCityFieldId)
@@ -450,6 +460,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: personObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -483,6 +494,7 @@ export const getPageLayoutWidgetDataSeeds = (
firstDayOfTheWeek: CalendarStartDay.MONDAY,
},
objectMetadataId: taskObject?.id ?? null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget)
: null,
@@ -508,6 +520,7 @@ export const getPageLayoutWidgetDataSeeds = (
frontComponentId: '6cdf2607-4b28-40e6-8c53-cc06799ddc88',
} as const,
objectMetadataId: null,
overrides: null,
} satisfies SeederFlatPageLayoutWidget,
].filter(isDefined);
@@ -30,6 +30,7 @@ export const seedPageLayoutTabs = async ({
'workspaceId',
'universalIdentifier',
'applicationId',
'overrides',
])
.values(pageLayoutTabs)
.orIgnore()
@@ -42,6 +42,7 @@ export const seedPageLayoutWidgets = async ({
configuration: widget.configuration,
universalIdentifier: v4(),
applicationId: workspaceCustomApplicationId,
overrides: widget.overrides ?? null,
};
});
@@ -61,6 +62,7 @@ export const seedPageLayoutWidgets = async ({
'workspaceId',
'universalIdentifier',
'applicationId',
'overrides',
])
.values(pageLayoutWidgets)
.orIgnore()