Browse Source

HUE-2430 [pig] Progress bars of running scripts not updated on Dashboard

Changed dashboard to be refreshed also when scripts are not running
Fixed a but with failed logs retrieval
Enrico Berti 11 years ago
parent
commit
d24ab972cc
3 changed files with 2 additions and 11 deletions
  1. 1 0
      apps/pig/src/pig/api.py
  2. 1 10
      apps/pig/src/pig/templates/app.mako
  3. 0 1
      apps/pig/static/js/pig.ko.js

+ 1 - 0
apps/pig/src/pig/api.py

@@ -159,6 +159,7 @@ class OozieApi:
 
       except Exception, e:
         LOG.error('An error happen while watching the demo running: %(error)s' % {'error': e})
+        is_really_done = True
 
     workflow_actions = []
 

+ 1 - 10
apps/pig/src/pig/templates/app.mako

@@ -1115,10 +1115,6 @@ ${ commonshare() | n,unicode }
       showAlert("<b>" + viewModel.currentScript().name() + "</b> ${_('has been saved correctly.')}");
     });
 
-    $(document).on("refreshDashboard", function () {
-      refreshDashboard();
-    });
-
     $(document).on("showDashboard", function () {
       routie("dashboard");
       $.jHueTitleUpdater.reset();
@@ -1168,15 +1164,10 @@ ${ commonshare() | n,unicode }
 
     refreshDashboard();
 
-    var dashboardRefreshInterval = window.setInterval(function () {
-      if (viewModel.runningScripts().length > 0) {
-        refreshDashboard();
-      }
-    }, 3000);
-
     function refreshDashboard() {
       $.getJSON("${ url('pig:dashboard') }", function (data) {
         viewModel.updateDashboard(data);
+        window.setTimeout(refreshDashboard, viewModel.runningScripts().length > 0 ? 3000 : 10000);
       });
     }
 

+ 0 - 1
apps/pig/static/js/pig.ko.js

@@ -542,7 +542,6 @@ var PigViewModel = function (props) {
           script.isRunning(true);
           script.watchUrl(data.watchUrl);
           $(document).trigger("startLogsRefresh");
-          $(document).trigger("refreshDashboard");
           self.updateScripts();
         }, "json").fail( function(xhr, textStatus, errorThrown) {
           $(document).trigger("error", xhr.responseText);