diff --git a/scm-ui/src/permissions/containers/SinglePermission.js b/scm-ui/src/permissions/containers/SinglePermission.js index a8a0249625..8e7aa256b9 100644 --- a/scm-ui/src/permissions/containers/SinglePermission.js +++ b/scm-ui/src/permissions/containers/SinglePermission.js @@ -10,7 +10,8 @@ import { modifyPermissionReset, deletePermission, getDeletePermissionFailure, - isDeletePermissionPending + isDeletePermissionPending, + deletePermissionReset } from "../modules/permissions"; import connect from "react-redux/es/connect/connect"; import { withRouter } from "react-router-dom"; @@ -31,6 +32,7 @@ type Props = { loading: boolean, error: Error, permissionReset: (string, string, string) => void, + deletePermissionReset: (string, string, string) => void, deletePermission: (Permission, string, string) => void, deleteLoading: boolean }; @@ -60,6 +62,11 @@ class SinglePermission extends React.Component { this.props.repoName, permission.name ); + this.props.deletePermissionReset( + this.props.namespace, + this.props.repoName, + permission.name + ); if (permission) { this.setState({ permission: { @@ -204,6 +211,13 @@ const mapDispatchToProps = dispatch => { repoName: string ) => { dispatch(deletePermission(permission, namespace, repoName)); + }, + deletePermissionReset: ( + namespace: string, + repoName: string, + permissionname: string + ) => { + dispatch(deletePermissionReset(namespace, repoName, permissionname)); } }; }; diff --git a/scm-ui/src/permissions/modules/permissions.js b/scm-ui/src/permissions/modules/permissions.js index 0a120934eb..a7303a190b 100644 --- a/scm-ui/src/permissions/modules/permissions.js +++ b/scm-ui/src/permissions/modules/permissions.js @@ -57,6 +57,9 @@ export const DELETE_PERMISSION_SUCCESS = `${DELETE_PERMISSION}_${ export const DELETE_PERMISSION_FAILURE = `${DELETE_PERMISSION}_${ types.FAILURE_SUFFIX }`; +export const DELETE_PERMISSION_RESET = `${DELETE_PERMISSION}_${ + types.RESET_SUFFIX +}`; const REPOS_URL = "repositories"; const PERMISSIONS_URL = "permissions"; @@ -366,6 +369,16 @@ export function deletePermissionFailure( }; } +export function deletePermissionReset( + namespace: string, + repoName: string, + permissionname: string +) { + return { + type: DELETE_PERMISSION_RESET, + itemId: namespace + "/" + repoName + "/" + permissionname + }; +} function deletePermissionFromState( oldPermissions: PermissionCollection, permission: Permission