This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
The following commit(s) were added to refs/heads/develop by this push:
new 8b234086 AIRAVATA-3610 Only emit upload-finished event when all
uploads have been completely processed
8b234086 is described below
commit 8b2340869855044fd8497e052f3da4a587465fbf
Author: Marcus Christie <[email protected]>
AuthorDate: Tue Apr 26 16:41:57 2022 -0400
AIRAVATA-3610 Only emit upload-finished event when all uploads have been
completely processed
Tus uploads require a second step to post process the uploaded file
into the user's gateway data storage. We want to only declare that all
uploads are finished when all of this post processing is done.
---
django_airavata/static/common/js/components/Uppy.vue | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/django_airavata/static/common/js/components/Uppy.vue
b/django_airavata/static/common/js/components/Uppy.vue
index ad510d51..2cbad56a 100644
--- a/django_airavata/static/common/js/components/Uppy.vue
+++ b/django_airavata/static/common/js/components/Uppy.vue
@@ -55,6 +55,7 @@ export default {
uppy: null,
restrictionFailedMessage: null,
settings: null,
+ uploadFilesCount: 0,
};
},
computed: {
@@ -106,6 +107,7 @@ export default {
showSpinner: false,
}).then((result) => {
this.$emit("upload-success", result);
+ this.fileFinishedUploading();
});
});
} else {
@@ -119,18 +121,28 @@ export default {
});
this.uppy.on("upload-success", (file, response) => {
this.$emit("upload-success", response.body);
+ this.fileFinishedUploading();
});
}
- this.uppy.on("upload", () => {
+ this.uppy.on("upload", (data) => {
this.$emit("upload-started");
+ this.uploadFilesCount = data.fileIDs.length;
});
this.uppy.on("complete", () => {
- this.$emit("upload-finished");
this.restrictionFailedMessage = null;
});
this.uppy.on("restriction-failed", (file, error) => {
this.restrictionFailedMessage = `${file.name}: ${error.message}`;
});
+ this.uppy.on("upload-error", () => {
+ this.fileFinishedUploading();
+ });
+ },
+ fileFinishedUploading() {
+ this.uploadFilesCount--;
+ if (this.uploadFilesCount <= 0) {
+ this.$emit("upload-finished");
+ }
},
reset() {
this.uppy.reset();