You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/07/04 22:56:18 UTC

git commit: AMBARI-6385 stale_configs parameter works incorrectly after refreshing page. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/branch-1.6.1 9f3ba79eb -> 00c99f148


AMBARI-6385 stale_configs parameter works incorrectly after refreshing page. (atkach)


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

Branch: refs/heads/branch-1.6.1
Commit: 00c99f1481332d43755205b09b8c5f9c4dcbe6ee
Parents: 9f3ba79
Author: atkach <at...@hortonworks.com>
Authored: Fri Jul 4 23:56:10 2014 +0300
Committer: atkach <at...@hortonworks.com>
Committed: Fri Jul 4 23:56:10 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/mappers/hosts_mapper.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/00c99f14/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 bd26592..05037f2 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -71,16 +71,26 @@ App.hostsMapper = App.QuickDataMapper.create({
       var hostIds = {};
       var components = [];
       var componentsIdMap = {};
+      var cacheServices = App.cache['services'];
+      var loadedServiceComponentsMap = App.get('componentConfigMapper').buildServiceComponentMap(cacheServices);
+      var serviceToHostComponentIdMap = {};
+
       json.items.forEach(function (item, index) {
         item.host_components = item.host_components || [];
         item.host_components.forEach(function (host_component) {
           host_component.id = host_component.HostRoles.component_name + "_" + item.Hosts.host_name;
           var component = this.parseIt(host_component, this.hostComponentConfig);
+          var serviceName = host_component.HostRoles.service_name;
+
           component.id = host_component.HostRoles.component_name + "_" + item.Hosts.host_name;
           component.host_id = item.Hosts.host_name;
           component.host_name = item.Hosts.host_name;
           components.push(component);
           componentsIdMap[component.id] = component;
+          if (!serviceToHostComponentIdMap[serviceName]) {
+            serviceToHostComponentIdMap[serviceName] = [];
+          }
+          serviceToHostComponentIdMap[serviceName].push(component.id);
         }, this);
         item.critical_alerts_count = (item.alerts) ? item.alerts.summary.CRITICAL + item.alerts.summary.WARNING : 0;
         item.cluster_id = App.get('clusterName');
@@ -116,6 +126,8 @@ App.hostsMapper = App.QuickDataMapper.create({
       if (!isNaN(itemTotal)) {
         App.router.set('mainHostController.filteredCount', itemTotal);
       }
+      //bind host-components with service records
+      App.get('componentConfigMapper').addNewHostComponents(loadedServiceComponentsMap, serviceToHostComponentIdMap, cacheServices);
     }
     console.timeEnd('App.hostsMapper execution time');
   }