00209f7e2c
Closes https://github.com/twentyhq/core-team-issues/issues/2215 Closes https://github.com/twentyhq/core-team-issues/issues/2216 Closes https://github.com/twentyhq/core-team-issues/issues/2218 ## Fields widget edition demo https://github.com/user-attachments/assets/08626d70-8fcb-4ae2-9222-10ef57e75f90 ## Dashboards still work https://github.com/user-attachments/assets/aa9a9c45-a0a2-481e-b132-bc52254778da
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { type DraftPageLayout } from '@/page-layout/types/DraftPageLayout';
|
|
import { isDynamicRelationWidget } from '@/page-layout/utils/isDynamicRelationWidget';
|
|
import { type UpdatePageLayoutWithTabsInput } from '~/generated-metadata/graphql';
|
|
|
|
export const convertPageLayoutDraftToUpdateInput = (
|
|
pageLayoutDraft: DraftPageLayout,
|
|
): UpdatePageLayoutWithTabsInput => {
|
|
return {
|
|
name: pageLayoutDraft.name,
|
|
type: pageLayoutDraft.type,
|
|
objectMetadataId: pageLayoutDraft.objectMetadataId ?? null,
|
|
tabs: pageLayoutDraft.tabs.map((tab) => ({
|
|
id: tab.id,
|
|
title: tab.title,
|
|
position: tab.position,
|
|
widgets: tab.widgets
|
|
.filter((widget) => !isDynamicRelationWidget(widget))
|
|
.map((widget) => ({
|
|
id: widget.id,
|
|
pageLayoutTabId: widget.pageLayoutTabId,
|
|
title: widget.title,
|
|
type: widget.type,
|
|
objectMetadataId: widget.objectMetadataId ?? null,
|
|
gridPosition: {
|
|
row: widget.gridPosition.row,
|
|
column: widget.gridPosition.column,
|
|
rowSpan: widget.gridPosition.rowSpan,
|
|
columnSpan: widget.gridPosition.columnSpan,
|
|
},
|
|
configuration: widget.configuration ?? null,
|
|
})),
|
|
})),
|
|
};
|
|
};
|