Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4711811174 for ; Thu, 20 Feb 2014 12:55:44 +0000 (UTC) Received: (qmail 12445 invoked by uid 500); 20 Feb 2014 12:55:43 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 12372 invoked by uid 500); 20 Feb 2014 12:55:41 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 12358 invoked by uid 99); 20 Feb 2014 12:55:40 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Feb 2014 12:55:40 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 7322192923E; Thu, 20 Feb 2014 12:55:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: atkach@apache.org To: commits@ambari.apache.org Message-Id: <53a7c6d176a7440c93641462cb85585d@git.apache.org> X-Mailer: ASF-Git Admin Mailer 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 +0000 (UTC) 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 Authored: Thu Feb 20 14:52:48 2014 +0200 Committer: atkach 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) {