Create the Dashboard record show page (#14423)

Closes https://github.com/twentyhq/core-team-issues/issues/1438

- Reorganized PageLayout module
- Created `DashboardRenderer` and `PageLayoutRenderer`
- Created stories for the `PageLayoutRenderer`
- Refactored the Widget components


https://github.com/user-attachments/assets/27e9ac8f-b237-4c21-8494-3fab6d65af3a
This commit is contained in:
Raphaël Bosi
2025-09-11 18:26:26 +02:00
committed by GitHub
parent 140b416b22
commit e80c552ae7
124 changed files with 1528 additions and 808 deletions
@@ -3,6 +3,7 @@ import { Field, Float, ObjectType } from '@nestjs/graphql';
import { IDField } from '@ptc-org/nestjs-query-graphql';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import { PageLayoutWidgetDTO } from 'src/engine/core-modules/page-layout/dtos/page-layout-widget.dto';
@ObjectType('PageLayoutTab')
export class PageLayoutTabDTO {
@@ -18,6 +19,9 @@ export class PageLayoutTabDTO {
@Field(() => UUIDScalarType, { nullable: false })
pageLayoutId: string;
@Field(() => [PageLayoutWidgetDTO], { nullable: true })
widgets?: PageLayoutWidgetDTO[] | null;
@Field()
createdAt: Date;
@@ -45,7 +45,7 @@ export class PageLayoutService {
workspaceId,
deletedAt: IsNull(),
},
relations: ['tabs'],
relations: ['tabs', 'tabs.widgets'],
});
}
@@ -62,7 +62,7 @@ export class PageLayoutService {
objectMetadataId,
deletedAt: IsNull(),
},
relations: ['tabs'],
relations: ['tabs', 'tabs.widgets'],
});
}
@@ -79,7 +79,7 @@ export class PageLayoutService {
workspaceId,
deletedAt: IsNull(),
},
relations: ['tabs'],
relations: ['tabs', 'tabs.widgets'],
});
if (!isDefined(pageLayout)) {
@@ -86,7 +86,7 @@ describe('PageLayoutService', () => {
workspaceId,
deletedAt: IsNull(),
},
relations: ['tabs'],
relations: ['tabs', 'tabs.widgets'],
});
expect(result).toEqual(expectedPageLayouts);
});
@@ -113,7 +113,7 @@ describe('PageLayoutService', () => {
objectMetadataId,
deletedAt: IsNull(),
},
relations: ['tabs'],
relations: ['tabs', 'tabs.widgets'],
});
expect(result).toEqual(expectedPageLayouts);
});
@@ -130,6 +130,14 @@ describe('PageLayoutService', () => {
const result = await pageLayoutService.findByIdOrThrow(id, workspaceId);
expect(pageLayoutRepository.findOne).toHaveBeenCalledWith({
where: {
id,
workspaceId,
deletedAt: IsNull(),
},
relations: ['tabs', 'tabs.widgets'],
});
expect(result).toEqual(mockPageLayout);
});