🐛 Fix pause/resume for upload modal (#856)

This commit is contained in:
Montassar Ghanmy
2025-03-14 09:22:07 +01:00
committed by GitHub
parent 2d3b6e9179
commit 34ff3e38f1
@@ -123,6 +123,16 @@ class FileUploadService {
if (status === 'completed') {
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
@@ -513,7 +523,10 @@ class FileUploadService {
for (const rootItem of Object.keys(rootItemIds)) {
const rootItemId = rootItemIds[rootItem];
// 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({
companyId: this.companyId,
id: rootItemId,
@@ -527,10 +540,6 @@ class FileUploadService {
this.groupIds = {};
this.notify();
// reset the states for next upload
this.resetStates(Object.keys(this.rootStates.completed));
this.notify();
}
public cancelRootUpload(id: string) {