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

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


The following commit(s) were added to refs/heads/develop by this push:
     new 41c0aad  AIRAVATA-3299 Update list of queues when GRP changes
     new ff3437d  Merge branch 
'AIRAVATA-3299-bug-unselected-queues-in-grp-is-listed-in-create' into develop
41c0aad is described below

commit 41c0aadc40b780e6fa521d399912b5e832ea553a
Author: Marcus Christie <[email protected]>
AuthorDate: Mon Apr 13 15:12:41 2020 -0400

    AIRAVATA-3299 Update list of queues when GRP changes
---
 .../components/experiment/QueueSettingsEditor.vue  | 158 ++++++++++++---------
 1 file changed, 89 insertions(+), 69 deletions(-)

diff --git 
a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/QueueSettingsEditor.vue
 
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/QueueSettingsEditor.vue
index b8af3e9..84087f6 100644
--- 
a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/QueueSettingsEditor.vue
+++ 
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/QueueSettingsEditor.vue
@@ -1,29 +1,35 @@
 <template>
-
   <div>
     <div class="row">
       <div class="col">
-        <div
-          class="card border-default"
-          :class="{ 'border-danger': !valid }"
-        >
+        <div class="card border-default" :class="{ 'border-danger': !valid }">
           <b-link
             @click="showConfiguration = !showConfiguration"
             class="card-link text-dark"
           >
             <div class="card-body">
-              <h5 class="card-title mb-4">Settings for queue {{ 
localComputationalResourceScheduling.queueName }}</h5>
+              <h5 class="card-title mb-4">
+                Settings for queue
+                {{ localComputationalResourceScheduling.queueName }}
+              </h5>
               <div class="row">
                 <div class="col">
-                  <h3 class="h5 mb-0">{{ 
localComputationalResourceScheduling.nodeCount }}</h3>
+                  <h3 class="h5 mb-0">
+                    {{ localComputationalResourceScheduling.nodeCount }}
+                  </h3>
                   <span class="text-muted text-uppercase">NODE COUNT</span>
                 </div>
                 <div class="col">
-                  <h3 class="h5 mb-0">{{ 
localComputationalResourceScheduling.totalCPUCount }}</h3>
+                  <h3 class="h5 mb-0">
+                    {{ localComputationalResourceScheduling.totalCPUCount }}
+                  </h3>
                   <span class="text-muted text-uppercase">CORE COUNT</span>
                 </div>
                 <div class="col">
-                  <h3 class="h5 mb-0">{{ 
localComputationalResourceScheduling.wallTimeLimit }} minutes</h3>
+                  <h3 class="h5 mb-0">
+                    {{ localComputationalResourceScheduling.wallTimeLimit }}
+                    minutes
+                  </h3>
                   <span class="text-muted text-uppercase">TIME LIMIT</span>
                 </div>
               </div>
@@ -51,7 +57,7 @@
             >
             </b-form-select>
             <div slot="description">
-              {{ selectedQueueDefault.queueDescription }}
+              {{ queueDescription }}
             </div>
           </b-form-group>
           <b-form-group
@@ -71,10 +77,7 @@
             >
             </b-form-input>
             <div slot="description">
-              <i
-                class="fa fa-info-circle"
-                aria-hidden="true"
-              ></i>
+              <i class="fa fa-info-circle" aria-hidden="true"></i>
               Max Allowed Nodes = {{ maxNodes }}
             </div>
           </b-form-group>
@@ -95,10 +98,7 @@
             >
             </b-form-input>
             <div slot="description">
-              <i
-                class="fa fa-info-circle"
-                aria-hidden="true"
-              ></i>
+              <i class="fa fa-info-circle" aria-hidden="true"></i>
               Max Allowed Cores = {{ maxCPUCount }}
             </div>
           </b-form-group>
@@ -121,10 +121,7 @@
               </b-form-input>
             </b-input-group>
             <div slot="description">
-              <i
-                class="fa fa-info-circle"
-                aria-hidden="true"
-              ></i>
+              <i class="fa fa-info-circle" aria-hidden="true"></i>
               Max Allowed Wall Time = {{ maxWalltime }} minutes
             </div>
           </b-form-group>
@@ -134,11 +131,9 @@
               href="#"
               @click.prevent="showConfiguration = false"
             >
-              <i
-                class="fa fa-times text-secondary"
-                aria-hidden="true"
-              ></i>
-              Hide Settings</a>
+              <i class="fa fa-times text-secondary" aria-hidden="true"></i>
+              Hide Settings</a
+            >
           </div>
         </div>
       </div>
