ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-4759 Host alerts indicator doesn't appear on ServicesPage without clicking 'Hosts' tab. (atkach)
Date Thu, 20 Feb 2014 12:55:39 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e2f9af986 -> 34b1ccbf2


AMBARI-4759 Host alerts indicator doesn't appear on ServicesPage without clicking 'Hosts'
tab. (atkach)


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

Branch: refs/heads/trunk
Commit: 34b1ccbf290dad5790680eb11e2542374d4fa61f
Parents: e2f9af9
Author: atkach <atkach@hortonworks.com>
Authored: Thu Feb 20 14:52:48 2014 +0200
Committer: atkach <atkach@hortonworks.com>
Committed: Thu Feb 20 14:52:48 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/global/cluster_controller.js |  2 +-
 ambari-web/app/controllers/global/update_controller.js  |  4 ++--
 ambari-web/app/mappers/hosts_mapper.js                  |  7 ++-----
 ambari-web/app/mappers/status_mapper.js                 | 12 ++++++++++++
 4 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/34b1ccbf/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index 2aa2714..049e59c 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -233,7 +233,7 @@ App.ClusterController = Em.Controller.extend({
       return false;
     }
     var testUrl = App.get('isHadoop2Stack') ? '/data/hosts/HDP2/hc_host_status.json' : '/data/dashboard/services.json';
-    var statusUrl = '/hosts?fields=Hosts/host_status,Hosts/passive_state,host_components/HostRoles/state,host_components/HostRoles/passive_state&minimal_response=true';
+    var statusUrl = '/hosts?fields=Hosts/host_status,Hosts/passive_state,host_components/HostRoles/state,host_components/HostRoles/passive_state,alerts/summary&minimal_response=true';
     if (isInitialLoad) {
       testUrl = '/data/hosts/HDP2/hosts_init.json';
       statusUrl = '/hosts?fields=Hosts/host_name,Hosts/passive_state,Hosts/public_host_name,Hosts/cpu_count,Hosts/ph_cpu_count,Hosts/total_mem,'
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/34b1ccbf/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 739dd72..3fa6b33 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -81,8 +81,8 @@ App.UpdateController = Em.Controller.extend({
   updateHost:function(callback) {
     var testUrl = App.get('isHadoop2Stack') ? '/data/hosts/HDP2/hosts.json' : '/data/hosts/hosts.json';
     var hostsUrl = this.getUrl(testUrl, '/hosts?fields=Hosts/host_name,Hosts/host_status,Hosts/last_heartbeat_time,Hosts/disk_info,Hosts/passive_state,'
+
-      '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');
+      'metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,metrics/memory/mem_total,metrics/memory/mem_free'+
+      '&minimal_response=true');
     App.HttpClient.get(hostsUrl, App.hostsMapper, {
       complete: callback
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/34b1ccbf/ambari-web/app/mappers/hosts_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/hosts_mapper.js b/ambari-web/app/mappers/hosts_mapper.js
index 8d98e7d..cda00ac 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -77,16 +77,13 @@ App.hostsMapper = App.QuickDataMapper.create({
         item.host_components.forEach(function (host_component) {
           host_component.id = host_component.HostRoles.component_name + "_" + hostName;
         }, this);
-        //check whether Nagios installed and started
-        if (item.alerts) {
-          item.critical_alerts_count = item.alerts.summary.CRITICAL + item.alerts.summary.WARNING;
-        }
 
         hostIds[hostName] = true;
         currentHostStatuses[hostName] = item.Hosts.host_status;
 
-        var parsedItem = this.parseIt(item, this.config);
         var hostCache = cacheData[hostName];
+        item.critical_alerts_count = hostCache.critical_alerts_count;
+        var parsedItem = this.parseIt(item, this.config);
 
         hostsWithFullInfo.push(parsedItem);
         if (hostCache) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/34b1ccbf/ambari-web/app/mappers/status_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/status_mapper.js b/ambari-web/app/mappers/status_mapper.js
index 788e14a..85ae758 100644
--- a/ambari-web/app/mappers/status_mapper.js
+++ b/ambari-web/app/mappers/status_mapper.js
@@ -89,6 +89,14 @@ App.statusMapper = App.QuickDataMapper.create({
          */
         if (hostsCache[hostName]) {
           hostsCache[hostName].host_components = hostComponentsOnHost;
+        } else {
+          hostsCache[hostName] = {};
+        }
+        //check whether Nagios installed and started
+        if (host.alerts) {
+          hostsCache[hostName].critical_alerts_count = host.alerts.summary.CRITICAL + host.alerts.summary.WARNING;
+        } else {
+          hostsCache[hostName].critical_alerts_count = 0;
         }
       }, this);
 
@@ -108,9 +116,13 @@ App.statusMapper = App.QuickDataMapper.create({
       var hostRecords = App.Host.find();
       hostRecords.forEach(function (host) {
         var status = hostStatuses[host.get('id')];
+        var hostCache = hostsCache[host.get('id')];
         if (status) {
           host.set('healthStatus', status);
         }
+        if (hostCache) {
+          host.set('criticalAlertsCount', hostCache.critical_alerts_count);
+        }
       });
 
       if (addedHostComponents.length) {


Mime
View raw message