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

yasithdev pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airavata-portals.git


The following commit(s) were added to refs/heads/main by this push:
     new 283ca89f1 feat(portal): repoint application module reads to gRPC 
(Track D, D2) (#159)
283ca89f1 is described below

commit 283ca89f137a453cf08a6793d0e23e06355c6e1e
Author: Yasith Jayawardana <[email protected]>
AuthorDate: Mon Jun 8 17:34:45 2026 -0400

    feat(portal): repoint application module reads to gRPC (Track D, D2) (#159)
    
    ApplicationModuleViewSet reads (get_list, get_instance, list_all) now call
    request.airavata.research.get_accessible_app_modules/get_application_module/
    get_all_app_modules instead of the Thrift client. Writes 
(create/update/destroy)
    and the interface/deployment actions stay on Thrift for their own families.
    
    grpc_adapters.application_module() maps the ApplicationModule protobuf
    (app_module_id, ...) to the Thrift attribute names the existing
    ApplicationModuleSerializer reads (appModuleId, ...), keeping the REST 
contract
    unchanged. Verified: a real ApplicationModule protobuf exposes all 4 Thrift
    fields; manage.py check clean.
---
 .../django_airavata/apps/api/grpc_adapters.py          | 10 ++++++++++
 .../django_airavata/apps/api/views.py                  | 18 ++++++++++++------
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/airavata-django-portal/django_airavata/apps/api/grpc_adapters.py 
b/airavata-django-portal/django_airavata/apps/api/grpc_adapters.py
index 1933ca489..5255f2c68 100644
--- a/airavata-django-portal/django_airavata/apps/api/grpc_adapters.py
+++ b/airavata-django-portal/django_airavata/apps/api/grpc_adapters.py
@@ -28,3 +28,13 @@ def project(pb):
         sharedUsers=list(pb.shared_users),
         sharedGroups=list(pb.shared_groups),
     )
+
+
+def application_module(pb):
+    """gRPC ``ApplicationModule`` protobuf -> ``ApplicationModuleSerializer`` 
shape."""
+    return SimpleNamespace(
+        appModuleId=pb.app_module_id,
+        appModuleName=pb.app_module_name,
+        appModuleVersion=pb.app_module_version,
+        appModuleDescription=pb.app_module_description,
+    )
diff --git a/airavata-django-portal/django_airavata/apps/api/views.py 
b/airavata-django-portal/django_airavata/apps/api/views.py
index bf6e07cfa..728631f6a 100644
--- a/airavata-django-portal/django_airavata/apps/api/views.py
+++ b/airavata-django-portal/django_airavata/apps/api/views.py
@@ -439,12 +439,15 @@ class ApplicationModuleViewSet(APIBackedViewSet):
     lookup_field = 'app_module_id'
 
     def get_list(self):
-        return self.request.airavata_client.getAccessibleAppModules(
-            self.authz_token, self.gateway_id)
+        return [
+            grpc_adapters.application_module(m)
+            for m in self.request.airavata.research.get_accessible_app_modules(
+                gateway_id=self.gateway_id)
+        ]
 
     def get_instance(self, lookup_value):
-        return self.request.airavata_client.getApplicationModule(
-            self.authz_token, lookup_value)
+        return grpc_adapters.application_module(
+            
self.request.airavata.research.get_application_module(lookup_value))
 
     def perform_create(self, serializer):
         app_module = serializer.save()
@@ -535,8 +538,11 @@ class ApplicationModuleViewSet(APIBackedViewSet):
 
     @action(detail=False)
     def list_all(self, request, format=None):
-        all_modules = self.request.airavata_client.getAllAppModules(
-            self.authz_token, self.gateway_id)
+        all_modules = [
+            grpc_adapters.application_module(m)
+            for m in self.request.airavata.research.get_all_app_modules(
+                gateway_id=self.gateway_id)
+        ]
         serializer = self.serializer_class(
             all_modules, many=True, context={'request': request})
         return Response(serializer.data)

Reply via email to