airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 02/02: AIRAVATA-2598 Loading Application Interface for a given module
Date Sun, 10 Dec 2017 19:14:12 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 6f53fdd05d17decc426fb77691dcb2d8ebb6957d
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Thu Dec 7 14:05:56 2017 -0500

    AIRAVATA-2598 Loading Application Interface for a given module
---
 django_airavata/apps/api/views.py                   | 21 +++++++++++++++++++++
 .../js/views/CreateExperimentContainer.vue          |  8 +++++++-
 .../js/views/ExperimentEditor.vue                   | 13 +++++++------
 3 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index c610ddc..e6f975e 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -238,6 +238,7 @@ class ExperimentList(APIView):
 
 class ApplicationModuleViewSet(APIBackedViewSet):
     serializer_class = serializers.ApplicationModuleSerializer
+    lookup_field = 'app_module_id'
 
     def get_list(self):
         return self.request.airavata_client.getAllAppModules(self.authz_token, self.gateway_id)
@@ -254,6 +255,26 @@ class ApplicationModuleViewSet(APIBackedViewSet):
         app_module = serializer.save()
         self.request.airavata_client.updateApplicationModule(self.authz_token, app_module.appModuleId,
app_module)
 
+    @detail_route()
+    def application_interface(self, request, app_module_id):
+        all_app_interfaces = request.airavata_client.getAllApplicationInterfaces(self.authz_token,
self.gateway_id)
+        app_interfaces = []
+        for app_interface in all_app_interfaces:
+            if not app_interface.applicationModules:
+                continue
+            if app_module_id in app_interface.applicationModules:
+                app_interfaces.append(app_interface)
+        if len(app_interfaces) == 1:
+            serializer = thrift_django_serializer.create_serializer(
+                ApplicationInterfaceDescription, instance=app_interfaces[0], context={'request':
request})
+            return Response(serializer.data)
+        elif len(app_interfaces) > 1:
+            return Response({'error': 'More than one application interface found for module
id {}'.format(app_module_id)},
+                            status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+        else:
+            return Response({'error': 'No application interface found for module id {}'.format(app_module_id)},
+                            status=status.HTTP_404_NOT_FOUND)
+
 
 # TODO convert to APIBackedViewSet
 class RegisterApplicationModule(APIView):
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/CreateExperimentContainer.vue
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/CreateExperimentContainer.vue
index 68a0828..e7d36fd 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/CreateExperimentContainer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/CreateExperimentContainer.vue
@@ -1,5 +1,5 @@
 <template>
-    <experiment-editor :experiment="experiment" :app-module="appModule">
+    <experiment-editor :experiment="experiment" :app-module="appModule" :app-interface="appInterface">
         <span slot="title">Create a New Experiment</span>
     </experiment-editor>
 </template>
@@ -20,6 +20,7 @@ export default {
         return {
             'experiment': new models.Experiment(),
             'appModule': null,
+            'appInterface': null,
         }
     },
     components: {
@@ -36,6 +37,11 @@ export default {
                 this.experiment.experimentName = appModule.appModuleName + ' on ' + moment().format('lll');
                 this.appModule = appModule;
             });
+        services.ApplicationInterfaceService.getForAppModuleId(this.appModuleId)
+            .then(appInterface => {
+                this.appInterface = appInterface
+                console.log(JSON.stringify(appInterface));
+            });
     }
 }
 </script>
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ExperimentEditor.vue
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ExperimentEditor.vue
index aec3969..8caceaf 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ExperimentEditor.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/views/ExperimentEditor.vue
@@ -20,12 +20,13 @@
                             </b-form-group>
                             <b-form-group label="Project" label-for="project">
                                 <b-form-select id="project"
-                                v-model="experiment.projectId" :options="projectOptions"
required>
-                                <template slot="first">
-                                    <option :value="null" disabled>Select a Project</option>
-                                </template>
-                            </b-form-select>
+                                    v-model="experiment.projectId" :options="projectOptions"
required>
+                                    <template slot="first">
+                                        <option :value="null" disabled>Select a Project</option>
+                                    </template>
+                                </b-form-select>
                             </b-form-group>
+                            <div v-if="appInterface">App Interface name: {{ appInterface.applicationName
}}</div>
                         </b-form>
                     </div>
                 </div>
@@ -39,7 +40,7 @@ import {models, services} from 'django-airavata-api'
 
 export default {
     name: 'edit-experiment',
-    props: ['experiment', 'appModule'],
+    props: ['experiment', 'appModule', 'appInterface'],
     data () {
         return {
             'projects': [],

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <commits@airavata.apache.org>.

Mime
View raw message