mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
[system admin] users: rewrote user pages & 'ldap users' page (#4216)
This commit is contained in:
@@ -41,6 +41,7 @@ class SysAdminImportUserDialog extends React.Component {
|
||||
}
|
||||
const file = this.fileInputRef.current.files[0];
|
||||
this.props.importUserInBatch(file);
|
||||
this.toggle();
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -49,8 +50,7 @@ class SysAdminImportUserDialog extends React.Component {
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Import users from a .xlsx file')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<a href={`${siteRoot}useradmin/batchadduser/example/`}>{gettext('Download an example file')}</a>
|
||||
<br/>
|
||||
<p><a className="text-secondary small" href={`${siteRoot}useradmin/batchadduser/example/`}>{gettext('Download an example file')}</a></p>
|
||||
<button className="btn btn-outline-primary" onClick={this.openFileInput}>{gettext('Upload file')}</button>
|
||||
<input className="d-none" type="file" onChange={this.uploadFile} ref={this.fileInputRef} />
|
||||
{errorMsg && <Alert color="danger">{errorMsg}</Alert>}
|
||||
|
@@ -53,7 +53,6 @@ class SysAdminSetOrgNameDialog extends React.Component {
|
||||
<FormGroup>
|
||||
<Input
|
||||
type="text"
|
||||
className="form-control"
|
||||
value={name}
|
||||
onKeyPress={this.handleKeyPress}
|
||||
onChange={this.handleInputChange}
|
||||
|
@@ -1,79 +0,0 @@
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Alert, Modal, ModalHeader, ModalBody, ModalFooter, Button, Form, FormGroup, Label, Input } from 'reactstrap';
|
||||
import { gettext } from '../../../utils/constants';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
toggle: PropTypes.func.isRequired,
|
||||
onContactEmailChanged: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class SysAdminUserSetContactEmailDialog extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
contactEmail: '',
|
||||
isSubmitBtnActive: false,
|
||||
errorMsg: '',
|
||||
};
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
this.props.toggle();
|
||||
}
|
||||
|
||||
handleContactEmailChange = (e) => {
|
||||
this.setState({contactEmail: e.target.value.trim()});
|
||||
}
|
||||
|
||||
handleKeyPress = (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
this.handleSubmit();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
let { contactEmail } = this.state;
|
||||
if(Utils.isValidEmail(contactEmail) || contactEmail === '') {
|
||||
this.props.onContactEmailChanged(contactEmail);
|
||||
} else {
|
||||
this.setState({
|
||||
errorMsg: gettext('Contact email invalid.')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let { contactEmail, errorMsg } = this.state;
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Set user contact email')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
<FormGroup>
|
||||
<Label for="repoName">{gettext('Name')}</Label>
|
||||
<Input
|
||||
id="repoName"
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={contactEmail}
|
||||
onChange={this.handleContactEmailChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
{errorMsg && <Alert color="danger">{errorMsg}</Alert>}
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||
<Button color="primary" onClick={this.handleSubmit}>{gettext('Submit')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SysAdminUserSetContactEmailDialog.propTypes = propTypes;
|
||||
|
||||
export default SysAdminUserSetContactEmailDialog;
|
@@ -1,68 +0,0 @@
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Modal, ModalHeader, ModalBody, ModalFooter, Button, Form, FormGroup, Input } from 'reactstrap';
|
||||
import { gettext } from '../../../utils/constants';
|
||||
|
||||
const propTypes = {
|
||||
toggle: PropTypes.func.isRequired,
|
||||
onLoginIDChanged: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class SysAdminUserSetLoginIDDialog extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
loginID: '',
|
||||
};
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
this.props.toggle();
|
||||
}
|
||||
|
||||
handleLoginIDChange = (e) => {
|
||||
this.setState({loginID: e.target.value.trim()});
|
||||
}
|
||||
|
||||
handleKeyPress = (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
this.handleSubmit();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
let { loginID } = this.state;
|
||||
this.props.onLoginIDChanged(loginID);
|
||||
}
|
||||
|
||||
render() {
|
||||
let { loginID } = this.state;
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Set user Login ID')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
<FormGroup>
|
||||
<Input
|
||||
id="repoName"
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={loginID}
|
||||
onChange={this.handleLoginIDChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||
<Button color="primary" onClick={this.handleSubmit}>{gettext('Submit')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SysAdminUserSetLoginIDDialog.propTypes = propTypes;
|
||||
|
||||
export default SysAdminUserSetLoginIDDialog;
|
@@ -1,68 +0,0 @@
|
||||
|
||||
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;
|
@@ -1,88 +0,0 @@
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Alert, Modal, ModalHeader, ModalBody, ModalFooter, Button, Form, FormGroup, Label, Input } from 'reactstrap';
|
||||
import { gettext } from '../../../utils/constants';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
toggle: PropTypes.func.isRequired,
|
||||
onQuotaChanged: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class SysAdminUserSetQuotaDialog extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
quota: '',
|
||||
isSubmitBtnActive: false,
|
||||
errorMsg: '',
|
||||
};
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
this.props.toggle();
|
||||
}
|
||||
|
||||
handleQuotaChange = (e) => {
|
||||
if (!e.target.value.trim()) {
|
||||
this.setState({isSubmitBtnActive: false});
|
||||
} else {
|
||||
this.setState({
|
||||
isSubmitBtnActive: true,
|
||||
errorMsg: ''
|
||||
});
|
||||
}
|
||||
this.setState({quota: e.target.value});
|
||||
}
|
||||
|
||||
handleKeyPress = (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
this.handleSubmit();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
let { quota } = this.state;
|
||||
if(Utils.isInteger(quota) && quota >= 0) {
|
||||
this.props.onQuotaChanged(quota);
|
||||
} else {
|
||||
this.setState({
|
||||
errorMsg: gettext('Invalid quota.')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let { quota, isSubmitBtnActive, errorMsg } = this.state;
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Set quota')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
<FormGroup>
|
||||
<Label for="repoName">{gettext('Name')}</Label>
|
||||
<Input
|
||||
id="repoName"
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={quota}
|
||||
onChange={this.handleQuotaChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
<Alert color="light">{gettext('An integer that is greater than or equal to 0.')}{gettext('Tip: 0 means default limit')}</Alert>
|
||||
{errorMsg && <Alert color="danger">{errorMsg}</Alert>}
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||
<Button color="primary" onClick={this.handleSubmit} disabled={!isSubmitBtnActive}>{gettext('Submit')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SysAdminUserSetQuotaDialog.propTypes = propTypes;
|
||||
|
||||
export default SysAdminUserSetQuotaDialog;
|
@@ -1,71 +0,0 @@
|
||||
|
||||
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,
|
||||
onReferenceIDChanged: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class SysAdminUserSetReferenceIDDialog extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
referenceID: '',
|
||||
isSubmitBtnActive: false,
|
||||
errorMsg: '',
|
||||
};
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
this.props.toggle();
|
||||
}
|
||||
|
||||
handleReferenceIDChange = (e) => {
|
||||
this.setState({referenceID: e.target.value.trim()});
|
||||
}
|
||||
|
||||
handleKeyPress = (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
this.handleSubmit();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
let { referenceID } = this.state;
|
||||
this.props.onReferenceIDChanged(referenceID);
|
||||
}
|
||||
|
||||
render() {
|
||||
let { referenceID } = this.state;
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Set user Reference ID')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
<FormGroup>
|
||||
<Label for="repoName">{gettext('Name')}</Label>
|
||||
<Input
|
||||
id="repoName"
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={referenceID}
|
||||
onChange={this.handleReferenceIDChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||
<Button color="primary" onClick={this.handleSubmit}>{gettext('Submit')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SysAdminUserSetReferenceIDDialog.propTypes = propTypes;
|
||||
|
||||
export default SysAdminUserSetReferenceIDDialog;
|
@@ -0,0 +1,70 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Alert, Modal, ModalHeader, ModalBody, ModalFooter, Button, Form, FormGroup, Input, InputGroup, InputGroupAddon, InputGroupText } from 'reactstrap';
|
||||
import { gettext } from '../../../utils/constants';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
dialogTitle: PropTypes.string.isRequired,
|
||||
updateValue: PropTypes.func.isRequired,
|
||||
toggleDialog: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class UpdateUser extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
value: this.props.value,
|
||||
isSubmitBtnActive: false
|
||||
};
|
||||
}
|
||||
|
||||
handleInputChange = (e) => {
|
||||
const value = e.target.value.trim();
|
||||
this.setState({
|
||||
value: value
|
||||
});
|
||||
}
|
||||
|
||||
handleKeyPress = (e) => {
|
||||
if (e.key == 'Enter') {
|
||||
this.handleSubmit();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
this.props.updateValue(this.state.value);
|
||||
this.props.toggleDialog();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { dialogTitle, toggleDialog } = this.props;
|
||||
return (
|
||||
<Modal isOpen={true} toggle={toggleDialog}>
|
||||
<ModalHeader toggle={toggleDialog}>{this.props.dialogTitle}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
<FormGroup>
|
||||
<Input
|
||||
type="text"
|
||||
value={this.state.value}
|
||||
onKeyPress={this.handleKeyPress}
|
||||
onChange={this.handleInputChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={toggleDialog}>{gettext('Cancel')}</Button>
|
||||
<Button color="primary" onClick={this.handleSubmit}>{gettext('Submit')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateUser.propTypes = propTypes;
|
||||
|
||||
export default UpdateUser;
|
Reference in New Issue
Block a user