mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-07 09:51:26 +00:00
repair share dialog generator share link bug (#3451)
* repair share dialog generator share link bug * optimized code * repair bug
This commit is contained in:
@@ -8,6 +8,7 @@ import { seafileAPI } from '../../utils/seafile-api';
|
|||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import SharedLinkInfo from '../../models/shared-link-info';
|
import SharedLinkInfo from '../../models/shared-link-info';
|
||||||
import toaster from '../toast';
|
import toaster from '../toast';
|
||||||
|
import Loading from '../loading';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
itemPath: PropTypes.string.isRequired,
|
itemPath: PropTypes.string.isRequired,
|
||||||
@@ -30,6 +31,7 @@ class GenerateShareLink extends React.Component {
|
|||||||
errorInfo: '',
|
errorInfo: '',
|
||||||
sharedLinkInfo: null,
|
sharedLinkInfo: null,
|
||||||
isNoticeMessageShow: false,
|
isNoticeMessageShow: false,
|
||||||
|
isLoading: true,
|
||||||
};
|
};
|
||||||
this.permissions = {
|
this.permissions = {
|
||||||
'can_edit': false,
|
'can_edit': false,
|
||||||
@@ -39,19 +41,20 @@ class GenerateShareLink extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.getShareLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
getShareLink = () => {
|
|
||||||
let path = this.props.itemPath;
|
let path = this.props.itemPath;
|
||||||
let repoID = this.props.repoID;
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.getShareLink(repoID, path).then((res) => {
|
seafileAPI.getShareLink(repoID, path).then((res) => {
|
||||||
if (res.data.length !== 0) {
|
if (res.data.length !== 0) {
|
||||||
let sharedLinkInfo = new SharedLinkInfo(res.data[0]);
|
let sharedLinkInfo = new SharedLinkInfo(res.data[0]);
|
||||||
this.setState({sharedLinkInfo: sharedLinkInfo});
|
this.setState({
|
||||||
|
isLoading: false,
|
||||||
|
sharedLinkInfo: sharedLinkInfo
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setState({isLoading: false});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onPasswordInputChecked = () => {
|
onPasswordInputChecked = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -239,6 +242,10 @@ class GenerateShareLink extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
|
if (this.state.isLoading) {
|
||||||
|
return <Loading />;
|
||||||
|
}
|
||||||
|
|
||||||
let passwordLengthTip = gettext('(at least {passwordLength} characters)');
|
let passwordLengthTip = gettext('(at least {passwordLength} characters)');
|
||||||
passwordLengthTip = passwordLengthTip.replace('{passwordLength}', shareLinkPasswordMinLength);
|
passwordLengthTip = passwordLengthTip.replace('{passwordLength}', shareLinkPasswordMinLength);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user