mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
add reset for delete Permission
This commit is contained in:
@@ -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<Props, State> {
|
||||
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));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user