1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 08:28:11 +00:00

after copy success, close the shared dialog (#2774)

This commit is contained in:
杨顺强
2019-01-05 20:40:41 +08:00
committed by Daniel Pan
parent b5cc1ef09e
commit 5bd74364f7
4 changed files with 28 additions and 7 deletions

View File

@@ -10,7 +10,8 @@ import toaster from '../toast';
const propTypes = { const propTypes = {
itemPath: PropTypes.string.isRequired, itemPath: PropTypes.string.isRequired,
repoID: PropTypes.string.isRequired repoID: PropTypes.string.isRequired,
closeShareDialog: PropTypes.func.isRequired,
}; };
class GenerateShareLink extends React.Component { class GenerateShareLink extends React.Component {
@@ -117,12 +118,14 @@ class GenerateShareLink extends React.Component {
let sharedLink = this.state.sharedLinkInfo.link; let sharedLink = this.state.sharedLinkInfo.link;
copy(sharedLink); copy(sharedLink);
toaster.success(gettext('Share link is copied to the clipboard.')); toaster.success(gettext('Share link is copied to the clipboard.'));
this.props.closeShareDialog();
} }
onCopyDownloadLink = () => { onCopyDownloadLink = () => {
let downloadLink = this.state.sharedLinkInfo.link + '?dl'; let downloadLink = this.state.sharedLinkInfo.link + '?dl';
copy(downloadLink); copy(downloadLink);
toaster.success(gettext('Direct download link is copied to the clipboard.')); toaster.success(gettext('Direct download link is copied to the clipboard.'));
this.props.closeShareDialog();
} }
deleteShareLink = () => { deleteShareLink = () => {

View File

@@ -9,7 +9,8 @@ import toaster from '../toast';
const propTypes = { const propTypes = {
itemPath: PropTypes.string.isRequired, itemPath: PropTypes.string.isRequired,
repoID: PropTypes.string.isRequired repoID: PropTypes.string.isRequired,
closeShareDialog: PropTypes.func.isRequired,
}; };
class GenerateUploadLink extends React.Component { class GenerateUploadLink extends React.Component {
@@ -104,6 +105,7 @@ class GenerateUploadLink extends React.Component {
let uploadLink = this.state.sharedUploadInfo.link; let uploadLink = this.state.sharedUploadInfo.link;
copy(uploadLink); copy(uploadLink);
toaster.success(gettext('Upload link is copied to the clipboard.')); toaster.success(gettext('Upload link is copied to the clipboard.'));
this.props.closeShareDialog();
} }
deleteUploadLink = () => { deleteUploadLink = () => {

View File

@@ -62,10 +62,18 @@ class ShareDialog extends React.Component {
<div className="share-dialog-main"> <div className="share-dialog-main">
<TabContent activeTab={this.state.activeTab}> <TabContent activeTab={this.state.activeTab}>
<TabPane tabId="shareLink"> <TabPane tabId="shareLink">
<GenerateShareLink itemPath={this.props.itemPath} repoID={this.props.repoID} /> <GenerateShareLink
itemPath={this.props.itemPath}
repoID={this.props.repoID}
closeShareDialog={this.props.toggleDialog}
/>
</TabPane> </TabPane>
<TabPane tabId="uploadLink"> <TabPane tabId="uploadLink">
<GenerateUploadLink itemPath={this.props.itemPath} repoID={this.props.repoID} /> <GenerateUploadLink
itemPath={this.props.itemPath}
repoID={this.props.repoID}
closeShareDialog={this.props.toggleDialog}
/>
</TabPane> </TabPane>
<TabPane tabId="shareToUser"> <TabPane tabId="shareToUser">
<ShareToUser isGroupOwnedRepo={this.props.isGroupOwnedRepo} itemPath={this.props.itemPath} repoID={this.props.repoID} /> <ShareToUser isGroupOwnedRepo={this.props.isGroupOwnedRepo} itemPath={this.props.itemPath} repoID={this.props.repoID} />
@@ -95,7 +103,11 @@ class ShareDialog extends React.Component {
<div className="share-dialog-main"> <div className="share-dialog-main">
<TabContent activeTab={this.state.activeTab}> <TabContent activeTab={this.state.activeTab}>
<TabPane tabId="shareLink"> <TabPane tabId="shareLink">
<GenerateShareLink itemPath={this.props.itemPath} repoID={this.props.repoID} /> <GenerateShareLink
itemPath={this.props.itemPath}
repoID={this.props.repoID}
closeShareDialog={this.props.toggleDialog}
/>
</TabPane> </TabPane>
</TabContent> </TabContent>
</div> </div>

View File

@@ -160,6 +160,10 @@ class DirentListItem extends React.Component {
this.setState({isShareDialogShow: !this.state.isShareDialogShow}); this.setState({isShareDialogShow: !this.state.isShareDialogShow});
} }
closeSharedDialog = () => {
this.setState({isShareDialogShow: !this.state.isShareDialogShow});
}
onMenuItemClick = (operation) => { onMenuItemClick = (operation) => {
switch(operation) { switch(operation) {
case 'Rename': case 'Rename':
@@ -516,7 +520,7 @@ class DirentListItem extends React.Component {
itemName={dirent.name} itemName={dirent.name}
itemPath={direntPath} itemPath={direntPath}
repoID={this.props.repoID} repoID={this.props.repoID}
toggleDialog={this.onItemShare} toggleDialog={this.closeSharedDialog}
/> />
</ModalPortal> </ModalPortal>
} }