ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-6255 Refreshing of components indicators is too slow. (Buzhor Denys via atkach)
Date Tue, 24 Jun 2014 15:12:02 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 aa07dc031 -> 494d5bf7a


AMBARI-6255 Refreshing of components indicators is too slow. (Buzhor Denys via atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/494d5bf7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/494d5bf7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/494d5bf7

Branch: refs/heads/branch-1.6.1
Commit: 494d5bf7a5944ea49c1c7b85ed6dbba192e3aaf3
Parents: aa07dc0
Author: atkach <atkach@hortonworks.com>
Authored: Tue Jun 24 18:10:07 2014 +0300
Committer: atkach <atkach@hortonworks.com>
Committed: Tue Jun 24 18:11:58 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/global/update_controller.js | 33 ++++++++------------
 ambari-web/app/utils/updater.js                 | 13 +++++++-
 ambari-web/app/views/main/host/details.js       |  1 +
 3 files changed, 26 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/494d5bf7/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index f8288ac..58b94fe 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -116,7 +116,7 @@ App.UpdateController = Em.Controller.extend({
   updateAll: function () {
     if (this.get('isWorking')) {
       App.updater.run(this, 'updateServices', 'isWorking');
-      App.updater.run(this, 'updateHostConditionally', 'isWorking');
+      App.updater.run(this, 'updateHost', 'isWorking');
       App.updater.run(this, 'updateServiceMetricConditionally', 'isWorking', App.componentsUpdateInterval);
       App.updater.run(this, 'updateComponentsState', 'isWorking', App.componentsUpdateInterval);
       App.updater.run(this, 'graphsUpdate', 'isWorking');
@@ -126,21 +126,6 @@ App.UpdateController = Em.Controller.extend({
     }
   }.observes('isWorking'),
   /**
-   * Update hosts depending on which page is open
-   * Make a call only on follow pages:
-   * /main/hosts
-   * /main/hosts/*
-   * /main/charts/heatmap
-   * @param callback
-   */
-  updateHostConditionally: function (callback) {
-    if (/\/main\/(hosts|charts\/heatmap).*/.test(this.get('location'))) {
-      this.updateHost(callback);
-    } else {
-      callback();
-    }
-  },
-  /**
    * Update service metrics depending on which page is open
    * Make a call only on follow pages:
    * /main/dashboard
@@ -158,10 +143,18 @@ App.UpdateController = Em.Controller.extend({
   updateHost: function (callback, error) {
     var testUrl = App.get('isHadoop2Stack') ? '/data/hosts/HDP2/hosts.json' : '/data/hosts/hosts.json';
     var realUrl = '/hosts?<parameters>fields=Hosts/host_name,Hosts/maintenance_state,Hosts/public_host_name,Hosts/cpu_count,Hosts/ph_cpu_count,Hosts/total_mem,'
+
-        'Hosts/host_status,Hosts/last_heartbeat_time,Hosts/os_arch,Hosts/os_type,Hosts/ip,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,'
+
-        'host_components/HostRoles/stale_configs,host_components/HostRoles/service_name,metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,'
+
-        'metrics/memory/mem_total,metrics/memory/mem_free,alerts/summary&minimal_response=true';
-
+      'Hosts/host_status,Hosts/last_heartbeat_time,Hosts/os_arch,Hosts/os_type,Hosts/ip,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,'
+
+      'host_components/HostRoles/stale_configs,host_components/HostRoles/service_name,metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,'
+
+      'metrics/memory/mem_total,metrics/memory/mem_free,alerts/summary&minimal_response=true';
+    if (App.router.get('currentState.name') == 'index' && App.router.get('currentState.parentState.name')
== 'hosts') {
+      App.updater.updateInterval('updateHost', App.get('contentUpdateInterval'));
+    } else if(App.router.get('currentState.name') == 'summary' && App.router.get('currentState.parentState.name')
== 'hostDetails') {
+      realUrl = realUrl.replace('<parameters>', 'Hosts/host_name=' + App.router.get('location.lastSetURL').match(/\/hosts\/(.*)\/summary/)[1]
+ '&');
+      App.updater.updateInterval('updateHost', App.get('componentsUpdateInterval'));
+    } else {
+      callback();
+      return;
+    }
     this.get('queryParams').set('Hosts', App.router.get('mainHostController').getQueryParameters());
     var hostsUrl = this.getComplexUrl(testUrl, realUrl, this.get('queryParams.Hosts'));
     App.HttpClient.get(hostsUrl, App.hostsMapper, {

http://git-wip-us.apache.org/repos/asf/ambari/blob/494d5bf7/ambari-web/app/utils/updater.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/updater.js b/ambari-web/app/utils/updater.js
index 36d8c51..9dbd83f 100644
--- a/ambari-web/app/utils/updater.js
+++ b/ambari-web/app/utils/updater.js
@@ -39,13 +39,14 @@ function update(obj, name, isWorking, interval){
         obj[name](callback);
         return true;
       },
+      interval: interval,
       callback: callback
     };
   }
 
   clearTimeout(state.timeout);
 
-  state.timeout = setTimeout(state.func, interval);
+  state.timeout = setTimeout(state.func, state.interval);
   return true;
 }
 
@@ -124,6 +125,16 @@ App.updater = {
    */
   immediateRun: function(name){
     return rerun(name);
+  },
+  /**
+   * Update interval for state by its name.
+   *
+   * @param name - state name
+   * @param value - new interval value
+   **/
+  updateInterval: function(name, value) {
+    if (!states[name]) return;
+    states[name].interval = value;
   }
 
 };

http://git-wip-us.apache.org/repos/asf/ambari/blob/494d5bf7/ambari-web/app/views/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details.js b/ambari-web/app/views/main/host/details.js
index 5a01b92..7a5c01a 100644
--- a/ambari-web/app/views/main/host/details.js
+++ b/ambari-web/app/views/main/host/details.js
@@ -45,6 +45,7 @@ App.MainHostDetailsView = Em.View.extend({
       App.router.transitionTo('main.hosts.index');
       return;
     }
+    App.router.get('updateController').updateHost(Em.K);
     App.tooltip($("[rel='HealthTooltip']"));
   }
 });


Mime
View raw message