shlink-web-client/src/servers/DeleteServerModal.tsx

43 lines
1.3 KiB
TypeScript
Raw Normal View History

2018-07-20 23:14:17 +03:00
import { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
import { RouterProps } from 'react-router';
import { ServerWithId } from './data';
2018-07-20 23:14:17 +03:00
export interface DeleteServerModalProps {
server: ServerWithId;
toggle: () => void;
isOpen: boolean;
}
interface DeleteServerModalConnectProps extends DeleteServerModalProps, RouterProps {
deleteServer: (server: ServerWithId) => void;
}
2018-08-24 13:36:14 +03:00
const DeleteServerModal = ({ server, toggle, isOpen, deleteServer, history }: DeleteServerModalConnectProps) => {
2018-07-20 23:14:17 +03:00
const closeModal = () => {
deleteServer(server);
toggle();
history.push('/');
};
return (
<Modal isOpen={isOpen} toggle={toggle} centered>
2020-03-05 12:18:33 +03:00
<ModalHeader toggle={toggle}><span className="text-danger">Remove server</span></ModalHeader>
2018-07-20 23:30:54 +03:00
<ModalBody>
2020-03-05 12:18:33 +03:00
<p>Are you sure you want to remove <b>{server ? server.name : ''}</b>?</p>
2018-08-12 09:45:48 +03:00
<p>
2020-03-05 12:18:33 +03:00
<i>
No data will be deleted, only the access to this server will be removed from this device.
2020-03-05 12:18:33 +03:00
You can create it again at any moment.
</i>
2018-08-12 09:45:48 +03:00
</p>
2018-07-20 23:30:54 +03:00
</ModalBody>
2018-07-20 23:14:17 +03:00
<ModalFooter>
<button className="btn btn-link" onClick={toggle}>Cancel</button>
<button className="btn btn-danger" onClick={() => closeModal()}>Delete</button>
</ModalFooter>
</Modal>
);
};
export default DeleteServerModal;