🐛 Fix pause/resume for upload modal (#856)
This commit is contained in:
@@ -123,6 +123,16 @@ class FileUploadService {
|
|||||||
|
|
||||||
if (status === 'completed') {
|
if (status === 'completed') {
|
||||||
this.rootStates.completed[key] = true;
|
this.rootStates.completed[key] = true;
|
||||||
|
// remaining roots
|
||||||
|
const roots = Object.keys(this.groupedPendingFiles);
|
||||||
|
const isAllPaused = roots.every(
|
||||||
|
root => this.rootStates.paused[root] || this.rootStates.completed[root],
|
||||||
|
);
|
||||||
|
if (isAllPaused) {
|
||||||
|
this.uploadStatus = UploadStateEnum.Paused;
|
||||||
|
} else {
|
||||||
|
this.uploadStatus = UploadStateEnum.Progress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to the accumulator object
|
// Add to the accumulator object
|
||||||
@@ -513,7 +523,10 @@ class FileUploadService {
|
|||||||
for (const rootItem of Object.keys(rootItemIds)) {
|
for (const rootItem of Object.keys(rootItemIds)) {
|
||||||
const rootItemId = rootItemIds[rootItem];
|
const rootItemId = rootItemIds[rootItem];
|
||||||
// check if the root completed skip it
|
// check if the root completed skip it
|
||||||
if (this.rootStates.completed[rootItem]) continue;
|
if (this.rootStates.completed[rootItem]) {
|
||||||
|
delete this.rootStates.completed[rootItem];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
this.deleteOneDriveItem({
|
this.deleteOneDriveItem({
|
||||||
companyId: this.companyId,
|
companyId: this.companyId,
|
||||||
id: rootItemId,
|
id: rootItemId,
|
||||||
@@ -527,10 +540,6 @@ class FileUploadService {
|
|||||||
this.groupIds = {};
|
this.groupIds = {};
|
||||||
|
|
||||||
this.notify();
|
this.notify();
|
||||||
|
|
||||||
// reset the states for next upload
|
|
||||||
this.resetStates(Object.keys(this.rootStates.completed));
|
|
||||||
this.notify();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public cancelRootUpload(id: string) {
|
public cancelRootUpload(id: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user