ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-6052 Load host-components of displayed Hosts. (atkach)
Date Fri, 06 Jun 2014 17:12:49 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0eac2f2ad -> 34f659b5c


AMBARI-6052 Load host-components of displayed Hosts. (atkach)


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

Branch: refs/heads/trunk
Commit: 34f659b5c3409800bd4ee757ce6333ca54edc0a0
Parents: 0eac2f2
Author: atkach <atkach@hortonworks.com>
Authored: Fri Jun 6 20:10:46 2014 +0300
Committer: atkach <atkach@hortonworks.com>
Committed: Fri Jun 6 20:10:46 2014 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/global/update_controller.js |  2 +-
 ambari-web/app/mappers/hosts_mapper.js                 | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/34f659b5/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 643eea8..0d0b2d2 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -156,7 +156,7 @@ App.UpdateController = Em.Controller.extend({
     var testUrl = App.get('isHadoop2Stack') ? '/data/hosts/HDP2/hosts.json' : '/data/hosts/hosts.json';
     var realUrl = '/hosts?<parameters>fields=Hosts/host_name,Hosts/maintenance_state,Hosts/public_host_name,Hosts/cpu_count,Hosts/ph_cpu_count,Hosts/total_mem,'
+
         'Hosts/host_status,Hosts/last_heartbeat_time,Hosts/os_arch,Hosts/os_type,Hosts/ip,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,'
+
-        'metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,'
+
+        'host_components/HostRoles/stale_configs,host_components/HostRoles/service_name,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';
 
     this.get('queryParams').set('Hosts', App.router.get('mainHostController').getQueryParameters());

http://git-wip-us.apache.org/repos/asf/ambari/blob/34f659b5/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 2a3e5c0..41aaf0e 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -54,16 +54,28 @@ App.hostsMapper = App.QuickDataMapper.create({
     ip: 'Hosts.ip',
     passive_state: 'Hosts.maintenance_state'
   },
+  hostComponentConfig: {
+    component_name: 'HostRoles.component_name',
+    service_id: 'HostRoles.service_name',
+    passive_state: 'HostRoles.maintenance_state',
+    work_status: 'HostRoles.state',
+    stale_configs: 'HostRoles.stale_configs'
+  },
   map: function (json, isAll) {
     console.time('App.hostsMapper execution time');
     if (json.items) {
       var hostsWithFullInfo = [];
       var hostIds = {};
+      var components = [];
 
       json.items.forEach(function (item) {
         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);
+          component.id = host_component.HostRoles.component_name + "_" + item.Hosts.host_name;
+          component.host_id = item.Hosts.host_name;
+          components.push(component);
         }, this);
         item.critical_alerts_count = (item.alerts) ? item.alerts.summary.CRITICAL + item.alerts.summary.WARNING
: 0;
         item.cluster_id = App.get('clusterName');
@@ -87,6 +99,7 @@ App.hostsMapper = App.QuickDataMapper.create({
           host.set('isRequested', false);
         }
       });
+      App.store.loadMany(App.HostComponent, components);
       App.store.loadMany(App.Host, hostsWithFullInfo);
       App.router.set('mainHostController.filteredCount', json.itemTotal);
     }


Mime
View raw message