1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-06-26 07:02:11 +00:00

Fix is a library type is a bug that occurs (#3969)

* Fix is a library type is a bug that occurs

* Click to appear internal-link

* add loading
This commit is contained in:
zxj96 2019-08-12 14:04:14 +08:00 committed by Daniel Pan
parent 34144b5e84
commit a05963b9bf
2 changed files with 19 additions and 11 deletions

View File

@ -6,6 +6,7 @@ import copy from '@seafile/seafile-editor/dist/utils/copy-to-clipboard';
import { gettext } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
import Loading from '../loading';
const propTypes = {
path: PropTypes.string.isRequired,
@ -18,6 +19,7 @@ class InternalLink extends React.Component {
super(props);
this.state = {
smartLink: '',
isInternalLoding: true,
};
}
@ -25,7 +27,8 @@ class InternalLink extends React.Component {
let { repoID, path, direntType } = this.props;
seafileAPI.getInternalLink(repoID, path, direntType).then(res => {
this.setState({
smartLink: res.data.smart_link
smartLink: res.data.smart_link,
isInternalLoding: false
});
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
@ -42,6 +45,9 @@ class InternalLink extends React.Component {
}
render() {
if (this.state.isInternalLoding) {
return(<Loading />);
}
return (
<div>
<p className="tip mb-1">

View File

@ -98,11 +98,13 @@ class ShareDialog extends React.Component {
</NavLink>
</NavItem>
}
<NavItem>
<NavLink className={activeTab === 'internalLink' ? 'active' : ''} onClick={this.toggle.bind(this, 'internalLink')}>
{gettext('Internal Link')}
</NavLink>
</NavItem>
{itemType === 'dir' &&
<NavItem>
<NavLink className={activeTab === 'internalLink' ? 'active' : ''} onClick={this.toggle.bind(this, 'internalLink')}>
{gettext('Internal Link')}
</NavLink>
</NavItem>
}
{enableDirPrivateShare &&
<Fragment>
<NavItem>
@ -139,13 +141,13 @@ class ShareDialog extends React.Component {
/>
</TabPane>
}
<TabPane tabId="internalLink">
{itemType === 'dir' && activeTab === 'internalLink' &&
<InternalLink
path={this.props.itemPath}
repoID={this.props.repoID}
direntType={itemType}
/>
</TabPane>
}
{enableDirPrivateShare &&
<Fragment>
<TabPane tabId="shareToUser">
@ -190,12 +192,12 @@ class ShareDialog extends React.Component {
closeShareDialog={this.props.toggleDialog}
/>
</TabPane>
<TabPane tabId="internalLink">
{activeTab === 'internalLink' &&
<InternalLink
repoID={this.props.repoID}
path={this.props.itemPath}
repoID={this.props.repoID}
/>
</TabPane>
}
</TabContent>
</div>
</Fragment>