airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 04/05: AIRAVATA-2835 Change GroupResourceProfile editor to use ShareButton
Date Wed, 11 Jul 2018 17:10:07 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 ee15be56426d7bc0bf5c2a29ec8aefc12a97054c
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Wed Jul 11 12:39:23 2018 -0400

    AIRAVATA-2835 Change GroupResourceProfile editor to use ShareButton
---
 .../GroupComputeResourcePreference.vue             | 42 ++--------------------
 .../django_airavata_api/js/service_config.js       |  4 ++-
 2 files changed, 5 insertions(+), 41 deletions(-)

diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/GroupComputeResourcePreference.vue
b/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/GroupComputeResourcePreference.vue
index af956ea..235f8b7 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/GroupComputeResourcePreference.vue
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/components/admin/group_resource_preferences/GroupComputeResourcePreference.vue
@@ -8,11 +8,8 @@
           <input type="text" v-model="data.groupResourceProfileName"/>
         </div>
         <div class="entry">
-          <div class="heading">Groups</div>
-          <auto-complete v-model="selectedGroups"
-                         v-bind:suggestions="groups"></auto-complete>
+          <share-button v-if="sharedEntity" v-model="sharedEntity"/>
         </div>
-        <share-button v-if="sharedEntity" v-model="sharedEntity"/>
       </div>
       <div class="new-application-tab-main">
         <h4>Compute Preferences</h4>
@@ -73,14 +70,9 @@
       }
     },
     mounted: function () {
-      this.fetchGroups().then((value => {
-        this.groups = value.results;
-      }));
-      this.fetchGroup(this.value.groupResourceProfileId);
       if (this.value.groupResourceProfileId) {
         DjangoAiravataAPI.services.ServiceFactory.service("SharedEntities").retrieve({lookup:
this.value.groupResourceProfileId})
-          // TODO: once ServiceFactory supports model classes, won't need to do this conversion
-          .then(sharedEntity => this.sharedEntity = new DjangoAiravataAPI.models.SharedEntity(sharedEntity));
+          .then(sharedEntity => this.sharedEntity = sharedEntity);
       }
     },
     data: function () {
@@ -89,10 +81,8 @@
         data = this.transformData(data);
       }
       return {
-        selectedGroups: [],
         data: data,
         service: DjangoAiravataAPI.services.ServiceFactory.service("GroupResourcePreference"),
-        groups: [],
         sharedEntity: null,
 
       }
@@ -203,7 +193,6 @@
             console.log("Completed")
             if (data) {
               this.data = this.transformData(data);
-              this.allowGroups();
             }
           });
         } else {
@@ -211,22 +200,10 @@
             console.log("Completed")
             if (data) {
               this.data = this.transformData(data);
-              this.allowGroups();
             }
           });
         }
       },
-      fetchGroups: function () {
-        return DjangoAiravataAPI.services.GroupService.list()
-      },
-      fetchGroup: function (groupResourceProfileId) {
-        if (groupResourceProfileId) {
-          DjangoAiravataAPI.services.ServiceFactory.service('SharedEntitiesGroups').retrieve({lookup:
groupResourceProfileId}).then((groups) => {
-            console.log("Selected Groups", groups);
-            this.selectedGroups = groups.groupList;
-          });
-        }
-      },
       computePreferenceClickHandler: function (index) {
         this.$router.push({
           name: 'compute_preferences', params: {
@@ -240,21 +217,6 @@
         // TODO: load compute resources to get the real name
         return (computeResourceId && computeResourceId.indexOf("_") > 0) ? computeResourceId.split("_")[0]
: computeResourceId;
       },
-      allowGroups: function () {
-        return DjangoAiravataAPI.services.ServiceFactory.service('SharedEntitiesGroups').update({
-          lookup: this.data.groupResourceProfileId,
-          data: {
-            groupList: this.selectedGroups,
-            entityId: this.data.groupResourceProfileId
-          }
-        }).then((groups) => {
-          console.log("Selected Groups", groups);
-            this.selectedGroups = groups.groupList;
-            return
-        }, (response) => console.log("Failed Resp ", response));
-      },
-      fetchAllowedGroups: function () {
-      }
     },
     watch: {
       'data.groupResourceProfileId': function (newValue) {
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/service_config.js b/django_airavata/apps/api/static/django_airavata_api/js/service_config.js
index d60f05f..d26953a 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/service_config.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/service_config.js
@@ -1,4 +1,5 @@
 import Group from './models/Group'
+import SharedEntity from './models/SharedEntity'
 
 const post = "post";
 const get = "get";
@@ -50,7 +51,8 @@ export default {
     },
     "SharedEntities": {
         url: "/api/shared-entities",
-        viewSet: true
+        viewSet: true,
+        modelClass: SharedEntity,
     },
     "Groups": {
         url: "/api/groups",


Mime
View raw message