df9c4e26b5
## Context "Reset to default" action is rejected by the backend for custom entities because there is no "default" concept for them ## Implementation Grey out the Reset to default action on record page-layout tabs and widgets when the entity either has no applicationId yet (unsaved draft — previously slipped through the existing check), or belongs to the workspace custom application. <img width="926" height="370" alt="Screenshot 2026-04-17 at 18 50 31" src="https://github.com/user-attachments/assets/c7c163f4-17a6-4b69-a66d-90f9085d27a2" />
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import {
|
|
type GridPosition,
|
|
PageLayoutTabLayoutMode,
|
|
WidgetConfigurationType,
|
|
WidgetType,
|
|
} from '~/generated-metadata/graphql';
|
|
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
|
|
|
|
export const createDefaultFrontComponentWidget = (
|
|
id: string,
|
|
pageLayoutTabId: string,
|
|
title: string,
|
|
frontComponentId: string,
|
|
gridPosition: GridPosition,
|
|
): PageLayoutWidget => {
|
|
return {
|
|
__typename: 'PageLayoutWidget',
|
|
id,
|
|
applicationId: '',
|
|
pageLayoutTabId,
|
|
title,
|
|
isActive: true,
|
|
type: WidgetType.FRONT_COMPONENT,
|
|
configuration: {
|
|
__typename: 'FrontComponentConfiguration',
|
|
configurationType: WidgetConfigurationType.FRONT_COMPONENT,
|
|
frontComponentId,
|
|
},
|
|
gridPosition,
|
|
position: {
|
|
__typename: 'PageLayoutWidgetGridPosition',
|
|
layoutMode: PageLayoutTabLayoutMode.GRID,
|
|
row: gridPosition.row,
|
|
column: gridPosition.column,
|
|
rowSpan: gridPosition.rowSpan,
|
|
columnSpan: gridPosition.columnSpan,
|
|
},
|
|
objectMetadataId: null,
|
|
createdAt: new Date().toISOString(),
|
|
updatedAt: new Date().toISOString(),
|
|
deletedAt: null,
|
|
};
|
|
};
|