forked from chabad360/cockpit-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForceRemoveModal.jsx
33 lines (30 loc) · 1.24 KB
/
ForceRemoveModal.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React, { useState } from 'react';
import { Button } from "@patternfly/react-core/dist/esm/components/Button";
import { Modal } from "@patternfly/react-core/dist/esm/components/Modal";
import { useDialogs } from "dialogs.jsx";
import cockpit from 'cockpit';
const _ = cockpit.gettext;
const ForceRemoveModal = ({ name, reason, handleForceRemove }) => {
const Dialogs = useDialogs();
const [inProgress, setInProgress] = useState(false);
return (
<Modal isOpen
showClose={false}
position="top" variant="medium"
titleIconVariant="warning"
onClose={Dialogs.close}
title={cockpit.format(_("Delete $0?"), name)}
footer={<>
<Button variant="danger" isDisabled={inProgress} isLoading={inProgress}
onClick={() => { setInProgress(true); handleForceRemove().catch(() => setInProgress(false)) }}
>
{_("Force delete")}
</Button>
<Button variant="link" isDisabled={inProgress} onClick={Dialogs.close}>{_("Cancel")}</Button>
</>}
>
{reason}
</Modal>
);
};
export default ForceRemoveModal;