Jelajahi Sumber

AMBARI-6047. Widget for supervisor always shows zero on dashboard. (Buzhor Denys via onechiporenko)

Oleg Nechiporenko 11 tahun lalu
induk
melakukan
cd60e5aac2

+ 4 - 1
ambari-web/app/mappers/service_metrics_mapper.js

@@ -147,7 +147,10 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
     used_slots: 'restApiComponent.metrics.api.cluster.summary.["tasks.total"]',
     topologies: 'restApiComponent.metrics.api.cluster.summary.topologies',
     total_executors: 'restApiComponent.metrics.api.cluster.summary.["executors.total"]',
-    nimbus_uptime: 'restApiComponent.metrics.api.cluster.summary.["nimbus.uptime"]'
+    nimbus_uptime: 'restApiComponent.metrics.api.cluster.summary.["nimbus.uptime"]',
+    super_visors_started: 'super_visors_started',
+    super_visors_installed: 'super_visors_installed',
+    super_visors_total: 'super_visors_total'
   },
   flumeAgentConfig: {
     name: 'HostComponentProcess.name',

+ 3 - 0
ambari-web/app/models/service/storm.js

@@ -19,6 +19,9 @@ var App = require('app');
 
 App.StormService = App.Service.extend({
   version: DS.attr('string'),
+  superVisorsStarted: DS.attr('number'),
+  superVisorsInstalled: DS.attr('number'),
+  superVisorsTotal: DS.attr('number'),
   totalTasks: DS.attr('number'),
   totalSlots: DS.attr('number'),
   usedSlots: DS.attr('number'),

+ 1 - 1
ambari-web/app/templates/main/service/services/storm.hbs

@@ -25,7 +25,7 @@
   </td>
   <td>
     <span>
-      {{#view App.ComponentLiveTextView liveComponentsBinding="view.service.superVisorsStarted" totalComponentsBinding="view.service.superVisorsTotal"}}
+      {{#view App.ComponentLiveTextView liveComponentsBinding="view.superVisorsLive" totalComponentsBinding="view.superVisorsTotal"}}
         {{view.liveComponents}}/{{view.totalComponents}}
       {{/view}}
     </span> {{t services.service.summary.SupervisorsLIVE}}

+ 14 - 15
ambari-web/app/views/main/dashboard/widgets/supervisor_live.js

@@ -30,8 +30,8 @@ App.SuperVisorUpView = App.TextDashboardWidgetView.extend({
 
   hiddenInfo: function () {
     var result = [];
-    result.pushObject(this.get('superVisorsLive').length + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.live'));
-    result.pushObject(this.get('superVisorsDead').length + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.dead'));
+    result.pushObject(this.get('superVisorsLive') + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.live'));
+    result.pushObject(this.get('superVisorsDead') + ' ' + Em.I18n.t('dashboard.services.hdfs.nodes.dead'));
     return result;
   }.property('superVisorsLive', 'superVisorsDead'),
   hiddenInfoClass: "hidden-info-two-line",
@@ -40,30 +40,29 @@ App.SuperVisorUpView = App.TextDashboardWidgetView.extend({
   thresh2: 70,
   maxValue: 100,
 
-  superVisorComponents: function() {
-    return this.get('model.hostComponents').filterProperty('componentName', 'SUPERVISOR');
-  }.property('model.hostComponents.length'),
-
   superVisorsLive: function () {
-    return this.get('superVisorComponents').filterProperty("workStatus", "STARTED");
-  }.property('superVisorComponents.@each.workStatus'),
+    return this.get('model.superVisorsStarted');
+  }.property('model.superVisorsStarted'),
 
   superVisorsDead: function () {
-    return this.get('superVisorComponents').filterProperty("workStatus", "INSTALLED");
-  }.property('superVisorComponents.@each.workStatus'),
+    return this.get('model.superVisorsInstalled');
+  }.property('model.superVisorsInstalled'),
 
+  superVisorsTotal: function() {
+    return this.get('model.superVisorsTotal');
+  }.property('model.superVisorsTotal'),
 
   data: function () {
-    if ( !this.get('superVisorComponents.length')) {
+    if ( !this.get('superVisorsTotal')) {
       return -1;
     } else {
-      return ((this.get('superVisorsLive').length / this.get('model.hostComponents').filterProperty('componentName', 'SUPERVISOR').length).toFixed(2)) * 100;
+      return ((this.get('superVisorsLive') / this.get('superVisorsTotal')).toFixed(2)) * 100;
     }
-  }.property('model.hostComponents.length', 'superVisorsLive'),
+  }.property('superVisorsTotal', 'superVisorsLive'),
 
   content: function () {
-    return this.get('superVisorsLive').length + "/" + this.get('superVisorComponents').length;
-  }.property('superVisorComponents.length', 'superVisorsLive'),
+    return this.get('superVisorsLive') + "/" + this.get('superVisorsTotal');
+  }.property('superVisorsLive', 'superVisorsTotal'),
 
   editWidget: function (event) {
     var parent = this;

+ 9 - 1
ambari-web/app/views/main/service/services/storm.js

@@ -21,12 +21,20 @@ var date = require('utils/date');
 
 App.MainDashboardServiceStormView = App.MainDashboardServiceView.extend({
   templateName: require('templates/main/service/services/storm'),
-  serviceName: 'storm',
+  serviceName: 'STORM',
 
   freeSlotsPercentage: function() {
     return Math.round(this.get('service.freeSlots')/this.get('service.totalSlots')*100);
   }.property('service.freeSlots', 'service.totalSlots'),
 
+  superVisorsLive: function () {
+    return this.get('service.superVisorsStarted');
+  }.property('service.superVisorsStarted'),
+
+  superVisorsTotal: function() {
+    return this.get('service.superVisorsTotal');
+  }.property('service.superVisorsTotal'),
+
   nimbusUptimeFormatted: function() {
     if (this.get('service.nimbusUptime') > 0) {
       return date.timingFormat(this.get('service.nimbusUptime')*1000);