2018-08-22 08:39:42 +00:00
|
|
|
import React from 'react';
|
2018-09-29 10:32:53 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2018-10-16 06:27:21 +00:00
|
|
|
import { gettext } from '../../utils/constants';
|
2018-08-22 08:39:42 +00:00
|
|
|
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
|
|
|
|
|
2018-09-29 10:32:53 +00:00
|
|
|
const propTypes = {
|
|
|
|
currentNode: PropTypes.object.isRequired,
|
|
|
|
toggleCancel: PropTypes.func.isRequired,
|
|
|
|
handleSubmit: PropTypes.func.isRequired,
|
|
|
|
};
|
2018-08-22 08:39:42 +00:00
|
|
|
|
|
|
|
class Delete extends React.Component {
|
|
|
|
|
|
|
|
toggle = () => {
|
|
|
|
this.props.toggleCancel();
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2020-11-02 05:56:35 +00:00
|
|
|
|
2018-08-22 08:39:42 +00:00
|
|
|
render() {
|
2019-01-27 11:23:46 +00:00
|
|
|
let currentNode = this.props.currentNode;
|
|
|
|
let name = currentNode.object.name;
|
|
|
|
let title = gettext('Delete File');
|
|
|
|
if (currentNode.object.isDir()) {
|
|
|
|
title = gettext('Delete Folder');
|
|
|
|
}
|
2018-08-22 08:39:42 +00:00
|
|
|
return (
|
|
|
|
<Modal isOpen={true} toggle={this.toggle}>
|
2019-01-27 11:23:46 +00:00
|
|
|
<ModalHeader toggle={this.toggle}>{title}</ModalHeader>
|
2018-08-22 08:39:42 +00:00
|
|
|
<ModalBody>
|
2024-06-01 01:09:42 +00:00
|
|
|
<p>{gettext('Are you sure you want to delete')}{' '}<b>{name}</b> ?</p>
|
2018-08-22 08:39:42 +00:00
|
|
|
</ModalBody>
|
|
|
|
<ModalFooter>
|
2019-01-31 09:38:11 +00:00
|
|
|
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
|
|
|
<Button color="primary" onClick={this.props.handleSubmit}>{gettext('Delete')}</Button>
|
2018-08-22 08:39:42 +00:00
|
|
|
</ModalFooter>
|
|
|
|
</Modal>
|
2018-09-29 10:32:53 +00:00
|
|
|
);
|
2018-08-22 08:39:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-29 10:32:53 +00:00
|
|
|
Delete.propTypes = propTypes;
|
|
|
|
|
2018-08-22 08:39:42 +00:00
|
|
|
export default Delete;
|