Implement page layout override (#18472)
This commit is contained in:
+1
@@ -10,4 +10,5 @@ export type SeederFlatPageLayoutWidget = Pick<
|
||||
| 'position'
|
||||
| 'configuration'
|
||||
| 'objectMetadataId'
|
||||
| 'overrides'
|
||||
>;
|
||||
|
||||
+10
-1
@@ -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,
|
||||
},
|
||||
];
|
||||
|
||||
+6
@@ -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);
|
||||
|
||||
+13
@@ -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);
|
||||
|
||||
|
||||
+1
@@ -30,6 +30,7 @@ export const seedPageLayoutTabs = async ({
|
||||
'workspaceId',
|
||||
'universalIdentifier',
|
||||
'applicationId',
|
||||
'overrides',
|
||||
])
|
||||
.values(pageLayoutTabs)
|
||||
.orIgnore()
|
||||
|
||||
+2
@@ -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()
|
||||
|
||||
+1
@@ -73,5 +73,6 @@ export const createStandardPageLayoutTabFlatMetadata = ({
|
||||
deletedAt: null,
|
||||
icon,
|
||||
layoutMode,
|
||||
overrides: null,
|
||||
};
|
||||
};
|
||||
|
||||
+1
@@ -108,5 +108,6 @@ export const createStandardPageLayoutWidgetFlatMetadata = ({
|
||||
updatedAt: now,
|
||||
deletedAt: null,
|
||||
conditionalDisplay: conditionalDisplay ?? null,
|
||||
overrides: null,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Column } from 'typeorm';
|
||||
|
||||
import { SyncableEntity } from 'src/engine/workspace-manager/types/syncable-entity.interface';
|
||||
import { type JsonbProperty } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/jsonb-property.type';
|
||||
|
||||
export abstract class OverridableEntity<
|
||||
TOverrides = Record<string, unknown>,
|
||||
> extends SyncableEntity {
|
||||
@Column({ type: 'jsonb', nullable: true })
|
||||
overrides: JsonbProperty<TOverrides> | null;
|
||||
}
|
||||
Reference in New Issue
Block a user