1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

[Linked Devices] added confirmation for 'unlink device' (#4683)

This commit is contained in:
llj
2020-09-28 10:44:12 +08:00
committed by GitHub
parent b86f0af855
commit 39078da3f9
2 changed files with 96 additions and 10 deletions

View File

@@ -0,0 +1,59 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody, ModalFooter, Button, FormGroup, Label, Input } from 'reactstrap';
import { gettext } from '../../utils/constants';
const propTypes = {
executeOperation: PropTypes.func.isRequired,
toggleDialog: PropTypes.func.isRequired
};
class ConfirmUnlinkDevice extends Component {
constructor(props) {
super(props);
this.state = {
isChecked: false
};
}
toggle = () => {
this.props.toggleDialog();
}
executeOperation = () => {
this.toggle();
this.props.executeOperation(this.state.isChecked);
}
onInputChange = (e) => {
this.setState({
isChecked: e.target.checked
});
}
render() {
return (
<Modal isOpen={true} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}>{gettext('Unlink device')}</ModalHeader>
<ModalBody>
<p>{gettext('Are you sure you want to unlink this device?')}</p>
<FormGroup check>
<Label check>
<Input type="checkbox" checked={this.state.isChecked} onChange={this.onInputChange} />
<span>{gettext('Delete files from this device the next time it comes online.')}</span>
</Label>
</FormGroup>
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.executeOperation}>{gettext('Unlink')}</Button>
</ModalFooter>
</Modal>
);
}
}
ConfirmUnlinkDevice.propTypes = propTypes;
export default ConfirmUnlinkDevice;