瀏覽代碼

AMBARI-9465. 2 hive metastore stopped alert shown on service page not showing correct number after run service checks

Srimanth Gunturi 10 年之前
父節點
當前提交
45d67f60f4
共有 1 個文件被更改,包括 12 次插入8 次删除
  1. 12 8
      ambari-web/app/controllers/main/alert_definitions_controller.js

+ 12 - 8
ambari-web/app/controllers/main/alert_definitions_controller.js

@@ -95,8 +95,7 @@ App.MainAlertDefinitionsController = Em.ArrayController.extend({
    * @return {number}
    */
   getCriticalAlertsCountForService: function (service) {
-    var alertsForService = this.get('content').filterProperty('service', service);
-    return alertsForService.filterProperty('isCritical').get('length');
+    return this.get('criticalAlertInstances').filterProperty('service', service).get('length');
   },
 
   /**
@@ -105,8 +104,7 @@ App.MainAlertDefinitionsController = Em.ArrayController.extend({
    * @return {number}
    */
   getCriticalOrWarningAlertsCountForService: function (service) {
-    var alertsForService = this.get('content').filterProperty('service', service);
-    return alertsForService.filterProperty('isCriticalOrWarning').get('length');
+    return this.get('unhealthyAlertInstances').filterProperty('service', service).get('length');
   },
 
   /**
@@ -121,12 +119,18 @@ App.MainAlertDefinitionsController = Em.ArrayController.extend({
     return this.get('unhealthyAlertInstances.length');
   }.property('unhealthyAlertInstances.length'),
 
-  unhealthyAlertInstances: function () {
-    return App.AlertInstance.find().toArray().filterProperty('state', 'CRITICAL').concat(
-        App.AlertInstance.find().toArray().filterProperty('state', 'WARNING')
-    );
+  criticalAlertInstances: function () {
+    return App.AlertInstance.find().toArray().filterProperty('state', 'CRITICAL');
+  }.property('mapperTimestamp'),
+
+  warningAlertInstances: function () {
+    return App.AlertInstance.find().toArray().filterProperty('state', 'WARNING');
   }.property('mapperTimestamp'),
 
+  unhealthyAlertInstances: function () {
+    return this.get('criticalAlertInstances').concat(this.get('warningAlertInstances'));
+  }.property('criticalAlertInstances', 'warningAlertInstances'),
+
   /**
    * if critical alerts exist, if true, the alert badge should be red.
    */