mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-02 12:18:15 +08:00
fix: field permission all fields should be displayed (#3799)
This commit is contained in:
parent
35a6514993
commit
fbed0201aa
@ -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 (
|
||||
<div>
|
||||
@ -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)}
|
||||
</>
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user