1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 15:53:28 +00:00
Co-authored-by: lian <lian@seafile.com>
This commit is contained in:
lian
2020-03-19 20:15:26 +08:00
committed by GitHub
parent 8ef7d18c15
commit 2de4d4846e
33 changed files with 4756 additions and 7 deletions

View File

@@ -0,0 +1,45 @@
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 = {
formActionURL: PropTypes.string.isRequired,
csrfToken: PropTypes.string.isRequired,
toggle: PropTypes.func.isRequired
};
class ConfirmDisconnectDingtalk extends Component {
constructor(props) {
super(props);
this.form = React.createRef();
}
disconnect = () => {
this.form.current.submit();
}
render() {
const {formActionURL, csrfToken, toggle} = this.props;
return (
<Modal centered={true} isOpen={true} toggle={toggle}>
<ModalHeader toggle={toggle}>{gettext('Disconnect')}</ModalHeader>
<ModalBody>
<p>{gettext('Are you sure you want to disconnect?')}</p>
<form ref={this.form} className="d-none" method="post" action={formActionURL}>
<input type="hidden" name="csrfmiddlewaretoken" value={csrfToken} />
</form>
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={toggle}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.disconnect}>{gettext('Disconnect')}</Button>
</ModalFooter>
</Modal>
);
}
}
ConfirmDisconnectDingtalk.propTypes = propTypes;
export default ConfirmDisconnectDingtalk;

View File

@@ -0,0 +1,54 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import Loading from '../loading';
const propTypes = {
importDepartmentDialogToggle: PropTypes.func.isRequired,
onImportDepartmentSubmit: PropTypes.func.isRequired,
departmentsCount: PropTypes.number.isRequired,
membersCount: PropTypes.number.isRequired,
departmentName: PropTypes.string.isRequired,
};
class ImportDingtalkDepartmentDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoading : false,
};
}
toggle = () => {
this.props.importDepartmentDialogToggle(null);
};
handleSubmit = () => {
this.props.onImportDepartmentSubmit();
this.setState({ isLoading : true });
};
render() {
const { departmentsCount, membersCount, departmentName } = this.props;
return (
<Modal isOpen={true} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}>
<span>{'导入部门 '}</span><span className="op-target" title={departmentName}>{departmentName}</span>
</ModalHeader>
<ModalBody>
<p>{'将要导入 '}<strong>{departmentsCount}</strong>{' '}<strong>{membersCount}</strong>{' '}</p>
{this.state.isLoading && <Loading/>}
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.toggle}>{'取消'}</Button>
<Button color="primary" onClick={this.handleSubmit}>{'导入'}</Button>
</ModalFooter>
</Modal>
);
}
}
ImportDingtalkDepartmentDialog.propTypes = propTypes;
export default ImportDingtalkDepartmentDialog;