You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2016/01/14 17:31:27 UTC

airavata-php-gateway git commit: persisting the auto refresh toggle state between experiment summary refreshes

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/master 430bf48c3 -> 88f7e7c17


persisting the auto refresh toggle state between experiment summary refreshes


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/88f7e7c1
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/88f7e7c1
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/88f7e7c1

Branch: refs/heads/master
Commit: 88f7e7c17abd34ae6b33a051ddbfbe6d64dd8e9d
Parents: 430bf48
Author: scnakandala <su...@gmail.com>
Authored: Thu Jan 14 11:31:21 2016 -0500
Committer: scnakandala <su...@gmail.com>
Committed: Thu Jan 14 11:31:21 2016 -0500

----------------------------------------------------------------------
 app/controllers/ExperimentController.php     |  9 +++++++--
 app/views/experiment/summary.blade.php       | 13 +++++++++++--
 app/views/partials/experiment-info.blade.php | 11 ++++++++---
 3 files changed, 26 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/88f7e7c1/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index ed953bf..2428556 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -80,7 +80,11 @@ class ExperimentController extends BaseController
     public function summary()
     {
         $experiment = ExperimentUtilities::get_experiment($_GET['expId']);
-        //var_dump( $detailedExperiment); exit;
+        if(isset($_GET['isAutoRefresh']) && $_GET['isAutoRefresh'] == 'true'){
+            $autoRefresh = true;
+        }else{
+            $autoRefresh = false;
+        }
         if ($experiment != null) {
             $project = ProjectUtilities::get_project($experiment->projectId);
             $expVal = ExperimentUtilities::get_experiment_values($experiment, $project);
@@ -103,7 +107,8 @@ class ExperimentController extends BaseController
                 "experiment" => $experiment,
                 "project" => $project,
                 "jobDetails" => $jobDetails,
-                "expVal" => $expVal
+                "expVal" => $expVal,
+                "autoRefresh"=> $autoRefresh
             );
             if( Input::has("dashboard"))
             {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/88f7e7c1/app/views/experiment/summary.blade.php
----------------------------------------------------------------------
diff --git a/app/views/experiment/summary.blade.php b/app/views/experiment/summary.blade.php
index 1643640..bccff89 100755
--- a/app/views/experiment/summary.blade.php
+++ b/app/views/experiment/summary.blade.php
@@ -12,14 +12,18 @@
 @section('scripts')
 @parent
 <script>
-    var autoRefresh = false;
+    @if($autoRefresh)
+        var autoRefresh = true;
+    @else
+        var autoRefresh = false;
+    @endif
     setInterval(function () {
         if (($.trim($(".exp-status").html()) != "COMPLETED" && $.trim($(".exp-status").html()) != "FAILED"
                 && $.trim($(".exp-status").html()) != "CANCELLED") && autoRefresh) {
             $.ajax({
                 type: "GET",
                 url: "{{URL::to('/') }}/experiment/summary",
-                data: {expId: "{{ Input::get('expId') }}" },
+                data: {expId: "{{ Input::get('expId') }}", isAutoRefresh : autoRefresh },
                 success: function (data) {
                     data = $.parseJSON( data);
                     //if ($.trim($("#expObj").val()) != $.trim(exp)) {
@@ -44,5 +48,10 @@
         }
         $(this).find('.btn').toggleClass('btn-default');
     });
+
+    $('#refresh-experiment').click(function() {
+        console.log(autoRefresh);
+        window.location.replace("{{URL::to('/') }}/experiment/summary?" + "expId=" + "{{ Input::get('expId') }}"+"&"+ "isAutoRefresh=" + autoRefresh);
+    });
 </script>
 @stop
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/88f7e7c1/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index f9917bf..275c81d 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -8,12 +8,17 @@
     <h1>
         Experiment Summary
         @if( !isset($dashboard))
-        <small><a href="{{ URL::to('/') }}/experiment/summary?expId={{ $experiment->experimentId }}"
+        <small><a id="refresh-experiment"
                   title="Refresh"><span class="glyphicon glyphicon-refresh refresh-exp"></span></a></small>
             <small><small>Enable Auto Refresh </small></small>
             <div class="btn-group btn-toggle">
-                <button class="btn btn-xs btn-default">ON</button>
-                <button class="btn btn-xs btn-primary active">OFF</button>
+                @if($autoRefresh == true)
+                    <button class="btn btn-xs btn-primary active">ON</button>
+                    <button class="btn btn-xs btn-default">OFF</button>
+                @else
+                    <button class="btn btn-xs btn-default">ON</button>
+                    <button class="btn btn-xs btn-primary active">OFF</button>
+                @endif
             </div>
         @endif
     </h1>