2018-08-12 09:45:48 +03:00
|
|
|
import PropTypes from 'prop-types';
|
2018-07-20 23:14:17 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
|
2018-08-14 21:28:46 +03:00
|
|
|
import { serverType } from './prop-types';
|
2018-07-20 23:14:17 +03:00
|
|
|
|
2018-08-24 13:36:14 +03:00
|
|
|
const propTypes = {
|
|
|
|
toggle: PropTypes.func.isRequired,
|
|
|
|
isOpen: PropTypes.bool.isRequired,
|
|
|
|
server: serverType,
|
2018-08-26 00:39:27 +03:00
|
|
|
deleteServer: PropTypes.func,
|
|
|
|
history: PropTypes.shape({
|
|
|
|
push: PropTypes.func,
|
|
|
|
}),
|
2018-08-24 13:36:14 +03:00
|
|
|
};
|
|
|
|
|
2018-12-18 00:18:47 +03:00
|
|
|
const DeleteServerModal = ({ server, toggle, isOpen, deleteServer, history }) => {
|
2018-07-20 23:14:17 +03:00
|
|
|
const closeModal = () => {
|
|
|
|
deleteServer(server);
|
|
|
|
toggle();
|
|
|
|
history.push('/');
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
2018-08-18 15:38:36 +03:00
|
|
|
<Modal isOpen={isOpen} toggle={toggle} centered>
|
2018-07-20 23:30:54 +03:00
|
|
|
<ModalHeader toggle={toggle}><span className="text-danger">Delete server</span></ModalHeader>
|
|
|
|
<ModalBody>
|
|
|
|
<p>Are you sure you want to delete server <b>{server ? server.name : ''}</b>?</p>
|
2018-08-12 09:45:48 +03:00
|
|
|
<p>
|
|
|
|
No data will be deleted, only the access to that server will be removed from this host.
|
|
|
|
You can create it again at any moment.
|
|
|
|
</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>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2018-12-18 00:18:47 +03:00
|
|
|
DeleteServerModal.propTypes = propTypes;
|
2018-08-26 00:39:27 +03:00
|
|
|
|
|
|
|
export default DeleteServerModal;
|