dashboard workspace standard seeds (#16962)
# Introduction In this pull request we're introducing new standard page layout, tabs and widget ( 1 page layout, 1 tab and 8 widgets ) and also a new opportunity field Also now prefilling new records, 6 opportunities and a dashboard. ## Standard declaration ### New workspace creation Relies on existing standard declaration builder ### Backfill command We've been hacking through the standard builder in order to extract only the standard page layout entities, updated their entity dependencies to match the workspace ids so the validation passes ## Remark - Refactored the `PageLayoutWidget` configuration type to be dynamically typed through a generic discriminated union --------- Co-authored-by: prastoin <paul@twenty.com>
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@ export const deleteFlatEntityFromFlatEntityMapsOrThrow = <
|
||||
);
|
||||
|
||||
if (
|
||||
isDefined(stillPresentUniversalIdentifiers) ||
|
||||
!isDefined(stillPresentUniversalIdentifiers) ||
|
||||
isEmpty(stillPresentUniversalIdentifiers)
|
||||
) {
|
||||
return undefined;
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import {
|
||||
FlatEntityMapsException,
|
||||
FlatEntityMapsExceptionCode,
|
||||
} from 'src/engine/metadata-modules/flat-entity/exceptions/flat-entity-maps.exception';
|
||||
import { type FlatEntityMaps } from 'src/engine/metadata-modules/flat-entity/types/flat-entity-maps.type';
|
||||
import { type SyncableFlatEntity } from 'src/engine/metadata-modules/flat-entity/types/flat-entity.type';
|
||||
import { findFlatEntityByUniversalIdentifier } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-universal-identifier.util';
|
||||
|
||||
export type FindFlatEntityByUniversalIdentifierOrThrowArgs<
|
||||
T extends SyncableFlatEntity,
|
||||
> = {
|
||||
flatEntityMaps: FlatEntityMaps<T>;
|
||||
universalIdentifier: string;
|
||||
};
|
||||
|
||||
export const findFlatEntityByUniversalIdentifierOrThrow = <
|
||||
T extends SyncableFlatEntity,
|
||||
>({
|
||||
flatEntityMaps,
|
||||
universalIdentifier,
|
||||
}: FindFlatEntityByUniversalIdentifierOrThrowArgs<T>): T => {
|
||||
const flatEntity = findFlatEntityByUniversalIdentifier({
|
||||
flatEntityMaps,
|
||||
universalIdentifier,
|
||||
});
|
||||
|
||||
if (!isDefined(flatEntity)) {
|
||||
throw new FlatEntityMapsException(
|
||||
`Could not find flat entity with universal identifier ${universalIdentifier}`,
|
||||
FlatEntityMapsExceptionCode.ENTITY_NOT_FOUND,
|
||||
);
|
||||
}
|
||||
|
||||
return flatEntity;
|
||||
};
|
||||
Reference in New Issue
Block a user