Author: yusaku
Date: Thu Feb 28 20:51:00 2013
New Revision: 1451333

URL: http://svn.apache.org/r1451333
Log:
AMBARI-1501. Nagios alerts do not update automatically. (yusaku)

Modified:
    
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js
    incubator/ambari/trunk/ambari-web/app/utils/updater.js

Modified: 
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js?rev=1451333&r1=1451332&r2=1451333&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js 
(original)
+++ 
incubator/ambari/trunk/ambari-web/app/controllers/global/cluster_controller.js 
Thu Feb 28 20:51:00 2013
@@ -229,6 +229,16 @@ App.ClusterController = Em.Controller.ex
   },
 
   /**
+   * Run <code>loadUpdatedStatus</code> with delay
+   * @param delay
+   */
+  loadUpdatedStatusDelayed: function(delay){
+    setTimeout(function(){
+      App.updater.immediateRun('loadUpdatedStatus');
+    }, delay);
+  },
+
+  /**
    * Start polling, when <code>isWorking</code> become true
    */
   startPolling: function(){

Modified: incubator/ambari/trunk/ambari-web/app/utils/updater.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/utils/updater.js?rev=1451333&r1=1451332&r2=1451333&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/utils/updater.js (original)
+++ incubator/ambari/trunk/ambari-web/app/utils/updater.js Thu Feb 28 20:51:00 
2013
@@ -45,6 +45,14 @@ function update(obj, name, isWorking){
   return true;
 };
 
+function rerun(name){
+  var state = states[name];
+  if(state){
+    clearTimeout(state.timeout);
+    state.func();
+  }
+};
+
 App.updater = {
 
   /**
@@ -95,6 +103,21 @@ App.updater = {
    */
   run: function(obj, name, isWorking){
     return update(obj, name, isWorking);
+  },
+
+  /**
+   * Immediate run function, which is periodically running using 
<code>run</code> method
+   * Example:
+   *    App.updater.run(obj, 'clickIt');
+   *    App.updater.immediateRun('clickIt');
+   *
+   * <code>clickIt</code> will be executed immediately and proceed executing 
periodically
+   *
+   * @param name Method name, which was used as a parameter in 
<code>run</code> method
+   * @return {*}
+   */
+  immediateRun: function(name){
+    return rerun(name);
   }
 
 }


Reply via email to