mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
improve upload interactive (#3941)
* improve upload interactive * improve code
This commit is contained in:
@@ -24,7 +24,16 @@ class DirPath extends React.Component {
|
||||
this.props.onPathClick(path);
|
||||
}
|
||||
|
||||
onTabNavClick = (tabName, id) => {
|
||||
onTabNavClick = (e, tabName, id) => {
|
||||
if (window.uploader &&
|
||||
window.uploader.isUploadProgressDialogShow &&
|
||||
window.uploader.totalProgress !== 100) {
|
||||
if (!window.confirm(gettext('A file is being uploaded. Are you sure you want to leave this page?'))) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
window.uploader.isUploadProgressDialogShow = false;
|
||||
}
|
||||
this.props.onTabNavClick(tabName, id);
|
||||
}
|
||||
|
||||
@@ -72,20 +81,20 @@ class DirPath extends React.Component {
|
||||
{this.props.pathPrefix && this.props.pathPrefix.map((item, index) => {
|
||||
return (
|
||||
<Fragment key={index}>
|
||||
<Link to={item.url} className="normal" onClick={() => this.onTabNavClick(item.name, item.id)}>{gettext(item.showName)}</Link>
|
||||
<Link to={item.url} className="normal" onClick={(e) => this.onTabNavClick(e, item.name, item.id)}>{gettext(item.showName)}</Link>
|
||||
<span className="path-split">/</span>
|
||||
</Fragment>
|
||||
);
|
||||
})}
|
||||
{this.props.pathPrefix && this.props.pathPrefix.length === 0 && (
|
||||
<Fragment>
|
||||
<Link to={siteRoot + 'my-libs/'} className="normal" onClick={() => this.onTabNavClick('my-libs')}>{gettext('Libraries')}</Link>
|
||||
<Link to={siteRoot + 'my-libs/'} className="normal" onClick={(e) => this.onTabNavClick(e, 'my-libs')}>{gettext('Libraries')}</Link>
|
||||
<span className="path-split">/</span>
|
||||
</Fragment>
|
||||
)}
|
||||
{!this.props.pathPrefix && (
|
||||
<Fragment>
|
||||
<Link href={siteRoot + 'my-libs/'} className="normal" onClick={() => this.onTabNavClick('my-libs')}>{gettext('Libraries')}</Link>
|
||||
<Link href={siteRoot + 'my-libs/'} className="normal" onClick={(e) => this.onTabNavClick(e, 'my-libs')}>{gettext('Libraries')}</Link>
|
||||
<span className="path-split">/</span>
|
||||
</Fragment>
|
||||
)}
|
||||
|
Reference in New Issue
Block a user