mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
add reset for delete Permission
This commit is contained in:
@@ -10,7 +10,8 @@ import {
|
|||||||
modifyPermissionReset,
|
modifyPermissionReset,
|
||||||
deletePermission,
|
deletePermission,
|
||||||
getDeletePermissionFailure,
|
getDeletePermissionFailure,
|
||||||
isDeletePermissionPending
|
isDeletePermissionPending,
|
||||||
|
deletePermissionReset
|
||||||
} from "../modules/permissions";
|
} from "../modules/permissions";
|
||||||
import connect from "react-redux/es/connect/connect";
|
import connect from "react-redux/es/connect/connect";
|
||||||
import { withRouter } from "react-router-dom";
|
import { withRouter } from "react-router-dom";
|
||||||
@@ -31,6 +32,7 @@ type Props = {
|
|||||||
loading: boolean,
|
loading: boolean,
|
||||||
error: Error,
|
error: Error,
|
||||||
permissionReset: (string, string, string) => void,
|
permissionReset: (string, string, string) => void,
|
||||||
|
deletePermissionReset: (string, string, string) => void,
|
||||||
deletePermission: (Permission, string, string) => void,
|
deletePermission: (Permission, string, string) => void,
|
||||||
deleteLoading: boolean
|
deleteLoading: boolean
|
||||||
};
|
};
|
||||||
@@ -60,6 +62,11 @@ class SinglePermission extends React.Component<Props, State> {
|
|||||||
this.props.repoName,
|
this.props.repoName,
|
||||||
permission.name
|
permission.name
|
||||||
);
|
);
|
||||||
|
this.props.deletePermissionReset(
|
||||||
|
this.props.namespace,
|
||||||
|
this.props.repoName,
|
||||||
|
permission.name
|
||||||
|
);
|
||||||
if (permission) {
|
if (permission) {
|
||||||
this.setState({
|
this.setState({
|
||||||
permission: {
|
permission: {
|
||||||
@@ -204,6 +211,13 @@ const mapDispatchToProps = dispatch => {
|
|||||||
repoName: string
|
repoName: string
|
||||||
) => {
|
) => {
|
||||||
dispatch(deletePermission(permission, namespace, repoName));
|
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}_${
|
export const DELETE_PERMISSION_FAILURE = `${DELETE_PERMISSION}_${
|
||||||
types.FAILURE_SUFFIX
|
types.FAILURE_SUFFIX
|
||||||
}`;
|
}`;
|
||||||
|
export const DELETE_PERMISSION_RESET = `${DELETE_PERMISSION}_${
|
||||||
|
types.RESET_SUFFIX
|
||||||
|
}`;
|
||||||
|
|
||||||
const REPOS_URL = "repositories";
|
const REPOS_URL = "repositories";
|
||||||
const PERMISSIONS_URL = "permissions";
|
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(
|
function deletePermissionFromState(
|
||||||
oldPermissions: PermissionCollection,
|
oldPermissions: PermissionCollection,
|
||||||
permission: Permission
|
permission: Permission
|
||||||
|
|||||||
Reference in New Issue
Block a user