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

46 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-08-12 08:45:48 +02:00
import PropTypes from 'prop-types';
2018-07-20 22:14:17 +02:00
import React from 'react';
import { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
2018-08-14 20:28:46 +02:00
import { serverType } from './prop-types';
2018-07-20 22:14:17 +02:00
2018-08-24 12:36:14 +02:00
const propTypes = {
toggle: PropTypes.func.isRequired,
isOpen: PropTypes.bool.isRequired,
server: serverType,
deleteServer: PropTypes.func,
history: PropTypes.shape({
push: PropTypes.func,
}),
2018-08-24 12:36:14 +02:00
};
const DeleteServerModal = ({ server, toggle, isOpen, deleteServer, history }) => {
2018-07-20 22:14:17 +02:00
const closeModal = () => {
deleteServer(server);
toggle();
history.push('/');
};
return (
<Modal isOpen={isOpen} toggle={toggle} centered>
2020-03-05 10:18:33 +01:00
<ModalHeader toggle={toggle}><span className="text-danger">Remove server</span></ModalHeader>
2018-07-20 22:30:54 +02:00
<ModalBody>
2020-03-05 10:18:33 +01:00
<p>Are you sure you want to remove <b>{server ? server.name : ''}</b>?</p>
2018-08-12 08:45:48 +02:00
<p>
2020-03-05 10:18:33 +01:00
<i>
No data will be deleted, only the access to this server will be removed from this host.
You can create it again at any moment.
</i>
2018-08-12 08:45:48 +02:00
</p>
2018-07-20 22:30:54 +02:00
</ModalBody>
2018-07-20 22:14:17 +02:00
<ModalFooter>
<button className="btn btn-link" onClick={toggle}>Cancel</button>
<button className="btn btn-danger" onClick={() => closeModal()}>Delete</button>
</ModalFooter>
</Modal>
);
};
DeleteServerModal.propTypes = propTypes;
export default DeleteServerModal;