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-2805 Add ShareButton to App Deployments
Date Tue, 17 Jul 2018 22:30:20 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 240c7d31750a60e8ffc04b2334d5f7f68ce5e17e
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Tue Jul 17 18:30:09 2018 -0400

    AIRAVATA-2805 Add ShareButton to App Deployments
---
 .../components/admin/ApplicationDeployments.vue    | 23 ++++++++++++++++------
 django_airavata/apps/api/views.py                  |  1 +
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/ApplicationDeployments.vue
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/ApplicationDeployments.vue
index 41b7d7f..54317b0 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/ApplicationDeployments.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/ApplicationDeployments.vue
@@ -2,12 +2,15 @@
   <div class="main_section">
     <div class="new-application-tab-main">
       <h4>Application Deployments</h4>
-      <div class="entry" v-if="appDeployments.appDeployments.length!=0">
+      <div class="entry" v-if="appDeployments.appDeployments && appDeployments.appDeployments.length!=0">
         <div class="heading">Select an Application Deployment to Edit</div>
         <select v-model="appDeploymentIndex">
           <option v-for="(appDeployment,index) in appDeployments.appDeployments" v-bind:value="index">{{appDeployment.appDeploymentId}}</option>
         </select>
       </div>
+      <div class="entry" v-if="appDeployments.appDeploymentId">
+          <share-button v-model="sharedEntity"/>
+      </div>
       <div class="entry">
         <div class="heading">Application module</div>
         <input type="text" v-model="appDeployments.appModuleId"/>
@@ -131,12 +134,16 @@
   import Loading from '../Loading.vue'
 
   import Utils from '../../utils'
+  import {components as comps} from 'django-airavata-common-ui'
+  import DjangoAiravataAPI from 'django-airavata-api'
 
   const {mapGetters, mapActions} = createNamespacedHelpers('newApplication/appDeploymentsTab')
 
   export default {
     components: {
-      NewApplicationButtons,Loading
+      NewApplicationButtons,
+      Loading,
+      "share-button": comps.ShareButton,
     },
     mounted: function () {
       this.initializeAppDeployment(()=>{
@@ -145,13 +152,12 @@
       })
     },
     data: function () {
-      var appDeployments = this.getCompleteData
-      console.log("Application Deployment Data", appDeployments)
       return {
-        "appDeployments": appDeployments,
+        "appDeployments": this.getCompleteData ? this.getCompleteData : {},
         "computeHosts":[],
         "queues":[],
-        "appDeploymentIndex":null
+        "appDeploymentIndex":null,
+        sharedEntity: null,
       }
     },
     computed: {
@@ -214,6 +220,11 @@
         var temp=this.appDeployments.appDeployments[value]
         temp.appDeployments=this.appDeployments.appDeployments
         this.appDeployments=temp
+      },
+      "appDeployments.appDeploymentId": function (value) {
+        DjangoAiravataAPI.services.ServiceFactory.service("SharedEntities")
+          .retrieve({lookup: value})
+          .then(sharedEntity => this.sharedEntity = sharedEntity);
       }
     }
   }
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index 791e972..c40bf7f 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -739,6 +739,7 @@ class SharedEntityViewSet(mixins.RetrieveModelMixin,
                           GenericAPIBackedViewSet):
     serializer_class = serializers.SharedEntitySerializer
     lookup_field = 'entity_id'
+    lookup_value_regex = '[^/]+'
 
     def get_instance(self, lookup_value):
         users = {}


Mime
View raw message