2019-06-15 07:11:35 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2024-12-24 03:20:40 +00:00
|
|
|
import { Modal, ModalBody, ModalFooter, Button } from 'reactstrap';
|
2019-06-15 07:11:35 +00:00
|
|
|
import { gettext } from '../../utils/constants';
|
2024-12-24 03:20:40 +00:00
|
|
|
import SeahubModalHeader from '@/components/common/seahub-modal-header';
|
2019-06-15 07:11:35 +00:00
|
|
|
|
|
|
|
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({
|
2020-11-02 05:56:35 +00:00
|
|
|
btnDisabled: true
|
2019-06-15 07:11:35 +00:00
|
|
|
});
|
|
|
|
this.props.restoreRepo();
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2019-06-15 07:11:35 +00:00
|
|
|
|
|
|
|
render() {
|
2023-09-13 00:40:50 +00:00
|
|
|
const { toggle } = this.props;
|
2019-06-15 07:11:35 +00:00
|
|
|
return (
|
|
|
|
<Modal centered={true} isOpen={true} toggle={toggle}>
|
2024-12-24 03:20:40 +00:00
|
|
|
<SeahubModalHeader toggle={toggle}>{gettext('Restore Library')}</SeahubModalHeader>
|
2019-06-15 07:11:35 +00:00
|
|
|
<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;
|