Update pageLayout* data models for backend recordPageLayout refactor (#17446)

<img width="814" height="356" alt="Screenshot 2026-01-26 at 16 09 27"
src="https://github.com/user-attachments/assets/91d95a1d-cc33-4bf0-a63e-4d1815030983"
/>
This commit is contained in:
Weiko
2026-01-29 14:39:46 +01:00
committed by GitHub
parent 09de762285
commit 7d69000ab7
31 changed files with 194 additions and 9 deletions
@@ -70,6 +70,8 @@ export class WorkspaceFlatPageLayoutMapCacheService extends WorkspaceCacheProvid
createIdToUniversalIdentifierMap(applications);
const objectMetadataIdToUniversalIdentifierMap =
createIdToUniversalIdentifierMap(objectMetadatas);
const pageLayoutTabIdToUniversalIdentifierMap =
createIdToUniversalIdentifierMap(pageLayoutTabs);
const flatPageLayoutMaps = createEmptyFlatEntityMaps();
@@ -81,6 +83,7 @@ export class WorkspaceFlatPageLayoutMapCacheService extends WorkspaceCacheProvid
},
applicationIdToUniversalIdentifierMap,
objectMetadataIdToUniversalIdentifierMap,
pageLayoutTabIdToUniversalIdentifierMap,
});
addFlatEntityToFlatEntityMapsThroughMutationOrThrow({
@@ -37,5 +37,6 @@ export const fromCreatePageLayoutInputToFlatPageLayoutToCreate = ({
universalIdentifier: pageLayoutId,
applicationId: workspaceCustomApplicationId,
tabIds: [],
defaultTabToFocusOnMobileAndSidePanelId: null,
};
};
@@ -11,6 +11,7 @@ export const transformPageLayoutEntityToFlatPageLayout = ({
entity: pageLayoutEntity,
applicationIdToUniversalIdentifierMap,
objectMetadataIdToUniversalIdentifierMap,
pageLayoutTabIdToUniversalIdentifierMap,
}: FromEntityToFlatEntityArgs<'pageLayout'>): FlatPageLayout => {
const applicationUniversalIdentifier =
applicationIdToUniversalIdentifierMap.get(pageLayoutEntity.applicationId);
@@ -38,6 +39,23 @@ export const transformPageLayoutEntityToFlatPageLayout = ({
}
}
let defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier: string | null =
null;
if (isDefined(pageLayoutEntity.defaultTabToFocusOnMobileAndSidePanelId)) {
defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier =
pageLayoutTabIdToUniversalIdentifierMap.get(
pageLayoutEntity.defaultTabToFocusOnMobileAndSidePanelId,
) ?? null;
if (!isDefined(defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier)) {
throw new FlatEntityMapsException(
`PageLayoutTab with id ${pageLayoutEntity.defaultTabToFocusOnMobileAndSidePanelId} not found for pageLayout ${pageLayoutEntity.id}`,
FlatEntityMapsExceptionCode.ENTITY_NOT_FOUND,
);
}
}
return {
createdAt: pageLayoutEntity.createdAt.toISOString(),
deletedAt: pageLayoutEntity.deletedAt?.toISOString() ?? null,
@@ -50,6 +68,8 @@ export const transformPageLayoutEntityToFlatPageLayout = ({
universalIdentifier: pageLayoutEntity.universalIdentifier,
applicationId: pageLayoutEntity.applicationId,
tabIds: pageLayoutEntity.tabs.map((tab) => tab.id),
defaultTabToFocusOnMobileAndSidePanelId:
pageLayoutEntity.defaultTabToFocusOnMobileAndSidePanelId,
__universal: {
universalIdentifier: pageLayoutEntity.universalIdentifier,
applicationUniversalIdentifier,
@@ -57,6 +77,7 @@ export const transformPageLayoutEntityToFlatPageLayout = ({
tabUniversalIdentifiers: pageLayoutEntity.tabs.map(
(tab) => tab.universalIdentifier,
),
defaultTabToFocusOnMobileAndSidePanelUniversalIdentifier,
},
};
};