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/06/25 19:59:33 UTC

[airavata-django-portal] branch develop updated (a0c2421 -> 31bb754)

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git.


    from a0c2421  AIRAVATA-3322 performance improvements in the frontend for loading statistics
     new 11b160c  AIRAVATA-3420 Moved download to sdk
     new e15b154  AIRAVATA-3420 Fix headers for GET requests
     new 0afbc04  AIRAVATA-3420 Use get_lazy_download_url to get URL that redirects to actual download URL
     new c091a8c  AIRAVATA-3420 Change expected format of GATEWAY_DATA_STORE_REMOTE_API
     new 77c2943  AIRAVATA-3420 Adding missing import
     new 87bb191  AIRAVATA-3420 Newer SDK with MFT integration
     new b1e7f03  AIRAVATA-3420 Remove check for get_lazy_download_url
     new bac762c  AIRAVATA-3420 AIRAVATA-3469 Updating sdk version for get_lazy_download_url fix, folder download views
     new 19e3016  AIRAVATA-3469 UI for downloading directory
     new 31bb754  Merge branch 'mft-download' into develop

The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 django_airavata/apps/api/serializers.py            | 11 ++----
 .../django_airavata_api/js/utils/FetchUtils.js     |  3 +-
 django_airavata/apps/api/views.py                  | 45 ++++++----------------
 .../storage/ExperimentStoragePathViewer.vue        | 21 +++++++++-
 .../storage/ExperimentStorageViewContainer.vue     | 16 +++++++-
 .../components/storage/UserStoragePathViewer.vue   | 21 +++++++---
 .../storage-edit/UserStorageDownloadButton.vue     |  2 +-
 .../storage/storage-edit/UserStorageEditViewer.vue |  2 +-
 django_airavata/urls.py                            |  2 +
 docs/dev/custom_output_view_provider.md            |  2 +-
 requirements.txt                                   | 10 +++--
 11 files changed, 80 insertions(+), 55 deletions(-)

[airavata-django-portal] 08/10: AIRAVATA-3420 AIRAVATA-3469 Updating sdk version for get_lazy_download_url fix, folder download views

Posted by ma...@apache.org.
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

commit bac762c083d454f548c1eb5c13f57a6807d3c478
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Jun 25 15:26:39 2021 -0400

    AIRAVATA-3420 AIRAVATA-3469 Updating sdk version for get_lazy_download_url fix, folder download views
---
 requirements.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/requirements.txt b/requirements.txt
index e7a4f1e..2e0f102 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
 # Pin these dependencies
 Django==2.2.23
-requests==2.13.0
+requests==2.25.1
 requests-oauthlib==0.7.0
 thrift==0.10.0
 thrift_connector==0.24
@@ -19,6 +19,6 @@ google-api-python-client==1.12.8
 grpcio-tools==1.34.1
 grpcio==1.34.1
 
-airavata-django-portal-sdk==1.1dev1
+airavata-django-portal-sdk==1.1.dev2
 -e git+https://github.com/apache/airavata.git@develop#egg=airavata-python-sdk&subdirectory=airavata-api/airavata-client-sdks/airavata-python-sdk
 -e "."

[airavata-django-portal] 02/10: AIRAVATA-3420 Fix headers for GET requests

Posted by ma...@apache.org.
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

commit e15b1540b64e5bd5223aa9c3d8128b1c2ef4e13a
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Apr 15 16:59:15 2021 -0400

    AIRAVATA-3420 Fix headers for GET requests
    
    The extra and unnecessary headers would require CORS allowances.
---
 .../apps/api/static/django_airavata_api/js/utils/FetchUtils.js         | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js b/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js
index 0d2544c..c1c1559 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/utils/FetchUtils.js
@@ -57,6 +57,7 @@ export default {
       return null;
     }
   },
+  // For POST, PUT, DELETE
   createHeaders: function (
     contentType = "application/json",
     accept = "application/json"
@@ -152,7 +153,7 @@ export default {
         return responseCache.get(url);
       }
     }
