Combine and clean upgrade commands for record page layouts (#19004)
- Remove the label identifier field for all standard objects as it's a first-class citizen that is displayed specifically in the app; it doesn't make a lot of sense to display it in the Fields widgets - Disable logic that made the label identifier required and in first position - Add all fields for all standard objects in record page layout view fields - Do not include position and ts vector fields in custom objects > [!IMPORTANT] > The command will create Field widgets for all relations. It is consistent to the way the frontend dynamically generates them as of today. We will have to decide which relations we pin as individual Field widgets before the release. (This will likely land in this command or in another one.)
This commit is contained in:
committed by
GitHub
parent
31718d163c
commit
da1b1f1cbc
+18
-6
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { msg, t } from '@lingui/core/macro';
|
||||
import { ALL_METADATA_NAME } from 'twenty-shared/metadata';
|
||||
import { ViewType } from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { findFlatEntityByUniversalIdentifier } from 'src/engine/metadata-modules/flat-entity/utils/find-flat-entity-by-universal-identifier.util';
|
||||
@@ -95,8 +96,9 @@ export class FlatViewFieldValidatorService {
|
||||
}
|
||||
|
||||
if (
|
||||
flatView.type !== ViewType.FIELDS_WIDGET &&
|
||||
flatObjectMetadata.labelIdentifierFieldMetadataUniversalIdentifier ===
|
||||
updatedFlatViewField.fieldMetadataUniversalIdentifier
|
||||
updatedFlatViewField.fieldMetadataUniversalIdentifier
|
||||
) {
|
||||
const otherFlatViewFields =
|
||||
findManyFlatEntityByUniversalIdentifierInUniversalFlatEntityMapsOrThrow(
|
||||
@@ -127,6 +129,7 @@ export class FlatViewFieldValidatorService {
|
||||
flatViewFieldMaps: optimisticFlatViewFieldMaps,
|
||||
flatFieldMetadataMaps,
|
||||
flatObjectMetadataMaps,
|
||||
flatViewMaps,
|
||||
},
|
||||
}: UniversalFlatEntityValidationArgs<
|
||||
typeof ALL_METADATA_NAME.viewField
|
||||
@@ -177,11 +180,18 @@ export class FlatViewFieldValidatorService {
|
||||
flatObjectMetadata.labelIdentifierFieldMetadataUniversalIdentifier ===
|
||||
existingFlatViewField.fieldMetadataUniversalIdentifier
|
||||
) {
|
||||
validationResult.errors.push({
|
||||
code: ViewExceptionCode.INVALID_VIEW_DATA,
|
||||
message: t`Label identifier view field cannot be deleted`,
|
||||
userFriendlyMessage: msg`Label identifier view field cannot be deleted`,
|
||||
const flatView = findFlatEntityByUniversalIdentifier({
|
||||
universalIdentifier: existingFlatViewField.viewUniversalIdentifier,
|
||||
flatEntityMaps: flatViewMaps,
|
||||
});
|
||||
|
||||
if (!isDefined(flatView) || flatView.type !== ViewType.FIELDS_WIDGET) {
|
||||
validationResult.errors.push({
|
||||
code: ViewExceptionCode.INVALID_VIEW_DATA,
|
||||
message: t`Label identifier view field cannot be deleted`,
|
||||
userFriendlyMessage: msg`Label identifier view field cannot be deleted`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return validationResult;
|
||||
@@ -289,8 +299,9 @@ export class FlatViewFieldValidatorService {
|
||||
}
|
||||
|
||||
if (
|
||||
flatView.type !== ViewType.FIELDS_WIDGET &&
|
||||
flatObjectMetadata.labelIdentifierFieldMetadataUniversalIdentifier ===
|
||||
flatViewFieldToValidate.fieldMetadataUniversalIdentifier
|
||||
flatViewFieldToValidate.fieldMetadataUniversalIdentifier
|
||||
) {
|
||||
validationResult.errors.push(
|
||||
...validateLabelIdentifierFieldMetadataIdFlatViewField({
|
||||
@@ -299,6 +310,7 @@ export class FlatViewFieldValidatorService {
|
||||
}),
|
||||
);
|
||||
} else if (
|
||||
flatView.type !== ViewType.FIELDS_WIDGET &&
|
||||
otherFlatViewFields.some(
|
||||
(flatViewField) =>
|
||||
flatViewField.fieldMetadataUniversalIdentifier ===
|
||||
|
||||
Reference in New Issue
Block a user