Browse Source

AMBARI-3674. UI does not update active hbase master in display. (srimanth)

Srimanth Gunturi 11 years ago
parent
commit
95d63f0ed5

+ 5 - 0
ambari-web/app/controllers/global/cluster_controller.js

@@ -270,6 +270,11 @@ App.ClusterController = Em.Controller.extend({
     var testUrl = App.get('isHadoop2Stack') ? '/data/dashboard/HDP2/services.json':'/data/dashboard/services.json';
     //desired_state property is eliminated since calculateState function is commented out, it become useless
     var servicesUrl = this.getUrl(testUrl, '/services?fields=ServiceInfo,components/host_components/HostRoles/state');
+    if (App.Service.find('HBASE')) {
+      // HBase installed. We need the haStatus field as it has
+      // moved to another field.
+      servicesUrl += ',components/host_components/metrics/hbase/master/IsActiveMaster';
+    }
 
     App.HttpClient.get(servicesUrl, App.statusMapper, {
       complete: callback

+ 9 - 6
ambari-web/app/mappers/status_mapper.js

@@ -24,12 +24,6 @@ App.statusMapper = App.QuickDataMapper.create({
     work_status:'ServiceInfo.state'
   },
 
-  config3:{
-    id:'id',
-    work_status:'HostRoles.state',
-    desired_status: 'HostRoles.desired_state'
-  },
-
   map:function (json) {
     var start = new Date().getTime();
     console.log('in status mapper');
@@ -48,6 +42,9 @@ App.statusMapper = App.QuickDataMapper.create({
         var item = result[hostComponent.get('id')];
         if (item) {
           hostComponent.set('workStatus', item.work_status);
+          if (item.ha_status) {
+            hostComponent.set('haStatus', item.ha_status);
+          }
           this.countHostComponents(hostComponent, hostsMap, hostsMap[hostComponent.get('host.id')]);
           this.countServiceComponents(hostComponent, servicesMap, servicesMap[hostComponent.get('service.id')]);
         }
@@ -326,6 +323,12 @@ App.statusMapper = App.QuickDataMapper.create({
           result[host_component.id] = {
             work_status: host_component.HostRoles.state
           };
+          if (host_component.metrics &&
+              host_component.metrics.hbase &&
+              host_component.metrics.hbase.master &&
+              host_component.metrics.hbase.master.IsActiveMaster) {
+            result[host_component.id]['ha_status'] = host_component.metrics.hbase.master.IsActiveMaster;
+          }
         }, this)
       }, this)
     }, this);