1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 09:21:54 +00:00

sysadmin reconstruct user page (#4030)

* sysadmin reconstruct user page

* [system admin] users: refactored it
This commit is contained in:
Leo
2019-10-28 10:29:20 +08:00
committed by Daniel Pan
parent 344f50cbda
commit 852fe1b8ee
35 changed files with 3254 additions and 40 deletions

View File

@@ -0,0 +1,68 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody, ModalFooter, Button, Form, FormGroup, Label, Input } from 'reactstrap';
import { gettext } from '../../../utils/constants';
const propTypes = {
toggle: PropTypes.func.isRequired,
onNameChanged: PropTypes.func.isRequired
};
class SysAdminUserSetNameDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
name: '',
};
}
toggle = () => {
this.props.toggle();
}
handleNameChange = (e) => {
this.setState({name: e.target.value.trim()});
}
handleKeyPress = (e) => {
if (e.key === 'Enter') {
this.handleSubmit();
e.preventDefault();
}
}
handleSubmit = () => {
let { name } = this.state;
this.props.onNameChanged(name);
}
render() {
let { name } = this.state;
return (
<Modal isOpen={true} toggle={this.toggle}>
<ModalHeader toggle={this.toggle}>{gettext('Set user name')}</ModalHeader>
<ModalBody>
<Form>
<FormGroup>
<Input
id="repoName"
onKeyPress={this.handleKeyPress}
value={name}
onChange={this.handleNameChange}
/>
</FormGroup>
</Form>
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.handleSubmit}>{gettext('Submit')}</Button>
</ModalFooter>
</Modal>
);
}
}
SysAdminUserSetNameDialog.propTypes = propTypes;
export default SysAdminUserSetNameDialog;