mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
console: fixed checkbox logic for other types than select on permissions pages
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5794 GitOrigin-RevId: 4b214df3856e0320d0c2b0eda0a44a78ff9bbab5
This commit is contained in:
parent
0af8514198
commit
ff65de1df4
@ -55,6 +55,7 @@ import {
|
||||
PERM_SET_FILTER,
|
||||
PERM_SET_FILTER_SAME_AS,
|
||||
PERM_TOGGLE_FIELD,
|
||||
PERM_TOGGLE_SELECT_FIELD,
|
||||
PERM_TOGGLE_ALL_FIELDS,
|
||||
PERM_ALLOW_ALL,
|
||||
PERM_TOGGLE_MODIFY_LIMIT,
|
||||
@ -417,7 +418,7 @@ const modifyReducer = (tableName, schemas, modifyStateOrig, action) => {
|
||||
|
||||
return returnState;
|
||||
|
||||
case PERM_TOGGLE_FIELD:
|
||||
case PERM_TOGGLE_SELECT_FIELD:
|
||||
const tablePrimaryKeys = getPrimaryKeysFromTable(schemas, modifyState);
|
||||
return produce(modifyState, draft => {
|
||||
const newPermissionsState = updatePermissionsState(
|
||||
@ -441,6 +442,22 @@ const modifyReducer = (tableName, schemas, modifyStateOrig, action) => {
|
||||
);
|
||||
});
|
||||
|
||||
case PERM_TOGGLE_FIELD:
|
||||
return {
|
||||
...modifyState,
|
||||
permissionsState: {
|
||||
...updatePermissionsState(
|
||||
modifyState.permissionsState,
|
||||
action.fieldType,
|
||||
toggleField(
|
||||
modifyState.permissionsState[modifyState.permissionsState.query],
|
||||
action.fieldName,
|
||||
action.fieldType
|
||||
)
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
case PERM_REMOVE_ACCESS:
|
||||
return {
|
||||
...modifyState,
|
||||
|
@ -28,6 +28,7 @@ export const PERM_SET_FILTER_TYPE = 'ModifyTable/PERM_SET_FILTER_TYPE';
|
||||
export const PERM_SET_FILTER = 'ModifyTable/PERM_SET_FILTER';
|
||||
export const PERM_SET_FILTER_SAME_AS = 'ModifyTable/PERM_SET_FILTER_SAME_AS';
|
||||
export const PERM_TOGGLE_FIELD = 'ModifyTable/PERM_TOGGLE_FIELD';
|
||||
export const PERM_TOGGLE_SELECT_FIELD = 'ModifyTable/PERM_TOGGLE_SELECT_FIELD';
|
||||
export const PERM_TOGGLE_ALL_FIELDS = 'ModifyTable/PERM_TOGGLE_ALL_FIELDS';
|
||||
export const PERM_ALLOW_ALL = 'ModifyTable/PERM_ALLOW_ALL';
|
||||
export const PERM_TOGGLE_ENABLE_LIMIT = 'ModifyTable/PERM_TOGGLE_ENABLE_LIMIT';
|
||||
@ -89,6 +90,11 @@ const permToggleField = (fieldType, fieldName) => ({
|
||||
fieldType,
|
||||
fieldName,
|
||||
});
|
||||
const permToggleSelectField = (fieldType, fieldName) => ({
|
||||
type: PERM_TOGGLE_SELECT_FIELD,
|
||||
fieldType,
|
||||
fieldName,
|
||||
});
|
||||
const permToggleAllFields = allFields => ({
|
||||
type: PERM_TOGGLE_ALL_FIELDS,
|
||||
allFields,
|
||||
@ -881,6 +887,7 @@ export {
|
||||
permSetFilter,
|
||||
permSetFilterSameAs,
|
||||
permToggleField,
|
||||
permToggleSelectField,
|
||||
permToggleAllFields,
|
||||
permCloseEdit,
|
||||
permSetRoleName,
|
||||
|
@ -33,6 +33,7 @@ import {
|
||||
X_HASURA_CONST,
|
||||
PERM_UPDATE_QUERY_ROOT_FIELDS,
|
||||
PERM_UPDATE_SUBSCRIPTION_ROOT_FIELDS,
|
||||
permToggleSelectField,
|
||||
} from './Actions';
|
||||
import {
|
||||
RootFieldPermissions,
|
||||
@ -960,6 +961,9 @@ class Permissions extends Component {
|
||||
const onColumnClick = fieldType => e => {
|
||||
const columnName = e.target.value;
|
||||
const isChecked = e.target.checked;
|
||||
if (this.props.permissionsState.query !== 'select') {
|
||||
return dispatch(permToggleField(fieldType, columnName));
|
||||
}
|
||||
|
||||
const allPrimaryKeysSelected = hasSelectedTablePrimaryKeyFromMetadata(
|
||||
this.props
|
||||
@ -989,7 +993,7 @@ class Permissions extends Component {
|
||||
});
|
||||
return;
|
||||
}
|
||||
dispatch(permToggleField(fieldType, columnName));
|
||||
dispatch(permToggleSelectField(fieldType, columnName));
|
||||
};
|
||||
|
||||
const getAllFields = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user