You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/07/01 22:01:00 UTC

[airavata-django-portal] branch develop updated: AIRAVATA-3484 Only reset the file upload widget once all uploads have finished

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 df6a84b  AIRAVATA-3484 Only reset the file upload widget once all uploads have finished
df6a84b is described below

commit df6a84b8d97de9c4c7c8234b96d5488b90e359f5
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Jul 1 18:00:39 2021 -0400

    AIRAVATA-3484 Only reset the file upload widget once all uploads have finished
---
 .../components/storage/UserStorageCreateView.vue   |  6 +--
 .../components/storage/UserStoragePathViewer.vue   |  2 +-
 .../js/containers/UserStorageContainer.vue         | 59 ++++++++++++----------
 3 files changed, 37 insertions(+), 30 deletions(-)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStorageCreateView.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStorageCreateView.vue
index 6844f3e..b8828cc 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStorageCreateView.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStorageCreateView.vue
@@ -17,7 +17,7 @@
           ref="file-upload"
           :xhr-upload-endpoint="uploadEndpoint"
           :tus-upload-finish-endpoint="uploadEndpoint"
-          @upload-success="uploadSuccess"
+          @upload-finished="uploadFinished"
           multiple
         />
       </div>
@@ -71,9 +71,9 @@ export default {
     },
   },
   methods: {
-    uploadSuccess() {
+    uploadFinished() {
       this.$refs["file-upload"].reset();
-      this.$emit("upload-success");
+      this.$emit("upload-finished");
     },
     addDirectory() {
       this.$emit("add-directory", this.dirName);
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStoragePathViewer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStoragePathViewer.vue
index 425b396..263baaa 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStoragePathViewer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/UserStoragePathViewer.vue
@@ -4,7 +4,7 @@
       v-if="includeCreateFileAction && userStoragePath && isDir"
       :user-storage-path="userStoragePath"
       :storage-path="storagePath"
-      @upload-success="$emit('upload-success')"
+      @upload-finished="$emit('upload-finished')"
       @add-directory="(dirName) => $emit('add-directory', dirName)"
     />
     <user-storage-path-breadcrumb
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/UserStorageContainer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/UserStorageContainer.vue
index 1586ad9..40f6671 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/UserStorageContainer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/UserStorageContainer.vue
@@ -4,7 +4,7 @@
       v-if="userStoragePath"
       :user-storage-path="userStoragePath"
       :storage-path="storagePath"
-      @upload-success="uploadSuccess"
+      @upload-finished="uploadFinished"
       @add-directory="addDirectory"
       @delete-dir="deleteDir"
       @delete-file="deleteFile"
@@ -16,20 +16,20 @@
 </template>
 
 <script>
-import {services, utils} from "django-airavata-api";
-import {notifications} from "django-airavata-common-ui";
+import { services, utils } from "django-airavata-api";
+import { notifications } from "django-airavata-common-ui";
 
 export default {
   name: "user-storage-container",
   computed: {
     dataProductUri() {
       return this.$route.query.dataProductUri;
-    }
+    },
   },
   data() {
     return {
       storagePath: null,
-      userStoragePath: null
+      userStoragePath: null,
     };
   },
   methods: {
@@ -40,7 +40,7 @@ export default {
          * TODO fix: storage path is set to home when it's a file referenced by dataProductUri because
          * there's no way of retrieving the path and this is to be fixed once a workaround is found.
          */
-        _storagePath = "~/"
+        _storagePath = "~/";
       } else {
         _storagePath = /~.*$/.exec(this.$route.fullPath);
         if (_storagePath && _storagePath.length > 0) {
@@ -71,29 +71,36 @@ export default {
          * TODO fix: userStoragePath is set manually when it's a file referenced by dataProductUri because
          * there's no way of retrieving the path and this is to be fixed once a workaround is found.
          */
-        return utils.FetchUtils.get(`/api/data-products?product-uri=${this.dataProductUri}`).then((dataProduct) => {
-          this.userStoragePath = {
-            isDir: false,
-            directories: [],
-            files: [{
-              createdTime: dataProduct.creationTime,
-              dataProductURI: this.dataProductUri,
-              downloadURL: dataProduct.downloadURL,
-              mimeType: dataProduct.productMetadata["mime-type"],
-              name: dataProduct.productName,
-              size: dataProduct.productSize
-            }],
-            parts: []
-          }
-        }).catch(_catch);
+        return utils.FetchUtils.get(
+          `/api/data-products?product-uri=${this.dataProductUri}`
+        )
+          .then((dataProduct) => {
+            this.userStoragePath = {
+              isDir: false,
+              directories: [],
+              files: [
+                {
+                  createdTime: dataProduct.creationTime,
+                  dataProductURI: this.dataProductUri,
+                  downloadURL: dataProduct.downloadURL,
+                  mimeType: dataProduct.productMetadata["mime-type"],
+                  name: dataProduct.productName,
+                  size: dataProduct.productSize,
+                },
+              ],
+              parts: [],
+            };
+          })
+          .catch(_catch);
       } else {
         return services.UserStoragePathService.get(
-          {path},
-          {ignoreErrors: true}
+          { path },
+          { ignoreErrors: true }
         )
           .then((result) => {
             this.userStoragePath = result;
-          }).catch(_catch);
+          })
+          .catch(_catch);
       }
     },
     handleMissingPath(path) {
@@ -124,7 +131,7 @@ export default {
     fileContentChanged() {
       this.loadUserStoragePath(this.storagePath);
     },
-    uploadSuccess() {
+    uploadFinished() {
       this.loadUserStoragePath(this.storagePath);
     },
     addDirectory(dirName) {
@@ -147,7 +154,7 @@ export default {
     deleteFile(dataProductURI) {
       utils.FetchUtils.delete(
         "/api/delete-file?data-product-uri=" +
-        encodeURIComponent(dataProductURI)
+          encodeURIComponent(dataProductURI)
       ).then(() => {
         this.loadUserStoragePath(this.storagePath);
       });