Link command menu items to specific page layout (#19706)
- Add a `pageLayoutId` foreign key to `CommandMenuItem`, allowing command menu items to be scoped to a specific page layout instead of being globally available - Filter command menu items by the current page layout on the frontend. Items with a `pageLayoutId` only appear when viewing that layout, while items without one remain globally visible - Create an effect to track the current page layout ID - Include a seed example: a "Show Notification" command pinned to the Star history standalone page layout --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
+5
@@ -1114,6 +1114,11 @@ export const ALL_ENTITY_PROPERTIES_CONFIGURATION_BY_METADATA_NAME = {
|
||||
toStringify: false,
|
||||
universalProperty: undefined,
|
||||
},
|
||||
pageLayoutId: {
|
||||
toCompare: false,
|
||||
toStringify: false,
|
||||
universalProperty: 'pageLayoutUniversalIdentifier',
|
||||
},
|
||||
},
|
||||
navigationMenuItem: {
|
||||
type: {
|
||||
|
||||
+3
@@ -50,6 +50,9 @@ export const ALL_MANY_TO_ONE_METADATA_FOREIGN_KEY = {
|
||||
frontComponent: {
|
||||
foreignKey: 'frontComponentId',
|
||||
},
|
||||
pageLayout: {
|
||||
foreignKey: 'pageLayoutId',
|
||||
},
|
||||
},
|
||||
navigationMenuItem: {
|
||||
workspace: null,
|
||||
|
||||
+7
@@ -86,6 +86,13 @@ export const ALL_MANY_TO_ONE_METADATA_RELATIONS = {
|
||||
isNullable: true,
|
||||
universalForeignKey: 'frontComponentUniversalIdentifier',
|
||||
},
|
||||
pageLayout: {
|
||||
metadataName: 'pageLayout',
|
||||
foreignKey: 'pageLayoutId',
|
||||
inverseOneToManyProperty: null,
|
||||
isNullable: true,
|
||||
universalForeignKey: 'pageLayoutUniversalIdentifier',
|
||||
},
|
||||
},
|
||||
navigationMenuItem: {
|
||||
workspace: null,
|
||||
|
||||
+1
@@ -69,6 +69,7 @@ export const ALL_METADATA_REQUIRED_METADATA_FOR_VALIDATION = {
|
||||
commandMenuItem: {
|
||||
objectMetadata: true,
|
||||
frontComponent: true,
|
||||
pageLayout: true,
|
||||
},
|
||||
navigationMenuItem: {
|
||||
objectMetadata: true,
|
||||
|
||||
+1
@@ -6,6 +6,7 @@ exports[`getMetadataRelatedMetadataNames should return related metadata names fo
|
||||
[
|
||||
"objectMetadata",
|
||||
"frontComponent",
|
||||
"pageLayout",
|
||||
]
|
||||
`;
|
||||
|
||||
|
||||
+1
-1
@@ -4,10 +4,10 @@ exports[`sortMetadataNamesChildrenFirst should return metadata names sorted with
|
||||
[
|
||||
"rowLevelPermissionPredicate",
|
||||
"navigationMenuItem",
|
||||
"commandMenuItem",
|
||||
"fieldPermission",
|
||||
"viewField",
|
||||
"viewFilter",
|
||||
"commandMenuItem",
|
||||
"objectPermission",
|
||||
"pageLayoutWidget",
|
||||
"viewSort",
|
||||
|
||||
Reference in New Issue
Block a user