ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject git commit: AMBARI-6023. Datanode and Nodemanager count on the dashboard become null/null. (akovalenko)
Date Wed, 04 Jun 2014 16:58:58 GMT
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 <akovalenko@hortonworks.com>
Authored: Wed Jun 4 19:53:21 2014 +0300
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
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");
   }
 });


Mime
View raw message