You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2020/05/08 13:08:38 UTC

[airavata-django-portal] branch develop updated: AIRAVATA-3299 AIRAVATA-3300 Apply validation even when no queue options

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 e8d6515  AIRAVATA-3299 AIRAVATA-3300 Apply validation even when no queue options
     new 4b78b1e  Merge branch 'AIRAVATA-3299-bug-unselected-queues-in-grp-is-listed-in-create' into develop
e8d6515 is described below

commit e8d651557ba5cdaf7efb2407a2c4f33f75f40d22
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu May 7 18:24:52 2020 -0400

    AIRAVATA-3299 AIRAVATA-3300 Apply validation even when no queue options
---
 .../js/models/ComputationalResourceSchedulingModel.js         | 11 +++++++----
 .../js/components/experiment/QueueSettingsEditor.vue          | 11 ++++++-----
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/ComputationalResourceSchedulingModel.js b/django_airavata/apps/api/static/django_airavata_api/js/models/ComputationalResourceSchedulingModel.js
index 5871a99..e919f1e 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/ComputationalResourceSchedulingModel.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/ComputationalResourceSchedulingModel.js
@@ -20,30 +20,33 @@ export default class ComputationalResourceSchedulingModel extends BaseModel {
         super(FIELDS, data);
     }
 
-    validate(queueInfo, batchQueueResourcePolicy = null) {
+    validate(queueInfo = null, batchQueueResourcePolicy = null) {
         const validationResults = {};
         if (this.isEmpty(this.resourceHostId)) {
             validationResults['resourceHostId'] = "Please select a compute resource.";
         }
+        if (this.isEmpty(this.queueName)) {
+          validationResults['queueName'] = "Please select a queue.";
+        }
         if (!(this.nodeCount > 0)) {
             validationResults['nodeCount'] = "Enter a node count greater than 0.";
         } else if (batchQueueResourcePolicy && this.nodeCount > batchQueueResourcePolicy.maxAllowedNodes) {
             validationResults['nodeCount'] = `Enter a node count no greater than ${batchQueueResourcePolicy.maxAllowedNodes}.`;
-        } else if (queueInfo.maxNodes && this.nodeCount > queueInfo.maxNodes) {
+        } else if (queueInfo && queueInfo.maxNodes && this.nodeCount > queueInfo.maxNodes) {
             validationResults['nodeCount'] = `Enter a node count no greater than ${queueInfo.maxNodes}.`;
         }
         if (!(this.totalCPUCount > 0)) {
             validationResults['totalCPUCount'] = "Enter a core count greater than 0.";
         } else if (batchQueueResourcePolicy && this.totalCPUCount > batchQueueResourcePolicy.maxAllowedCores) {
             validationResults['totalCPUCount'] = `Enter a core count no greater than ${batchQueueResourcePolicy.maxAllowedCores}.`;
-        } else if (queueInfo.maxProcessors && this.totalCPUCount > queueInfo.maxProcessors) {
+        } else if (queueInfo && queueInfo.maxProcessors && this.totalCPUCount > queueInfo.maxProcessors) {
             validationResults['totalCPUCount'] = `Enter a core count no greater than ${queueInfo.maxProcessors}.`;
         }
         if (!(this.wallTimeLimit > 0)) {
             validationResults['wallTimeLimit'] = "Enter a wall time limit greater than 0.";
         } else if (batchQueueResourcePolicy && this.wallTimeLimit > batchQueueResourcePolicy.maxAllowedWalltime) {
             validationResults['wallTimeLimit'] = `Enter a wall time limit no greater than ${batchQueueResourcePolicy.maxAllowedWalltime}.`;
-        } else if (queueInfo.maxRunTime && this.wallTimeLimit > queueInfo.maxRunTime) {
+        } else if (queueInfo && queueInfo.maxRunTime && this.wallTimeLimit > queueInfo.maxRunTime) {
             validationResults['wallTimeLimit'] = `Enter a wall time limit no greater than ${queueInfo.maxRunTime}.`;
         }
         return validationResults;
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 0b33609..e50a3f0 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
@@ -40,7 +40,7 @@
           <b-form-group
             label="Select a Queue"
             label-for="queue"
-            :feedback="getValidationFeedback('queueName')"
+            :invalid-feedback="getValidationFeedback('queueName')"
             :state="getValidationState('queueName')"
           >
             <b-form-select
@@ -59,7 +59,7 @@
           <b-form-group
             label="Node Count"
             label-for="node-count"
-            :feedback="getValidationFeedback('nodeCount')"
+            :invalid-feedback="getValidationFeedback('nodeCount')"
             :state="getValidationState('nodeCount', true)"
           >
             <b-form-input
@@ -80,7 +80,7 @@
           <b-form-group
             label="Total Core Count"
             label-for="core-count"
-            :feedback="getValidationFeedback('totalCPUCount')"
+            :invalid-feedback="getValidationFeedback('totalCPUCount')"
             :state="getValidationState('totalCPUCount', true)"
           >
             <b-form-input
@@ -101,7 +101,7 @@
           <b-form-group
             label="Wall Time Limit (in minutes)"
             label-for="walltime-limit"
-            :feedback="getValidationFeedback('wallTimeLimit')"
+            :invalid-feedback="getValidationFeedback('wallTimeLimit')"
             :state="getValidationState('wallTimeLimit', true)"
           >
             <b-input-group right="minutes">
@@ -264,7 +264,7 @@ export default {
     validation() {
       // Don't run validation if we don't have selectedQueueDefault
       if (!this.selectedQueueDefault) {
-        return {};
+        return this.data.validate();
       }
       return this.data.validate(
         this.selectedQueueDefault,
@@ -298,6 +298,7 @@ export default {
     },
     setDefaultQueue() {
       if (this.queueDefaults.length === 0) {
+        this.data.queueName = null;
         return;
       }
       const defaultQueue = this.queueDefaults[0];