1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 10:26:17 +00:00

Merge branch '8.0'

This commit is contained in:
lian
2021-07-03 13:22:03 +08:00
102 changed files with 10601 additions and 9458 deletions

View File

@@ -57,7 +57,7 @@ class UpdateWebdavPassword extends Component {
<ModalHeader toggle={toggle}>{gettext('WebDav Password')}</ModalHeader>
<ModalBody>
<InputGroup className="">
<Input type={this.state.isPasswordVisible ? 'text' : 'password'} value={this.state.password} onChange={this.handleInputChange} />
<Input type={this.state.isPasswordVisible ? 'text' : 'password'} value={this.state.password} onChange={this.handleInputChange} autoComplete="new-password"/>
<InputGroupAddon addonType="append">
<Button onClick={this.togglePasswordVisible}><i className={`fas ${this.state.isPasswordVisible ? 'fa-eye': 'fa-eye-slash'}`}></i></Button>
<Button onClick={this.generatePassword}><i className="fas fa-magic"></i></Button>

View File

@@ -66,6 +66,7 @@ class DirGridView extends React.Component {
userPerm={this.props.userPerm}
enableDirPrivateShare={this.props.enableDirPrivateShare}
direntList={this.props.direntList}
fullDirentList={this.props.fullDirentList}
onAddFile={this.props.onAddFile}
onItemClick={this.props.onItemClick}
onItemDelete={this.props.onItemDelete}

View File

@@ -76,6 +76,7 @@ class DirListView extends React.Component {
userPerm={this.props.userPerm}
enableDirPrivateShare={this.props.enableDirPrivateShare}
direntList={this.props.direntList}
fullDirentList={this.props.fullDirentList}
sortBy={this.props.sortBy}
sortOrder={this.props.sortOrder}
sortItems={this.props.sortItems}

View File

@@ -313,7 +313,7 @@ class DirentGridView extends React.Component{
}
showImagePopup = (curItem) => {
let items = this.props.direntList.filter((item) => {
let items = this.props.fullDirentList.filter((item) => {
return Utils.imageCheck(item.name);
});

View File

@@ -169,7 +169,7 @@ class DirentListView extends React.Component {
}
showImagePopup = (curItem) => {
let items = this.props.direntList.filter((item) => {
let items = this.props.fullDirentList.filter((item) => {
return Utils.imageCheck(item.name);
});

View File

@@ -1,4 +1,5 @@
import React from 'react';
import ModalPortal from '../modal-portal';
import { gettext } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
@@ -9,10 +10,15 @@ class WebAPIAuthToken extends React.Component {
constructor(props) {
super(props);
this.state = {
authToken: '******'
authToken: '',
isAuthTokenVisible: false,
};
}
componentDidMount() {
this.getAuthToken();
}
getAuthToken = () => {
seafileAPI.getAuthTokenBySession().then((res) => {
this.setState({
@@ -24,16 +30,58 @@ class WebAPIAuthToken extends React.Component {
});
}
createAuthToken = () => {
seafileAPI.createAuthTokenBySession().then((res) => {
this.setState({
authToken: res.data.token,
isAuthTokenVisible: false
});
toaster.success(gettext('Success'));
}).catch((error) => {
let errorMsg = Utils.getErrorMsg(error);
toaster.danger(errorMsg);
});
}
deleteAuthToken = () => {
seafileAPI.deleteAuthTokenBySession().then((res) => {
this.setState({
authToken: '',
isAuthTokenVisible: false
});
toaster.success(gettext('Success'));
}).catch((error) => {
let errorMsg = Utils.getErrorMsg(error);
toaster.danger(errorMsg);
});
}
toggleAuthTokenVisible = () => {
this.setState({
isAuthTokenVisible: !this.state.isAuthTokenVisible
});
}
render() {
const { authToken } = this.state;
const { authToken, isAuthTokenVisible } = this.state;
return (
<div id="get-auth-token" className="setting-item">
<h3 className="setting-item-heading">{gettext('Web API Auth Token')}</h3>
<div className="d-flex align-items-center">
<input type="text" readOnly={true} value={authToken} className="form-control mr-2 col-sm-5" />
<button className="btn btn-outline-primary" onClick={this.getAuthToken}>{gettext('Get')}</button>
<React.Fragment>
<div id="get-auth-token" className="setting-item">
<h3 className="setting-item-heading">{gettext('Web API Auth Token')}</h3>
{authToken ? (
<React.Fragment>
<div className="d-flex align-items-center">
<label className="m-0 mr-2">{gettext('Token:')}</label>
<input className="border-0 mr-1" type="text" value={isAuthTokenVisible ? authToken : '****************************************'} readOnly={true} size={Math.max(authToken.length, 10)} />
<span onClick={this.toggleAuthTokenVisible} className={`eye-icon fas ${this.state.isAuthTokenVisible ? 'fa-eye': 'fa-eye-slash'}`}></span>
</div>
<button className="btn btn-outline-primary mt-2" onClick={this.deleteAuthToken}>{gettext('Delete')}</button>
</React.Fragment>
) : (
<button className="btn btn-outline-primary" onClick={this.createAuthToken}>{gettext('Generate')}</button>
)}
</div>
</div>
</React.Fragment>
);
}
}