1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-06-26 15:12:32 +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 { gettext } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api'; import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils'; import { Utils } from '../../utils/utils';
import Loading from '../loading';
const propTypes = { const propTypes = {
path: PropTypes.string.isRequired, path: PropTypes.string.isRequired,
@ -18,6 +19,7 @@ class InternalLink extends React.Component {
super(props); super(props);
this.state = { this.state = {
smartLink: '', smartLink: '',
isInternalLoding: true,
}; };
} }
@ -25,7 +27,8 @@ class InternalLink extends React.Component {
let { repoID, path, direntType } = this.props; let { repoID, path, direntType } = this.props;
seafileAPI.getInternalLink(repoID, path, direntType).then(res => { seafileAPI.getInternalLink(repoID, path, direntType).then(res => {
this.setState({ this.setState({
smartLink: res.data.smart_link smartLink: res.data.smart_link,
isInternalLoding: false
}); });
}).catch(error => { }).catch(error => {
let errMessage = Utils.getErrorMsg(error); let errMessage = Utils.getErrorMsg(error);
@ -42,6 +45,9 @@ class InternalLink extends React.Component {
} }
render() { render() {
if (this.state.isInternalLoding) {
return(<Loading />);
}
return ( return (
<div> <div>
<p className="tip mb-1"> <p className="tip mb-1">

View File

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