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

Add internal links to the dir (#3947)

* Add internal links to the dir

* Indent style
This commit is contained in:
zxj96
2019-08-05 17:31:15 +08:00
committed by Daniel Pan
parent affa4f8d12
commit c7933c7f63
4 changed files with 20 additions and 8 deletions

View File

@@ -11325,9 +11325,9 @@
} }
}, },
"seafile-js": { "seafile-js": {
"version": "0.2.110", "version": "0.2.111",
"resolved": "https://registry.npmjs.org/seafile-js/-/seafile-js-0.2.110.tgz", "resolved": "https://registry.npmjs.org/seafile-js/-/seafile-js-0.2.111.tgz",
"integrity": "sha512-h9Nc/cnUdg4u9TVpTSDMcBZY+xY1B/HRaruZlLqu9TluoCQeXD2lij3KG+yXS1aPgAfEg2gfCMWbDGw9QneE+g==", "integrity": "sha512-PsaU3VUledLrs8guKRm0nJ99s0g3bgQmpvIb00b1ESjdsgRIcyvQsgCrG3fTJQYn+fMdGJaSP1tiDbuOZLoqrA==",
"requires": { "requires": {
"axios": "^0.18.0", "axios": "^0.18.0",
"form-data": "^2.3.2", "form-data": "^2.3.2",

View File

@@ -36,7 +36,7 @@
"react-responsive": "^6.1.2", "react-responsive": "^6.1.2",
"react-select": "^2.4.1", "react-select": "^2.4.1",
"reactstrap": "^6.4.0", "reactstrap": "^6.4.0",
"seafile-js": "^0.2.110", "seafile-js": "^0.2.111",
"socket.io-client": "^2.2.0", "socket.io-client": "^2.2.0",
"sw-precache-webpack-plugin": "0.11.4", "sw-precache-webpack-plugin": "0.11.4",
"unified": "^7.0.0", "unified": "^7.0.0",

View File

@@ -10,6 +10,7 @@ import { Utils } from '../../utils/utils';
const propTypes = { const propTypes = {
path: PropTypes.string.isRequired, path: PropTypes.string.isRequired,
repoID: PropTypes.string.isRequired, repoID: PropTypes.string.isRequired,
direntType: PropTypes.string
}; };
class InternalLink extends React.Component { class InternalLink extends React.Component {
@@ -21,9 +22,8 @@ class InternalLink extends React.Component {
} }
componentDidMount() { componentDidMount() {
let repoID = this.props.repoID; let { repoID, path, direntType } = this.props;
let path = this.props.path; seafileAPI.getInternalLink(repoID, path, direntType).then(res => {
seafileAPI.getInternalLink(repoID, path).then(res => {
this.setState({ this.setState({
smartLink: res.data.smart_link smartLink: res.data.smart_link
}); });

View File

@@ -76,7 +76,7 @@ class ShareDialog extends React.Component {
} }
let activeTab = this.state.activeTab; let activeTab = this.state.activeTab;
const {repoEncrypted, userPerm, enableDirPrivateShare} = this.props; const {repoEncrypted, userPerm, enableDirPrivateShare, itemType} = this.props;
const enableShareLink = !repoEncrypted && canGenerateShareLink; const enableShareLink = !repoEncrypted && canGenerateShareLink;
const enableUploadLink = !repoEncrypted && canGenerateUploadLink && userPerm == 'rw'; const enableUploadLink = !repoEncrypted && canGenerateUploadLink && userPerm == 'rw';
@@ -98,6 +98,11 @@ class ShareDialog extends React.Component {
</NavLink> </NavLink>
</NavItem> </NavItem>
} }
<NavItem>
<NavLink className={activeTab === 'internalLink' ? 'active' : ''} onClick={this.toggle.bind(this, 'internalLink')}>
{gettext('Internal Link')}
</NavLink>
</NavItem>
{enableDirPrivateShare && {enableDirPrivateShare &&
<Fragment> <Fragment>
<NavItem> <NavItem>
@@ -134,6 +139,13 @@ class ShareDialog extends React.Component {
/> />
</TabPane> </TabPane>
} }
<TabPane tabId="internalLink">
<InternalLink
path={this.props.itemPath}
repoID={this.props.repoID}
direntType={itemType}
/>
</TabPane>
{enableDirPrivateShare && {enableDirPrivateShare &&
<Fragment> <Fragment>
<TabPane tabId="shareToUser"> <TabPane tabId="shareToUser">