mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
[repo snapshot] rewrote it with react
This commit is contained in:
46
frontend/src/components/dialog/confirm-restore-repo.js
Normal file
46
frontend/src/components/dialog/confirm-restore-repo.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
|
||||
import { gettext } from '../../utils/constants';
|
||||
|
||||
const propTypes = {
|
||||
restoreRepo: PropTypes.func.isRequired,
|
||||
toggle: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class ConfirmRestoreRepo extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
btnDisabled: false
|
||||
};
|
||||
}
|
||||
|
||||
action = () => {
|
||||
this.setState({
|
||||
btnDisabled: true
|
||||
});
|
||||
this.props.restoreRepo();
|
||||
}
|
||||
|
||||
render() {
|
||||
const {formActionURL, csrfToken, toggle} = this.props;
|
||||
return (
|
||||
<Modal centered={true} isOpen={true} toggle={toggle}>
|
||||
<ModalHeader toggle={toggle}>{gettext('Restore Library')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<p>{gettext('Are you sure you want to restore this library?')}</p>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={toggle}>{gettext('Cancel')}</Button>
|
||||
<Button color="primary" onClick={this.action} disabled={this.state.btnDisabled}>{gettext('Restore')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ConfirmRestoreRepo.propTypes = propTypes;
|
||||
|
||||
export default ConfirmRestoreRepo;
|
Reference in New Issue
Block a user