From fbed0201aa28c5d0903405f1ab3b9081d807ea2f Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Sat, 23 Mar 2024 18:41:57 +0800 Subject: [PATCH] fix: field permission all fields should be displayed (#3799) --- .../RolesResourcesActions.tsx | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/PermissionManager/RolesResourcesActions.tsx b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/PermissionManager/RolesResourcesActions.tsx index 62c75d996..a47ce4a8d 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/PermissionManager/RolesResourcesActions.tsx +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/PermissionManager/RolesResourcesActions.tsx @@ -51,15 +51,13 @@ export const RolesResourcesActions = connect((props) => { return action?.fields?.includes(fieldName); }; const availableActionsWithFields = availableActions.filter((action) => action.allowConfigureFields); - const fieldPermissions = collectionFields - ?.filter((field) => field.interface) - ?.map((field) => { - const permission = { ...field }; - for (const action of availableActionsWithFields) { - permission[action.name] = inAction(action.name, field.name); - } - return permission; - }); + const fieldPermissions = collectionFields?.map((field) => { + const permission = { ...field }; + for (const action of availableActionsWithFields) { + permission[action.name] = inAction(action.name, field.name); + } + return permission; + }); const toggleAction = (actionName: string) => { if (actionMap[actionName]) { delete actionMap[actionName]; @@ -83,8 +81,7 @@ export const RolesResourcesActions = connect((props) => { }; const allChecked = {}; for (const action of availableActionsWithFields) { - allChecked[action.name] = - collectionFields?.filter((field) => field.interface)?.length === actionMap?.[action.name]?.fields?.length; + allChecked[action.name] = collectionFields?.length === actionMap?.[action.name]?.fields?.length; } return (
@@ -163,7 +160,7 @@ export const RolesResourcesActions = connect((props) => { { dataIndex: ['uiSchema', 'title'], title: t('Field display name'), - render: (value) => compile(value), + render: (value, record) => compile(value) || record.name, }, ...availableActionsWithFields.map((action) => { const checked = allChecked?.[action.name]; @@ -185,7 +182,7 @@ export const RolesResourcesActions = connect((props) => { actionMap[action.name] = item; onChange(Object.values(actionMap)); }} - />{' '} + /> {compile(action.displayName)} ),