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 003F611C2D for ; Wed, 4 Jun 2014 16:58:59 +0000 (UTC) Received: (qmail 99800 invoked by uid 500); 4 Jun 2014 16:58:58 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 99770 invoked by uid 500); 4 Jun 2014 16:58:58 -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 99763 invoked by uid 99); 4 Jun 2014 16:58:58 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jun 2014 16:58:58 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 8653E892EA0; Wed, 4 Jun 2014 16:58:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: akovalenko@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: AMBARI-6023. Datanode and Nodemanager count on the dashboard become null/null. (akovalenko) Date: Wed, 4 Jun 2014 16:58:58 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/trunk c74ec1d5c -> 9fab24e60 AMBARI-6023. Datanode and Nodemanager count on the dashboard become null/null. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9fab24e6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9fab24e6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9fab24e6 Branch: refs/heads/trunk Commit: 9fab24e60a5f5a6050400ceb5a64663ced6b08e9 Parents: c74ec1d Author: Aleksandr Kovalenko Authored: Wed Jun 4 19:53:21 2014 +0300 Committer: Aleksandr Kovalenko Committed: Wed Jun 4 19:53:58 2014 +0300 ---------------------------------------------------------------------- ambari-web/app/mappers/service_mapper.js | 41 ++++++++++++++++----------- 1 file changed, 25 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9fab24e6/ambari-web/app/mappers/service_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/service_mapper.js b/ambari-web/app/mappers/service_mapper.js index 981e4db..5a11292 100644 --- a/ambari-web/app/mappers/service_mapper.js +++ b/ambari-web/app/mappers/service_mapper.js @@ -21,26 +21,35 @@ App.serviceMapper = App.QuickDataMapper.create({ map: function (json) { console.time("App.serviceMapper execution time"); - var servicesData = []; json.items.forEach(function (service) { - var serviceData = { - ServiceInfo: { - service_name: service.ServiceInfo.service_name, - state: service.ServiceInfo.state, - passive_state: service.ServiceInfo.maintenance_state - }, - host_components: [], - components: [] - }; - //check whether Nagios installed and started - if (service.alerts) { - serviceData.ServiceInfo.critical_alerts_count = service.alerts.summary.CRITICAL + service.alerts.summary.WARNING; + var cachedService = App.cache['services'].findProperty('ServiceInfo.service_name', service.ServiceInfo.service_name); + if (cachedService) { + cachedService.ServiceInfo.state = service.ServiceInfo.state; + cachedService.ServiceInfo.passive_state = service.ServiceInfo.maintenance_state; + + //check whether Nagios installed and started + if (service.alerts) { + cachedService.ServiceInfo.critical_alerts_count = service.alerts.summary.CRITICAL + service.alerts.summary.WARNING; + } + } else { + var serviceData = { + ServiceInfo: { + service_name: service.ServiceInfo.service_name, + state: service.ServiceInfo.state, + passive_state: service.ServiceInfo.maintenance_state + }, + host_components: [], + components: [] + }; + + //check whether Nagios installed and started + if (service.alerts) { + serviceData.ServiceInfo.critical_alerts_count = service.alerts.summary.CRITICAL + service.alerts.summary.WARNING; + } + App.cache['services'].push(serviceData); } - servicesData.push(serviceData); }); - App.cache['services'] = servicesData; - console.timeEnd("App.serviceMapper execution time"); } });