mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 11:21:29 +00:00
fix share TabPane (#4287)
This commit is contained in:
@@ -51,7 +51,7 @@ class ShareDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getInitialActiveTab = () => {
|
getInitialActiveTab = () => {
|
||||||
const {repoEncrypted, userPerm, enableDirPrivateShare} = this.props;
|
const { repoEncrypted, userPerm, enableDirPrivateShare } = this.props;
|
||||||
const enableShareLink = !repoEncrypted && canGenerateShareLink;
|
const enableShareLink = !repoEncrypted && canGenerateShareLink;
|
||||||
const enableUploadLink = !repoEncrypted && canGenerateUploadLink && userPerm == 'rw';
|
const enableUploadLink = !repoEncrypted && canGenerateUploadLink && userPerm == 'rw';
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ class ShareDialog extends React.Component {
|
|||||||
|
|
||||||
toggle = (tab) => {
|
toggle = (tab) => {
|
||||||
if (this.state.activeTab !== tab) {
|
if (this.state.activeTab !== tab) {
|
||||||
this.setState({activeTab: tab});
|
this.setState({ activeTab: tab });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ class ShareDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let activeTab = this.state.activeTab;
|
let activeTab = this.state.activeTab;
|
||||||
const {repoEncrypted, userPerm, enableDirPrivateShare, itemType} = 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';
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ class ShareDialog extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
<div className="share-dialog-main">
|
<div className="share-dialog-main">
|
||||||
<TabContent activeTab={this.state.activeTab}>
|
<TabContent activeTab={this.state.activeTab}>
|
||||||
{enableShareLink &&
|
{(enableShareLink && activeTab === 'shareLink') &&
|
||||||
<TabPane tabId="shareLink">
|
<TabPane tabId="shareLink">
|
||||||
<GenerateShareLink
|
<GenerateShareLink
|
||||||
itemPath={this.props.itemPath}
|
itemPath={this.props.itemPath}
|
||||||
@@ -141,7 +141,7 @@ class ShareDialog extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
}
|
}
|
||||||
{enableUploadLink &&
|
{(enableUploadLink && activeTab === 'uploadLink') &&
|
||||||
<TabPane tabId="uploadLink">
|
<TabPane tabId="uploadLink">
|
||||||
<GenerateUploadLink
|
<GenerateUploadLink
|
||||||
itemPath={this.props.itemPath}
|
itemPath={this.props.itemPath}
|
||||||
@@ -150,7 +150,7 @@ class ShareDialog extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
}
|
}
|
||||||
{itemType === 'dir' && activeTab === 'internalLink' &&
|
{(itemType === 'dir' && activeTab === 'internalLink') &&
|
||||||
<InternalLink
|
<InternalLink
|
||||||
path={this.props.itemPath}
|
path={this.props.itemPath}
|
||||||
repoID={this.props.repoID}
|
repoID={this.props.repoID}
|
||||||
@@ -159,17 +159,21 @@ class ShareDialog extends React.Component {
|
|||||||
}
|
}
|
||||||
{enableDirPrivateShare &&
|
{enableDirPrivateShare &&
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
{activeTab === 'shareToUser' &&
|
||||||
<TabPane tabId="shareToUser">
|
<TabPane tabId="shareToUser">
|
||||||
<ShareToUser itemType={this.props.itemType} isGroupOwnedRepo={this.props.isGroupOwnedRepo} itemPath={this.props.itemPath} repoID={this.props.repoID} isRepoOwner={this.state.isRepoOwner}/>
|
<ShareToUser itemType={this.props.itemType} isGroupOwnedRepo={this.props.isGroupOwnedRepo} itemPath={this.props.itemPath} repoID={this.props.repoID} isRepoOwner={this.state.isRepoOwner} />
|
||||||
</TabPane>
|
|
||||||
{canInvitePeople &&
|
|
||||||
<TabPane tabId="invitePeople">
|
|
||||||
<ShareToInvitePeople itemPath={this.props.itemPath} repoID={this.props.repoID}/>
|
|
||||||
</TabPane>
|
</TabPane>
|
||||||
}
|
}
|
||||||
|
{activeTab === 'shareToGroup' &&
|
||||||
<TabPane tabId="shareToGroup">
|
<TabPane tabId="shareToGroup">
|
||||||
<ShareToGroup itemType={this.props.itemType} isGroupOwnedRepo={this.props.isGroupOwnedRepo} itemPath={this.props.itemPath} repoID={this.props.repoID} isRepoOwner={this.state.isRepoOwner}/>
|
<ShareToGroup itemType={this.props.itemType} isGroupOwnedRepo={this.props.isGroupOwnedRepo} itemPath={this.props.itemPath} repoID={this.props.repoID} isRepoOwner={this.state.isRepoOwner} />
|
||||||
</TabPane>
|
</TabPane>
|
||||||
|
}
|
||||||
|
{(canInvitePeople && activeTab === 'invitePeople') &&
|
||||||
|
<TabPane tabId="invitePeople">
|
||||||
|
<ShareToInvitePeople itemPath={this.props.itemPath} repoID={this.props.repoID} />
|
||||||
|
</TabPane>
|
||||||
|
}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
}
|
}
|
||||||
</TabContent>
|
</TabContent>
|
||||||
@@ -200,6 +204,7 @@ class ShareDialog extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
<div className="share-dialog-main">
|
<div className="share-dialog-main">
|
||||||
<TabContent activeTab={this.state.activeTab}>
|
<TabContent activeTab={this.state.activeTab}>
|
||||||
|
{activeTab === 'shareLink' &&
|
||||||
<TabPane tabId="shareLink">
|
<TabPane tabId="shareLink">
|
||||||
<GenerateShareLink
|
<GenerateShareLink
|
||||||
itemPath={this.props.itemPath}
|
itemPath={this.props.itemPath}
|
||||||
@@ -208,6 +213,7 @@ class ShareDialog extends React.Component {
|
|||||||
itemType={itemType}
|
itemType={itemType}
|
||||||
/>
|
/>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
|
}
|
||||||
{activeTab === 'internalLink' &&
|
{activeTab === 'internalLink' &&
|
||||||
<InternalLink
|
<InternalLink
|
||||||
path={this.props.itemPath}
|
path={this.props.itemPath}
|
||||||
@@ -225,7 +231,7 @@ class ShareDialog extends React.Component {
|
|||||||
const enableShareLink = !repoEncrypted && canGenerateShareLink;
|
const enableShareLink = !repoEncrypted && canGenerateShareLink;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Modal isOpen={true} style={{maxWidth: '720px'}} className="share-dialog" toggle={this.props.toggleDialog}>
|
<Modal isOpen={true} style={{ maxWidth: '720px' }} className="share-dialog" toggle={this.props.toggleDialog}>
|
||||||
<ModalHeader toggle={this.props.toggleDialog}>{gettext('Share')} <span className="op-target" title={itemName}>{itemName}</span></ModalHeader>
|
<ModalHeader toggle={this.props.toggleDialog}>{gettext('Share')} <span className="op-target" title={itemName}>{itemName}</span></ModalHeader>
|
||||||
<ModalBody className="share-dialog-content">
|
<ModalBody className="share-dialog-content">
|
||||||
{(itemType === 'library' || itemType === 'dir') && this.renderDirContent()}
|
{(itemType === 'library' || itemType === 'dir') && this.renderDirContent()}
|
||||||
|
Reference in New Issue
Block a user