-    var headers = this.createHeaders(mediaType);
+    var headers = new Headers({ Accept: mediaType });
     const fetchRequest = this.processFetch(
       url,
       {

[airavata-django-portal] 09/10: AIRAVATA-3469 UI for downloading directory

Posted by ma...@apache.org.
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

commit 19e301684a7712bed0eaf75455e478f1f51e6675
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Jun 25 15:57:15 2021 -0400

    AIRAVATA-3469 UI for downloading directory
---
 .../storage/ExperimentStoragePathViewer.vue         | 21 ++++++++++++++++++++-
 .../storage/ExperimentStorageViewContainer.vue      | 16 +++++++++++++++-
 .../js/components/storage/UserStoragePathViewer.vue | 21 ++++++++++++++++-----
 3 files changed, 51 insertions(+), 7 deletions(-)

diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/ExperimentStoragePathViewer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/ExperimentStoragePathViewer.vue
index 31f5a44..44d46ac 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/ExperimentStoragePathViewer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/ExperimentStoragePathViewer.vue
@@ -27,6 +27,18 @@
       <template slot="createdTimestamp" slot-scope="data">
         <human-date :date="data.item.createdTime" />
       </template>
+      <template slot="actions" slot-scope="data">
+        <b-link
+          v-if="data.item.type === 'dir'"
+          class="action-link"
+          :href="`/sdk/download-experiment-dir/${encodeURIComponent(
+            experimentId
+          )}?path=${data.item.path}`"
+        >
+          Download Zip
+          <i class="fa fa-file-archive" aria-hidden="true"></i>
+        </b-link>
+      </template>
     </b-table>
   </div>
 </template>
@@ -35,7 +47,7 @@ import StoragePathBreadcrumb from "./StoragePathBreadcrumb.vue";
 import { components } from "django-airavata-common-ui";
 
 export default {
-  name: "user-storage-path-viewer",
+  name: "experiment-storage-path-viewer",
   props: {
     experimentStoragePath: {
       required: true,
@@ -44,6 +56,9 @@ export default {
       type: Boolean,
       default: false,
     },
+    experimentId: {
+      required: true,
+    },
   },
   components: {
     "human-date": components.HumanDate,
@@ -68,6 +83,10 @@ export default {
           key: "createdTimestamp",
           sortable: true,
         },
+        {
+          label: "Actions",
+          key: "actions",
+        },
       ];
     },
     items() {
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/ExperimentStorageViewContainer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/ExperimentStorageViewContainer.vue
index 7241649..a9edc15 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/ExperimentStorageViewContainer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/ExperimentStorageViewContainer.vue
@@ -1,8 +1,22 @@
 <template>
-  <b-card header="Experiment Data Directory">
+  <b-card>
+    <template #header>
+      <div class="d-flex justify-content-between">
+        <h6 class="mb-0">Experiment Data Directory</h6>
+        <b-link
+          :href="`/sdk/download-experiment-dir/${encodeURIComponent(
+            experimentId
+          )}`"
+        >
+          Download Zip
+          <i class="fa fa-file-archive" aria-hidden="true"></i>
+        </b-link>
+      </div>
+    </template>
     <experiment-storage-path-viewer
       v-if="experimentStoragePath"
       :experiment-storage-path="experimentStoragePath"
+      :experiment-id="experimentId"
       @directory-selected="directorySelected"
       :download-in-new-window="true"
     ></experiment-storage-path-viewer>
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 975af26..f26539f 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
@@ -56,13 +56,19 @@
         >
           Select
         </b-button>
-        <delete-button
-          v-if="includeDeleteAction"
-          @delete="deleteItem(data.item)"
+
+        <b-link
+          v-if="data.item.type === 'dir'"
+          class="action-link"
+          :href="`/sdk/download-dir?path=${data.item.path}`"
         >
+          Download Zip
+          <i class="fa fa-file-archive" aria-hidden="true"></i>
+        </b-link>
+        <delete-link v-if="includeDeleteAction" @delete="deleteItem(data.item)">
           Are you sure you want to delete <strong>{{ data.item.name }}</strong
           >?
-        </delete-button>
+        </delete-link>
       </template>
     </b-table>
   </div>
@@ -110,7 +116,7 @@ export default {
   },
   components: {
     UserStorageLink,
-    "delete-button": components.DeleteButton,
+    "delete-link": components.DeleteLink,
     "human-date": components.HumanDate,
     UserStoragePathBreadcrumb,
     UserStorageCreateView,
@@ -220,3 +226,8 @@ export default {
   },
 };
 </script>
+<style scoped>
+.action-link + .delete-link {
+  margin-left: 0.25rem;
+}
+</style>

[airavata-django-portal] 10/10: Merge branch 'mft-download' into develop

Posted by ma...@apache.org.
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

commit 31bb754ea937d76e48794ea28ee0365d23edcbb1
Merge: a0c2421 19e3016
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Jun 25 15:57:24 2021 -0400

    Merge branch 'mft-download' into develop

 django_airavata/apps/api/serializers.py            | 11 ++----
 .../django_airavata_api/js/utils/FetchUtils.js     |  3 +-
 django_airavata/apps/api/views.py                  | 45 ++++++----------------
 .../storage/ExperimentStoragePathViewer.vue        | 21 +++++++++-
 .../storage/ExperimentStorageViewContainer.vue     | 16 +++++++-
 .../components/storage/UserStoragePathViewer.vue   | 21 +++++++---
 .../storage-edit/UserStorageDownloadButton.vue     |  2 +-
 .../storage/storage-edit/UserStorageEditViewer.vue |  2 +-
 django_airavata/urls.py                            |  2 +
 docs/dev/custom_output_view_provider.md            |  2 +-
 requirements.txt                                   | 10 +++--
 11 files changed, 80 insertions(+), 55 deletions(-)


[airavata-django-portal] 03/10: AIRAVATA-3420 Use get_lazy_download_url to get URL that redirects to actual download URL

Posted by ma...@apache.org.
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

commit 0afbc044310b391f6f51f3cc5682da2c8e6af94c
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Apr 26 15:56:03 2021 -0400

    AIRAVATA-3420 Use get_lazy_download_url to get URL that redirects to actual download URL
---
 django_airavata/apps/api/serializers.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index 709f36a..159343f 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -2,7 +2,7 @@ import copy
 import datetime
 import json
 import logging
-from urllib.parse import quote, urlencode
+from urllib.parse import quote
 
 from airavata.model.appcatalog.appdeployment.ttypes import (
     ApplicationDeploymentDescription,
@@ -58,7 +58,6 @@ from airavata.model.workspace.ttypes import (
 )
 from airavata_django_portal_sdk import user_storage
 from django.conf import settings
-from django.urls import reverse
 from rest_framework import serializers
 
 from . import models, thrift_utils
@@ -468,8 +467,8 @@ class DataProductSerializer(
     def get_downloadURL(self, data_product):
         """Getter for downloadURL field."""
         request = self.context['request']
-        if hasattr(user_storage, 'get_download_url'):
-            return user_storage.get_download_url(request, data_product)
+        if hasattr(user_storage, 'get_lazy_download_url'):
+            return user_storage.get_lazy_download_url(request, data_product)
         return None
 
     def get_isInputFileUpload(self, data_product):
@@ -861,8 +860,8 @@ class UserStorageFileSerializer(serializers.Serializer):
     def get_downloadURL(self, file):
         """Getter for downloadURL field."""
         request = self.context['request']
-        if hasattr(user_storage, 'get_download_url'):
-            return user_storage.get_download_url(request, data_product_uri=file['data-product-uri'])
+        if hasattr(user_storage, 'get_lazy_download_url'):
+            return user_storage.get_lazy_download_url(request, data_product_uri=file['data-product-uri'])
 
 
 class UserStorageDirectorySerializer(serializers.Serializer):

[airavata-django-portal] 06/10: AIRAVATA-3420 Newer SDK with MFT integration

Posted by ma...@apache.org.
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

commit 87bb191ccad83495a06c4c5ff00b1dddb1e723a4
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Jun 24 15:11:42 2021 -0400

    AIRAVATA-3420 Newer SDK with MFT integration
---
 requirements.txt | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/requirements.txt b/requirements.txt
index a0ff4b6..e7a4f1e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -19,7 +19,6 @@ google-api-python-client==1.12.8
 grpcio-tools==1.34.1
 grpcio==1.34.1
 
-# TODO: switch this back to master branch once mft-integration branch testing is done
--e git+https://github.com/apache/airavata-django-portal-sdk.git@mft-integration#egg=airavata-django-portal-sdk
+airavata-django-portal-sdk==1.1dev1
 -e git+https://github.com/apache/airavata.git@develop#egg=airavata-python-sdk&subdirectory=airavata-api/airavata-client-sdks/airavata-python-sdk
 -e "."

[airavata-django-portal] 04/10: AIRAVATA-3420 Change expected format of GATEWAY_DATA_STORE_REMOTE_API

Posted by ma...@apache.org.
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

commit c091a8c0e03c2bac832022de475103089a4e5f00
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Jun 18 14:44:47 2021 -0400

    AIRAVATA-3420 Change expected format of GATEWAY_DATA_STORE_REMOTE_API
    
    Now used for /api and /sdk API requests.
---
 django_airavata/apps/api/views.py       | 6 +++++-
 docs/dev/custom_output_view_provider.md | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index b2a1e18..ff7d512 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -290,13 +290,17 @@ class ExperimentViewSet(mixins.CreateModelMixin,
                 settings,
                 'GATEWAY_DATA_STORE_REMOTE_API',
                     None) is not None:
+                remote_api_url = settings.GATEWAY_DATA_STORE_REMOTE_API
+                if remote_api_url.endswith("/api"):
+                    warnings.warn(f"Set GATEWAY_DATA_STORE_REMOTE_API to \"{remote_api_url}\". /api is no longer needed.", DeprecationWarning)
+                    remote_api_url = remote_api_url[0:remote_api_url.rfind("/api")]
                 # Proxy the launch/ request to the remote Django portal
                 # instance since it must setup the experiment data directory
                 # which is only on the remote Django portal instance
                 headers = {
                     'Authorization': f'Bearer {request.authz_token.accessToken}'}
                 r = requests.post(
-                    f'{settings.GATEWAY_DATA_STORE_REMOTE_API}/experiments/{quote(experiment_id)}/launch/',
+                    f'{settings.GATEWAY_DATA_STORE_REMOTE_API}/api/experiments/{quote(experiment_id)}/launch/',
                     headers=headers,
                 )
                 r.raise_for_status()
diff --git a/docs/dev/custom_output_view_provider.md b/docs/dev/custom_output_view_provider.md
index db4bc5e..95f2fe5 100644
--- a/docs/dev/custom_output_view_provider.md
+++ b/docs/dev/custom_output_view_provider.md
@@ -65,7 +65,7 @@ settings_local.py to have the domain of the remote deployed Django portal:
 
 ```
 # Change this to match your remote Django portal instance
