airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 08/13: AIRAVATA-2727 GroupResourceProfile save and cancel buttons
Date Tue, 14 Aug 2018 19:51:50 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 b9e2c8f1f3edeaa485f407f6fae6f39b7d6f7deb
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Mon Aug 13 14:44:30 2018 -0400

    AIRAVATA-2727 GroupResourceProfile save and cancel buttons
---
 .../GroupComputeResourcePreference.vue             | 22 +++++++++++++++++-----
 django_airavata/static/common/scss/main.scss       |  5 +++++
 2 files changed, 22 insertions(+), 5 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 fd98a6e..e0b182f 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
@@ -22,7 +22,7 @@
     </div>
     <list-layout :items="data.computePreferences" title="Compute Preferences"
       new-item-button-text="New Compute Preference"
-      @add-new-item="createComputePreferences">
+      @add-new-item="createComputePreference">
       <template slot="item-list" slot-scope="slotProps">
 
         <b-table hover :fields="computePreferencesFields" :items="slotProps.items"
@@ -36,6 +36,12 @@
         </b-table> 
       </template>
     </list-layout>
+    <div class="row">
+        <div class="col d-flex justify-content-end">
+            <b-button variant="primary" @click="saveGroupResourceProfile">Save</b-button>
+            <b-button class="ml-2" variant="secondary" @click="cancel">Cancel</b-button>
+        </div>
+    </div>
   </div>
 </template>
 <script>
@@ -91,17 +97,20 @@
     },
     methods: {
       saveGroupResourceProfile: function () {
+        var persist = null;
         if (this.data.groupResourceProfileId) {
-          DjangoAiravataAPI.utils.FetchUtils.put('/api/group-resource-profiles/' + this.data.groupResourceProfileId
+ '/', this.data)
-            .then((data) => this.data = data);
+          persist = this.service.update({data: this.data, lookup: this.data.groupResourceProfileId});
         } else {
-          this.service.create({data: this.data})
+          persist = this.service.create({data: this.data})
             .then((data) => {
-              this.data = data;
               // Save sharing settings too
               return this.$refs.shareButton.mergeAndSave(data.groupResourceProfileId);
             });
         }
+        // TODO: handle errors
+        persist.then(data => {
+          this.$router.push('/group-resource-profiles');
+        });
       },
       computePreferenceClickHandler: function (computeResourceId) {
         let computeResourcePreference = this.data.computePreferences.find(pref => pref.computeResourceId
=== computeResourceId);
@@ -122,6 +131,9 @@
         // TODO: load compute resources to get the real name
         return (computeResourceId && computeResourceId.indexOf("_") > 0) ? computeResourceId.split("_")[0]
: computeResourceId;
       },
+      cancel: function() {
+        this.$router.push('/group-resource-profiles');
+      }
     },
   }
 </script>
\ No newline at end of file
diff --git a/django_airavata/static/common/scss/main.scss b/django_airavata/static/common/scss/main.scss
index 95a2cc9..76b9684 100644
--- a/django_airavata/static/common/scss/main.scss
+++ b/django_airavata/static/common/scss/main.scss
@@ -110,6 +110,11 @@ body {
     max-width: 1200px;
 }
 
+/* Add extra padding at the bottom to accommodate for the scrolling under the fixed width
header */
+.main-content > :last-child {
+    padding-bottom: 70px;
+}
+
 .sidebar {
     flex-basis: 200px;
     background-color: #ffffff;


Mime
View raw message