mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-22 03:47:09 +00:00
Merge branch '7.0'
This commit is contained in:
@@ -66,7 +66,7 @@ class DirentListView extends React.Component {
|
||||
isMoveDialogShow: false,
|
||||
isCopyDialogShow: false,
|
||||
isProgressDialogShow: false,
|
||||
progress: 0,
|
||||
downloadItems: [],
|
||||
isMutipleOperation: true,
|
||||
activeDirent: null,
|
||||
isListDropTipShow: false,
|
||||
@@ -245,52 +245,20 @@ class DirentListView extends React.Component {
|
||||
location.href= url;
|
||||
return;
|
||||
}
|
||||
|
||||
let selectedDirentNames = selectedDirentList.map(dirent => {
|
||||
return dirent.name;
|
||||
});
|
||||
this.setState({isProgressDialogShow: true, progress: 0});
|
||||
seafileAPI.zipDownload(repoID, path, selectedDirentNames).then(res => {
|
||||
this.zipToken = res.data['zip_token'];
|
||||
this.addDownloadAnimation();
|
||||
this.interval = setInterval(this.addDownloadAnimation, 1000);
|
||||
}).catch(error => {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
|
||||
this.setState({
|
||||
isProgressDialogShow: true,
|
||||
downloadItems: selectedDirentNames
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
addDownloadAnimation = () => {
|
||||
let _this = this;
|
||||
let token = this.zipToken;
|
||||
seafileAPI.queryZipProgress(token).then(res => {
|
||||
let data = res.data;
|
||||
let progress = data.total === 0 ? 100 : (data.zipped / data.total * 100).toFixed(0);
|
||||
this.setState({progress: parseInt(progress)});
|
||||
|
||||
if (data['total'] === data['zipped']) {
|
||||
this.setState({
|
||||
progress: 100
|
||||
});
|
||||
clearInterval(this.interval);
|
||||
location.href = URLDecorator.getUrl({type: 'download_dir_zip_url', token: token});
|
||||
setTimeout(function() {
|
||||
_this.setState({isProgressDialogShow: false});
|
||||
}, 500);
|
||||
}
|
||||
}).catch(error => {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
});
|
||||
}
|
||||
|
||||
onCancelDownload = () => {
|
||||
seafileAPI.cancelZipTask(this.zipToken).then(() => {
|
||||
this.setState({isProgressDialogShow: false});
|
||||
}).catch(error => {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
});
|
||||
onCloseZipDownloadDialog = () => {
|
||||
this.setState({isProgressDialogShow: false});
|
||||
}
|
||||
|
||||
// common contextmenu handle
|
||||
@@ -727,7 +695,12 @@ class DirentListView extends React.Component {
|
||||
/>
|
||||
}
|
||||
{this.state.isProgressDialogShow &&
|
||||
<ZipDownloadDialog progress={this.state.progress} onCancelDownload={this.onCancelDownload} />
|
||||
<ZipDownloadDialog
|
||||
repoID={this.props.repoID}
|
||||
path={this.props.path}
|
||||
target={this.state.downloadItems}
|
||||
toggleDialog={this.onCloseZipDownloadDialog}
|
||||
/>
|
||||
}
|
||||
</Fragment>
|
||||
</div>
|
||||
|
@@ -8,7 +8,11 @@ class Dirent {
|
||||
this.name = json.name;
|
||||
this.type = json.type;
|
||||
this.mtime = json.mtime;
|
||||
this.mtime_relative = moment.unix(json.mtime).fromNow();
|
||||
if (json.mtime == 0) {
|
||||
this.mtime_relative = '';
|
||||
} else {
|
||||
this.mtime_relative = moment.unix(json.mtime).fromNow();
|
||||
}
|
||||
this.permission = json.permission || 'rw';
|
||||
this.isSelected = false; // is check or not
|
||||
this.starred = json.starred || false;
|
||||
|
@@ -392,7 +392,16 @@ class GroupView extends React.Component {
|
||||
|
||||
render() {
|
||||
let { errMessage, emptyTip, currentGroup, isDepartmentGroup, isStaff } = this.state;
|
||||
let isShowSettingIcon = !(currentGroup && currentGroup.parent_group_id !== 0 && currentGroup.admins.indexOf(username) === -1);
|
||||
let isShowSettingIcon = false;
|
||||
if (currentGroup) { // group message is loaded
|
||||
if (currentGroup.parent_group_id === 0) {
|
||||
isShowSettingIcon = true;
|
||||
} else {
|
||||
if (currentGroup.admins.indexOf(username) > -1) {
|
||||
isShowSettingIcon = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
let useRate = 0;
|
||||
if (isDepartmentGroup && currentGroup.group_quota) {
|
||||
useRate = currentGroup.group_quota_usage / currentGroup.group_quota * 100 + '%';
|
||||
|
Reference in New Issue
Block a user