mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
Merge branch '7.1' into master
This commit is contained in:
59
frontend/src/components/dialog/confirm-unlink-device.js
Normal file
59
frontend/src/components/dialog/confirm-unlink-device.js
Normal file
@@ -0,0 +1,59 @@
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Modal, ModalHeader, ModalBody, ModalFooter, Button, FormGroup, Label, Input } from 'reactstrap';
|
||||
import { gettext } from '../../utils/constants';
|
||||
|
||||
const propTypes = {
|
||||
executeOperation: PropTypes.func.isRequired,
|
||||
toggleDialog: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
class ConfirmUnlinkDevice extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isChecked: false
|
||||
};
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
this.props.toggleDialog();
|
||||
}
|
||||
|
||||
executeOperation = () => {
|
||||
this.toggle();
|
||||
this.props.executeOperation(this.state.isChecked);
|
||||
}
|
||||
|
||||
onInputChange = (e) => {
|
||||
this.setState({
|
||||
isChecked: e.target.checked
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Unlink device')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<p>{gettext('Are you sure you want to unlink this device?')}</p>
|
||||
<FormGroup check>
|
||||
<Label check>
|
||||
<Input type="checkbox" checked={this.state.isChecked} onChange={this.onInputChange} />
|
||||
<span>{gettext('Delete files from this device the next time it comes online.')}</span>
|
||||
</Label>
|
||||
</FormGroup>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||
<Button color="primary" onClick={this.executeOperation}>{gettext('Unlink')}</Button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ConfirmUnlinkDevice.propTypes = propTypes;
|
||||
|
||||
export default ConfirmUnlinkDevice;
|
@@ -30,7 +30,7 @@ class AddOrgUserDialog extends React.Component {
|
||||
if (isValid) {
|
||||
let { email, name, password } = this.state;
|
||||
this.setState({isAddingUser: true});
|
||||
this.props.handleSubmit(email, name, password);
|
||||
this.props.handleSubmit(email, name.trim(), password);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class AddOrgUserDialog extends React.Component {
|
||||
}
|
||||
|
||||
inputName = (e) => {
|
||||
let name = e.target.value.trim();
|
||||
let name = e.target.value;
|
||||
this.setState({name: name});
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ class AddOrgUserDialog extends React.Component {
|
||||
this.setState({errMessage: errMessage});
|
||||
return false;
|
||||
}
|
||||
let name = this.state.name;
|
||||
let name = this.state.name.trim();
|
||||
if (!name.length) {
|
||||
errMessage = gettext('Name is required');
|
||||
this.setState({errMessage: errMessage});
|
||||
|
@@ -4,11 +4,13 @@ import moment from 'moment';
|
||||
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
|
||||
import { Link } from '@reach/router';
|
||||
import { Utils } from '../../utils/utils';
|
||||
import { gettext, siteRoot, isPro, username, folderPermEnabled, isSystemStaff } from '../../utils/constants';
|
||||
import { gettext, siteRoot, isPro, username, folderPermEnabled, isSystemStaff, enableResetEncryptedRepoPassword, isEmailConfigured } from '../../utils/constants';
|
||||
import ModalPortal from '../../components/modal-portal';
|
||||
import ShareDialog from '../../components/dialog/share-dialog';
|
||||
import LibSubFolderPermissionDialog from '../../components/dialog/lib-sub-folder-permission-dialog';
|
||||
import DeleteRepoDialog from '../../components/dialog/delete-repo-dialog';
|
||||
import ChangeRepoPasswordDialog from '../../components/dialog/change-repo-password-dialog';
|
||||
import ResetEncryptedRepoPasswordDialog from '../../components/dialog/reset-encrypted-repo-password-dialog';
|
||||
import Rename from '../rename';
|
||||
import { seafileAPI } from '../../utils/seafile-api';
|
||||
import LibHistorySettingDialog from '../dialog/lib-history-setting-dialog';
|
||||
@@ -46,6 +48,8 @@ class SharedRepoListItem extends React.Component {
|
||||
isAPITokenDialogShow: false,
|
||||
isRepoShareUploadLinksDialogOpen: false,
|
||||
isRepoDeleted: false,
|
||||
isChangePasswordDialogShow: false,
|
||||
isResetPasswordDialogShow: false
|
||||
};
|
||||
this.isDeparementOnwerGroupMember = false;
|
||||
}
|
||||
@@ -141,6 +145,12 @@ class SharedRepoListItem extends React.Component {
|
||||
case 'Share Links Admin':
|
||||
this.toggleRepoShareUploadLinksDialog();
|
||||
break;
|
||||
case 'Change Password':
|
||||
this.onChangePasswordToggle();
|
||||
break;
|
||||
case 'Reset Password':
|
||||
this.onResetPasswordToggle();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -231,6 +241,14 @@ class SharedRepoListItem extends React.Component {
|
||||
this.setState({isAPITokenDialogShow: !this.state.isAPITokenDialogShow});
|
||||
}
|
||||
|
||||
onChangePasswordToggle = () => {
|
||||
this.setState({isChangePasswordDialogShow: !this.state.isChangePasswordDialogShow});
|
||||
}
|
||||
|
||||
onResetPasswordToggle = () => {
|
||||
this.setState({isResetPasswordDialogShow: !this.state.isResetPasswordDialogShow});
|
||||
}
|
||||
|
||||
translateMenuItem = (menuItem) => {
|
||||
let translateResult = '';
|
||||
switch(menuItem) {
|
||||
@@ -255,6 +273,12 @@ class SharedRepoListItem extends React.Component {
|
||||
case 'Share Links Admin':
|
||||
translateResult = gettext('Share Links Admin');
|
||||
break;
|
||||
case 'Change Password':
|
||||
translateResult = gettext('Change Password');
|
||||
break;
|
||||
case 'Reset Password':
|
||||
translateResult = gettext('Reset Password');
|
||||
break;
|
||||
case 'API Token':
|
||||
translateResult = 'API Token'; // translation is not needed here
|
||||
break;
|
||||
@@ -280,7 +304,14 @@ class SharedRepoListItem extends React.Component {
|
||||
if (folderPermEnabled) {
|
||||
operations.push('Folder Permission');
|
||||
}
|
||||
operations.push('Share Links Admin', 'History Setting', 'API Token', 'Details');
|
||||
operations.push('Share Links Admin');
|
||||
if (repo.encrypted) {
|
||||
operations.push('Change Password');
|
||||
}
|
||||
if (repo.encrypted && enableResetEncryptedRepoPassword && isEmailConfigured) {
|
||||
operations.push('Reset Password');
|
||||
}
|
||||
operations.push('History Setting', 'API Token', 'Details');
|
||||
} else {
|
||||
operations.push('Unshare');
|
||||
}
|
||||
@@ -538,6 +569,23 @@ class SharedRepoListItem extends React.Component {
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
{this.state.isChangePasswordDialogShow && (
|
||||
<ModalPortal>
|
||||
<ChangeRepoPasswordDialog
|
||||
repoID={repo.repo_id}
|
||||
repoName={repo.repo_name}
|
||||
toggleDialog={this.onChangePasswordToggle}
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
{this.state.isResetPasswordDialogShow && (
|
||||
<ModalPortal>
|
||||
<ResetEncryptedRepoPasswordDialog
|
||||
repoID={repo.repo_id}
|
||||
toggleDialog={this.onResetPasswordToggle}
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user