mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
add delete button
This commit is contained in:
@@ -11,7 +11,12 @@ type Props = {
|
|||||||
name: string,
|
name: string,
|
||||||
confirmDialog?: boolean,
|
confirmDialog?: boolean,
|
||||||
t: string => string,
|
t: string => string,
|
||||||
deletePermission: (permission: Permission, namespace: string, name: string) => void
|
deletePermission: (
|
||||||
|
permission: Permission,
|
||||||
|
namespace: string,
|
||||||
|
name: string
|
||||||
|
) => void,
|
||||||
|
loading: boolean
|
||||||
};
|
};
|
||||||
|
|
||||||
class DeletePermissionButton extends React.Component<Props> {
|
class DeletePermissionButton extends React.Component<Props> {
|
||||||
@@ -20,7 +25,11 @@ class DeletePermissionButton extends React.Component<Props> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
deletePermission = () => {
|
deletePermission = () => {
|
||||||
this.props.deletePermission(this.props.permission, this.props.namespace, this.props.name);
|
this.props.deletePermission(
|
||||||
|
this.props.permission,
|
||||||
|
this.props.namespace,
|
||||||
|
this.props.name
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
confirmDelete = () => {
|
confirmDelete = () => {
|
||||||
@@ -46,13 +55,19 @@ class DeletePermissionButton extends React.Component<Props> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { confirmDialog, t } = this.props;
|
const { confirmDialog, loading, t } = this.props;
|
||||||
const action = confirmDialog ? this.confirmDelete : this.deletePermission;
|
const action = confirmDialog ? this.confirmDelete : this.deletePermission;
|
||||||
|
|
||||||
if (!this.isDeletable()) {
|
if (!this.isDeletable()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return <DeleteButton label={t("delete-permission-button.label")} action={action} />;
|
return (
|
||||||
|
<DeleteButton
|
||||||
|
label={t("delete-permission-button.label")}
|
||||||
|
action={action}
|
||||||
|
loading={loading}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user