-GATEWAY_DATA_STORE_REMOTE_API = 'https://testdrive.airavata.org/api'
+GATEWAY_DATA_STORE_REMOTE_API = 'https://testdrive.airavata.org'
 ```
 
 ## Reference

[airavata-django-portal] 05/10: AIRAVATA-3420 Adding missing import

Posted by ma...@apache.org.
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

commit 77c29432e1e9b14d16f939f3de96d86a2c5a739b
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Jun 18 14:51:17 2021 -0400

    AIRAVATA-3420 Adding missing import
---
 django_airavata/apps/api/serializers.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index 159343f..754e70d 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -58,6 +58,7 @@ from airavata.model.workspace.ttypes import (
 )
 from airavata_django_portal_sdk import user_storage
 from django.conf import settings
+from django.urls import reverse
 from rest_framework import serializers
 
 from . import models, thrift_utils

[airavata-django-portal] 01/10: AIRAVATA-3420 Moved download to sdk

Posted by ma...@apache.org.
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

commit 11b160cecf8ad8be4159b1ddc6c42121f0aa27b6
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Apr 26 16:32:53 2021 -0400

    AIRAVATA-3420 Moved download to sdk
---
 django_airavata/apps/api/serializers.py            | 10 +++---
 django_airavata/apps/api/views.py                  | 39 ++++------------------
 .../storage-edit/UserStorageDownloadButton.vue     |  2 +-
 .../storage/storage-edit/UserStorageEditViewer.vue |  2 +-
 django_airavata/urls.py                            |  2 ++
 requirements.txt                                   |  5 +++
 6 files changed, 20 insertions(+), 40 deletions(-)

diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index ec68e11..709f36a 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -468,9 +468,8 @@ class DataProductSerializer(
     def get_downloadURL(self, data_product):
         """Getter for downloadURL field."""
         request = self.context['request']
-        if user_storage.exists(request, data_product):
-            return (request.build_absolute_uri(
-                reverse('django_airavata_api:download_file')) + '?' + urlencode({'data-product-uri': data_product.productUri}))
+        if hasattr(user_storage, 'get_download_url'):
+            return user_storage.get_download_url(request, data_product)
         return None
 
     def get_isInputFileUpload(self, data_product):
@@ -858,13 +857,12 @@ class UserStorageFileSerializer(serializers.Serializer):
     createdTime = serializers.DateTimeField(source='created_time')
     mimeType = serializers.CharField(source='mime_type')
     size = serializers.IntegerField()
-    hidden = serializers.BooleanField()
 
     def get_downloadURL(self, file):
         """Getter for downloadURL field."""
         request = self.context['request']
-        return (request.build_absolute_uri(
-            reverse('django_airavata_api:download_file')) + '?' + urlencode({'data-product-uri': file['data-product-uri']}))
+        if hasattr(user_storage, 'get_download_url'):
+            return user_storage.get_download_url(request, data_product_uri=file['data-product-uri'])
 
 
 class UserStorageDirectorySerializer(serializers.Serializer):
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index 675236c..b2a1e18 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -2,6 +2,7 @@ import base64
 import json
 import logging
 import os
+import warnings
 from datetime import datetime, timedelta
 from urllib.parse import quote
 
@@ -27,7 +28,8 @@ from airavata.model.user.ttypes import Status
 from airavata_django_portal_sdk import user_storage
 from django.conf import settings
 from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
-from django.http import FileResponse, Http404, HttpResponse, JsonResponse
+from django.http import Http404, HttpResponse, JsonResponse
+from django.shortcuts import redirect
 from django.urls import reverse
 from django.views.decorators.gzip import gzip_page
 from rest_framework import mixins, status
@@ -1025,38 +1027,11 @@ def tus_upload_finish(request):
 @gzip_page
 @api_view()
 def download_file(request):
-    # TODO check that user has access to this file using sharing API
+    # TODO: remove this deprecated view
+    warnings.warn("download_file view has moved to SDK", DeprecationWarning)
+    # redirect to /sdk/download
     data_product_uri = request.GET.get('data-product-uri', '')
-    force_download = 'download' in request.GET
-    data_product = None
-    try:
-        data_product = request.airavata_client.getDataProduct(
-            request.authz_token, data_product_uri)
-        mime_type = "application/octet-stream"  # default mime-type
-        if (data_product.productMetadata and
-                'mime-type' in data_product.productMetadata):
-            mime_type = data_product.productMetadata['mime-type']
-        # 'mime-type' url parameter overrides
-        mime_type = request.GET.get('mime-type', mime_type)
-    except Exception as e:
-        log.warning("Failed to load DataProduct for {}"
-                    .format(data_product_uri), exc_info=True)
-        raise Http404("data product does not exist") from e
-    try:
-        data_file = user_storage.open_file(request, data_product)
-        response = FileResponse(data_file, content_type=mime_type)
-        if user_storage.is_input_file(request, data_product):
-            file_name = data_product.productName
-        else:
-            file_name = os.path.basename(data_file.name)
-        if mime_type == 'application/octet-stream' or force_download:
-            response['Content-Disposition'] = ('attachment; filename="{}"'
-                                               .format(file_name))
-        else:
-            response['Content-Disposition'] = f'inline; filename="{file_name}"'
-        return response
-    except ObjectDoesNotExist as e:
-        raise Http404(str(e)) from e
+    return redirect(user_storage.get_download_url(request, data_product_uri=data_product_uri))
 
 
 @api_view(http_method_names=['DELETE'])
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/storage-edit/UserStorageDownloadButton.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/storage-edit/UserStorageDownloadButton.vue
index 69004ef..adbb089 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/storage-edit/UserStorageDownloadButton.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/storage-edit/UserStorageDownloadButton.vue
@@ -15,7 +15,7 @@ export default {
   },
   computed: {
     downloadUrl() {
-      return `/api/download?data-product-uri=${this.dataProductUri}`;
+      return `/sdk/download?data-product-uri=${this.dataProductUri}`;
     }
   }
 };
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/storage-edit/UserStorageEditViewer.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/storage-edit/UserStorageEditViewer.vue
index 87b62d7..37993b8 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/storage-edit/UserStorageEditViewer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/storage/storage-edit/UserStorageEditViewer.vue
@@ -99,7 +99,7 @@ export default {
       return /pdf/.test(this.mimeType);
     },
     downloadUrl() {
-      return `/api/download?data-product-uri=${this.dataProductUri}`;
+      return `/sdk/download?data-product-uri=${this.dataProductUri}`;
     }
   },
   components: {
diff --git a/django_airavata/urls.py b/django_airavata/urls.py
index 70da707..2bc487a 100644
--- a/django_airavata/urls.py
+++ b/django_airavata/urls.py
@@ -17,6 +17,7 @@ from django.conf import settings
 from django.conf.urls import include, url
 from django.conf.urls.static import static
 from django.contrib import admin
+from django.urls import path
 from wagtail.admin import urls as wagtailadmin_urls
 from wagtail.core import urls as wagtail_urls
 from wagtail.documents import urls as wagtaildocs_urls
@@ -31,6 +32,7 @@ urlpatterns = [
     url(r'^api/', include('django_airavata.apps.api.urls')),
     url(r'^groups/', include('django_airavata.apps.groups.urls')),
     url(r'^dataparsers/', include('django_airavata.apps.dataparsers.urls')),
+    path('sdk/', include('airavata_django_portal_sdk.urls')),
     url(r'^home$', views.home, name='home'),
     url(r'^cms/', include(wagtailadmin_urls)),
     url(r'^documents/', include(wagtaildocs_urls)),
diff --git a/requirements.txt b/requirements.txt
index f433e3a..a0ff4b6 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,6 +14,11 @@ wagtail-draftail-anchors==0.2.0
 jupyter==1.0.0
 papermill==1.0.1
 
+# gRPC libs
+google-api-python-client==1.12.8
+grpcio-tools==1.34.1
+grpcio==1.34.1
+
 # TODO: switch this back to master branch once mft-integration branch testing is done
 -e git+https://github.com/apache/airavata-django-portal-sdk.git@mft-integration#egg=airavata-django-portal-sdk
 -e git+https://github.com/apache/airavata.git@develop#egg=airavata-python-sdk&subdirectory=airavata-api/airavata-client-sdks/airavata-python-sdk

[airavata-django-portal] 07/10: AIRAVATA-3420 Remove check for get_lazy_download_url

Posted by ma...@apache.org.
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

commit b1e7f039d1cd0cd0b0cb229692bf202929e0decd
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Jun 24 15:25:04 2021 -0400

    AIRAVATA-3420 Remove check for get_lazy_download_url
---
 django_airavata/apps/api/serializers.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index 754e70d..6eb8c7f 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -468,9 +468,7 @@ class DataProductSerializer(
     def get_downloadURL(self, data_product):
         """Getter for downloadURL field."""
         request = self.context['request']
-        if hasattr(user_storage, 'get_lazy_download_url'):
-            return user_storage.get_lazy_download_url(request, data_product)
-        return None
+        return user_storage.get_lazy_download_url(request, data_product)
 
     def get_isInputFileUpload(self, data_product):
         """Return True if this is an uploaded input file."""
@@ -861,8 +859,7 @@ class UserStorageFileSerializer(serializers.Serializer):
     def get_downloadURL(self, file):
         """Getter for downloadURL field."""
         request = self.context['request']
-        if hasattr(user_storage, 'get_lazy_download_url'):
-            return user_storage.get_lazy_download_url(request, data_product_uri=file['data-product-uri'])
+        return user_storage.get_lazy_download_url(request, data_product_uri=file['data-product-uri'])
 
 
 class UserStorageDirectorySerializer(serializers.Serializer):