dinukadesilva commented on a change in pull request #52:
URL: 
https://github.com/apache/airavata-django-portal/pull/52#discussion_r541633259



##########
File path: 
django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/storage-edit/UserStorageLink.vue
##########
@@ -0,0 +1,54 @@
+<template>
+  <b-link :href="storageFileViewRouteUrl()" @click="showFilePreview($event)">
+    {{ fileName }}
+    <b-modal :title="fileName" ref="modal" scrollable size="lg">
+      <user-storage-file-edit-viewer
+        :file-name="fileName"
+        :data-product-uri="dataProductUri"
+        :mime-type="mimeType"
+        @file-content-changed="
+          (fileContent) => $emit('file-content-changed', fileContent)
+        "
+      />
+      <template slot="modal-footer">
+        <a :href="storageFileViewRouteUrl()" target="_blank">Open in a new 
window</a>
+      </template>
+    </b-modal>
+  </b-link>
+</template>
+
+<script>
+import UserStorageFileEditViewer from "./UserStorageEditViewer";
+
+export default {
+  name: "user-storage-link",
+  components: {UserStorageFileEditViewer},
+  props: {
+    fileName: {
+      required: true
+    },
+    dataProductUri: {
+      required: true
+    },
+    mimeType: {
+      required: true
+    },
+    allowPreview: {
+      default: true,
+      required: true
+    }
+  },
+  methods: {
+    showFilePreview(event) {
+      if (this.allowPreview) {
+        this.$refs.modal.show();
+        event.preventDefault();
+      }
+    },
+    storageFileViewRouteUrl() {
+      // This endpoint can handle XHR upload or a TUS uploadURL
+      return `/workspace/storage/~?dataProductUri=${this.dataProductUri}`;

Review comment:
       @machristie Passing dataProductUri as a query parameter is only an 
additional thing and passing the path is still working as well. I did so 
because I do not have the path in the URL when the file editor is opened 
through a dialog.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to