Browse Source

AMBARI-1352. Host-level alert badges should only show the total number

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1443250 13f79535-47bb-0310-9956-ffa450edef68
Jaimin Jetly 12 years ago
parent
commit
1565e61740

+ 3 - 0
CHANGES.txt

@@ -255,6 +255,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1352. Host-level alert badges should only show the total number
+ of CRIT and WARN alerts for the host excluding OK. (jaimin)
+
  AMBARI-1355. Inconsistent casing and component name for alert title. (jaimin)
 
  AMBARI-1354. "No alerts" badge on the Host Detail page should be green, not red. (jaimin)

+ 2 - 2
ambari-web/app/controllers/main/host.js

@@ -26,7 +26,7 @@ App.MainHostController = Em.ArrayController.extend({
   comeWithFilter: false,
 
   hostsWithAlerts: function () {
-    return App.Alert.find().mapProperty('hostName').uniq();
+    return App.router.get('clusterController.alerts').filterProperty('isOk', false).mapProperty('hostName').uniq();
   }.property('App.router.clusterController.alerts.length'),
 
   /**
@@ -113,7 +113,7 @@ App.MainHostController = Em.ArrayController.extend({
         hostAlerts: function () {
           var allAlerts = App.router.get('clusterController.alerts');
           if (host) {
-            return allAlerts.filterProperty('hostName', host.get('hostName'));
+            return allAlerts.filterProperty('hostName', host.get('hostName')).filterProperty('isOk', false);
           }
           return 0;
         }.property('App.router.clusterController.alerts'),

+ 2 - 2
ambari-web/app/models/host.js

@@ -52,8 +52,8 @@ App.Host = DS.Model.extend({
   loadFive:DS.attr('number'),
   loadFifteen:DS.attr('number'),
 
-  alertsCount: function () {
-    return App.Alert.find().filterProperty('hostName', this.get('hostName')).length;
+  criticalAlertsCount: function () {
+    return App.router.get('clusterController.alerts').filterProperty('hostName', this.get('hostName')).filterProperty('isOk', false).length;
   }.property('App.router.clusterController.alerts.length'),
 
   publicHostNameFormatted: function() {

+ 2 - 2
ambari-web/app/templates/main/host.hbs

@@ -63,8 +63,8 @@
       </td>
       <td class="name">
         <a title="{{unbound host.publicHostName}}" href="#" {{action "showDetails" host}}>{{unbound host.publicHostNameFormatted}}</a>
-        {{#if host.alertsCount}}
-          <span class="label label-important alerts-count" {{action "showAlertsPopup" host target="controller"}}>{{host.alertsCount}}</span>
+        {{#if host.criticalAlertsCount}}
+          <span class="label label-important alerts-count" {{action "showAlertsPopup" host target="controller"}}>{{host.criticalAlertsCount}}</span>
         {{/if}}
       </td>
       <td>{{host.ip}}</td>

+ 2 - 2
ambari-web/app/templates/main/host/details.hbs

@@ -18,8 +18,8 @@
 
 <div id="host-details">
   <span {{bindAttr class="view.content.healthClass"}} {{bindAttr title="view.content.healthToolTip" }}></span><span class='host-title'>{{unbound view.content.publicHostName}}</span>
-  {{#if view.content.alertsCount}}
-    <span class="label label-important alerts-count" {{action "showAlertsPopup" content target="App.router.mainHostController"}}>{{view.content.alertsCount}}</span>
+  {{#if view.content.criticalAlertsCount}}
+  <span class="label label-important alerts-count" {{action "showAlertsPopup" content target="App.router.mainHostController"}}>{{view.content.criticalAlertsCount}}</span>
   {{else}}
     <span class="label label-success alerts-count">{{t hosts.host.alert.noAlerts}}</span>
   {{/if}}