airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [3/4] airavata-php-gateway git commit: AIRAVATA-2520 Defer running queue block init code until jquery loaded
Date Fri, 29 Sep 2017 20:42:36 GMT
AIRAVATA-2520 Defer running queue block init code until jquery loaded

Also made some pull request review changes


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/07d3255b
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/07d3255b
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/07d3255b

Branch: refs/heads/develop
Commit: 07d3255be5cf882a67b785d69a68b1796d6d5e85
Parents: 33b1b88
Author: Marcus Christie <machrist@iu.edu>
Authored: Fri Sep 29 16:37:14 2017 -0400
Committer: Marcus Christie <machrist@iu.edu>
Committed: Fri Sep 29 16:37:14 2017 -0400

----------------------------------------------------------------------
 app/views/experiment/edit.blade.php             |  2 -
 .../partials/experiment-queue-block.blade.php   | 49 +++++++++++---------
 2 files changed, 28 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/07d3255b/app/views/experiment/edit.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/edit.blade.php b/app/views/experiment/edit.blade.php
index aeeb620..714db8a 100755
--- a/app/views/experiment/edit.blade.php
+++ b/app/views/experiment/edit.blade.php
@@ -13,8 +13,6 @@
 
 //$appResources = array('Echo' => $echoResources, 'WRF' => $wrfResources);
 ?>
-<!-- Included the jquery script here! -->
-<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
 
 <div class="container">
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/07d3255b/app/views/partials/experiment-queue-block.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-queue-block.blade.php b/app/views/partials/experiment-queue-block.blade.php
index 8935ff1..61948d4 100644
--- a/app/views/partials/experiment-queue-block.blade.php
+++ b/app/views/partials/experiment-queue-block.blade.php
@@ -123,6 +123,7 @@
 </div>
 
 <script>
+var experimentQueueBlockInit = function() {
     //To work with experiment edit (Not Ajax)
     $( document ).ready(function() {
         var selectedQueue = $("#select-queue").val();
@@ -178,15 +179,13 @@
         });
     });
     
-    //I commented this as I see this as repeated code!
-
-    //To work work with experiment create (Ajax)
-    // var selectedQueue = $("#select-queue").val();
-    // getQueueData(selectedQueue);
-    // $("#select-queue").change(function () {
-    //     var selectedQueue = $(this).val();
-    //     getQueueData(selectedQueue);
-    // });
+    // To work work with experiment create (Ajax)
+    var selectedQueue = $("#select-queue").val();
+    getQueueData(selectedQueue);
+    $("#select-queue").change(function () {
+        var selectedQueue = $(this).val();
+        getQueueData(selectedQueue);
+    });
 
     $("#enable-auto-scheduling").change(function () {
         var selectedQueue = $("#select-queue").val();
@@ -198,10 +197,10 @@
         var queueDefaults = $.parseJSON($("#queue-defaults-array").val());
         var appDefaults = $.parseJSON($("#app-deployment-defaults-array").val());
         //getting the html values we set to hidden fields above!
-        var nodeCount = parseInt($("#passed-nodeCount").val());
-        var cpuCount = parseInt($('#passed-cpuCount').val());
-        var wallTime = parseInt($('#passed-wallTime').val());
-        var physicalMemory = parseInt($('#passed-physicalmem').val());
+        var passedNodeCount = parseInt($("#passed-nodeCount").val());
+        var passedCpuCount = parseInt($('#passed-cpuCount').val());
+        var passedWallTime = parseInt($('#passed-wallTime').val());
+        var passedPhysicalMemory = parseInt($('#passed-physicalmem').val());
         var veryLargeValue = 9999999;
 
         console.log(queues);
@@ -229,8 +228,8 @@
                     $("#node-count").val(queueDefaults['nodeCount']);
                 }
                 // load previously set values on page load.
-                if(nodeCount!=0){
-                    $("#node-count").val(nodeCount);
+                if(passedNodeCount!=0){
+                    $("#node-count").val(passedNodeCount);
                 }
 
                 //core-count
@@ -255,8 +254,8 @@
                 }
 
                 // load previously set values on page load.
-                if(cpuCount!=0){
-                    $("#cpu-count").val(cpuCount);
+                if(passedCpuCount!=0){
+                    $("#cpu-count").val(passedCpuCount);
                 }
 
 
@@ -280,8 +279,8 @@
                 }
 
                 // load previously set values on page load.
-                if(wallTime!=0){
-                    $("#wall-time").val(wallTime);
+                if(passedWallTime!=0){
+                    $("#wall-time").val(passedWallTime);
                 }
 
                 //memory-count
@@ -304,8 +303,8 @@
                 }
 
                 // load previously set values on page load.
-                if(physicalMemory!=0){
-                    $("#memory-count").val(physicalMemory);
+                if(passedPhysicalMemory!=0){
+                    $("#memory-count").val(passedPhysicalMemory);
                 }
 
 
@@ -336,4 +335,12 @@
         }
         $(".queue-view").removeClass("hide");
     }
+}
+
+// On initial load jQuery isn't loaded until later so wait until DOMContentLoaded
+if (typeof $ === 'undefined') {
+    document.addEventListener("DOMContentLoaded", experimentQueueBlockInit);
+} else {
+    experimentQueueBlockInit();
+}
 </script>
\ No newline at end of file


Mime
View raw message