@@ -172,8 +167,8 @@ export default {
   },
   data() {
     return {
-      queueDefaults: [],
-      showConfiguration: false
+      showConfiguration: false,
+      appDeploymentQueues: null
     };
   },
   computed: {
@@ -197,6 +192,9 @@ export default {
       );
     },
     maxCPUCount: function() {
+      if (!this.selectedQueueDefault) {
+        return 0;
+      }
       const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(
         this.selectedQueueDefault.queueName
       );
@@ -209,6 +207,9 @@ export default {
       return this.selectedQueueDefault.maxProcessors;
     },
     maxNodes: function() {
+      if (!this.selectedQueueDefault) {
+        return 0;
+      }
       const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(
         this.selectedQueueDefault.queueName
       );
@@ -221,6 +222,9 @@ export default {
       return this.selectedQueueDefault.maxNodes;
     },
     maxWalltime: function() {
+      if (!this.selectedQueueDefault) {
+        return 0;
+      }
       const batchQueueResourcePolicy = this.getBatchQueueResourcePolicy(
         this.selectedQueueDefault.queueName
       );
@@ -232,6 +236,27 @@ export default {
       }
       return this.selectedQueueDefault.maxRunTime;
     },
+    queueDefaults() {
+      return this.appDeploymentQueues
+        ? this.appDeploymentQueues
+            .filter(q => this.isQueueInComputeResourcePolicy(q.queueName))
+            .sort((a, b) => {
+              // Sort default first, then by alphabetically by name
+              if (a.isDefaultQueue) {
+                return -1;
+              } else if (b.isDefaultQueue) {
+                return 1;
+              } else {
+                return a.queueName.localeCompare(b.queueName);
+              }
+            })
+        : [];
+    },
+    queueDescription() {
+      return this.selectedQueueDefault
+        ? this.selectedQueueDefault.queueDescription
+        : null;
+    },
     validation() {
       // Don't run validation if we don't have selectedQueueDefault
       if (!this.selectedQueueDefault) {
@@ -262,41 +287,28 @@ export default {
         this.$emit("valid");
       }
     },
-    loadQueueDefaults: function(updateQueueSettings) {
+    loadAppDeploymentQueues() {
       return services.ApplicationDeploymentService.getQueues({
         lookup: this.appDeploymentId
-      }).then(queueDefaults => {
-        // Sort queue defaults
-        this.queueDefaults = queueDefaults
-          .filter(q => this.isQueueInComputeResourcePolicy(q.queueName))
-          .sort((a, b) => {
-            // Sort default first, then by alphabetically by name
-            if (a.isDefaultQueue) {
-              return -1;
-            } else if (b.isDefaultQueue) {
-              return 1;
-            } else {
-              return a.queueName.localeCompare(b.queueName);
-            }
-          });
-
-        if (updateQueueSettings) {
-          // Find the default queue and apply it's settings
-          const defaultQueue = this.queueDefaults[0];
+      }).then(queueDefaults => (this.appDeploymentQueues = queueDefaults));
+    },
+    setDefaultQueue() {
+      if (this.queueDefaults.length === 0) {
+        return;
+      }
+      const defaultQueue = this.queueDefaults[0];
 
-          this.localComputationalResourceScheduling.queueName =
-            defaultQueue.queueName;
-          this.localComputationalResourceScheduling.totalCPUCount = 
this.getDefaultCPUCount(
-            defaultQueue
-          );
-          this.localComputationalResourceScheduling.nodeCount = 
this.getDefaultNodeCount(
-            defaultQueue
-          );
-          this.localComputationalResourceScheduling.wallTimeLimit = 
this.getDefaultWalltime(
-            defaultQueue
-          );
-        }
-      });
+      this.localComputationalResourceScheduling.queueName =
+        defaultQueue.queueName;
+      this.localComputationalResourceScheduling.totalCPUCount = 
this.getDefaultCPUCount(
+        defaultQueue
+      );
+      this.localComputationalResourceScheduling.nodeCount = 
this.getDefaultNodeCount(
+        defaultQueue
+      );
+      this.localComputationalResourceScheduling.wallTimeLimit = 
this.getDefaultWalltime(
+        defaultQueue
+      );
     },
     isQueueInComputeResourcePolicy: function(queueName) {
       if (!this.computeResourcePolicy) {
@@ -363,19 +375,27 @@ export default {
     }
   },
   watch: {
-    appDeploymentId: function() {
-      this.loadQueueDefaults(true);
+    appDeploymentId() {
+      this.loadAppDeploymentQueues().then(() => this.setDefaultQueue());
+    },
+    computeResourcePolicy() {
+      this.setDefaultQueue();
+    },
+    batchQueueResourcePolicies() {
+      this.setDefaultQueue();
     }
   },
   mounted: function() {
-    // For brand new queue settings (no queueName specified) load the default
-    // queue and its default values and apply them
-    const updateQueueSettings = !this.value.queueName;
-    this.loadQueueDefaults(updateQueueSettings).then(() => this.validate());
+    this.loadAppDeploymentQueues().then(() => {
+      // For brand new queue settings (no queueName specified) load the default
+      // queue and its default values and apply them
+      if (!this.value.queueName) {
+        this.setDefaultQueue();
+      }
+    });
     this.$on("input", () => this.validate());
   }
 };
 </script>
 
-<style>
-</style>
+<style></style>

Reply via email to