Browse Source

AMBARI-1957. Hosts table: whether the alert filter is in effect or not is not clear. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1469124 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
86516018c4

+ 3 - 0
CHANGES.txt

@@ -747,6 +747,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1957. Hosts table: whether the alert filter is in effect or not is
+ not clear. (yusaku)
+
  AMBARI-1956. Wrong install status shown in Add Service Wizard. (yusaku)
 
  AMBARI-1951. Ambari agent setup during bootstrap should install the same

+ 2 - 0
ambari-web/app/messages.js

@@ -859,6 +859,8 @@ Em.I18n.translations = {
   'hosts.host.healthStatusCategory.red': "Master Down",
   'hosts.host.healthStatusCategory.orange': "Slave Down",
   'hosts.host.healthStatusCategory.yellow': "No Heartbeat",
+  'hosts.host.alerts.label': 'Alerts',
+  'hosts.host.alerts.st':'a!',
   'hosts.decommission.popup.body':'Are you sure?',
   'hosts.decommission.popup.header':'Confirmation',
   'hosts.delete.popup.body':'Are you sure?',

+ 5 - 3
ambari-web/app/templates/main/host.hbs

@@ -27,10 +27,12 @@
             {{category.label}}
           </a>
         </span>
-          {{#unless category.last}}
-            |
-          {{/unless}}
+        |
       {{/each}}
+      <span class="label label-important">{{t hosts.host.alerts.st}}</span>
+      <span {{bindAttr class="controller.filteredByAlerts:active"}}>
+        <a href="#" {{action filterByAlerts target="controller"}}>{{t hosts.host.alerts.label}} ({{view.hostsWithAlertsCount}})</a>
+      </span>
     </div>
 
     {{#if App.isAdmin}}

+ 37 - 11
ambari-web/app/views/main/host.js

@@ -165,6 +165,43 @@ App.MainHostView = App.TableView.extend({
     this.updateFilter(0, event.context.get('healthStatusValue'), 'string');
   },
 
+  /**
+   * Deactivate Alerts filtering if some Health category is selected
+   */
+  deactivateAlertsFilter: function() {
+    if (this.get('category')) {
+      this.set('controller.filteredByAlerts', false);
+    }
+  }.observes('category'),
+
+  /**
+   * Count of the hosts with alerts
+   */
+  hostsWithAlertsCount: function() {
+    return this.get('content.length') - this.get('content').filterProperty('criticalAlertsCount', 0).length;
+  }.property('content.@each.criticalAlertsCount'),
+
+  /**
+   * Filter hosts by hosts with at least one alert
+   */
+  filterByAlerts:function() {
+    if (this.get('controller.filteredByAlerts')) {
+      this.updateFilter(0, '', 'string');
+      this.updateFilter(7, '>0', 'number');
+      this.get('categories').setEach('isActive', false);
+      this.set('category', false);
+    }
+    else {
+      this.updateFilter(7, '', 'number');
+      if (!this.get('category')) {
+        var category = this.get('categories').objectAt(0);
+        category.set('isActive', false);
+        this.set('category', category);
+      }
+    }
+  }.observes('controller.filteredByAlerts'),
+
+
   /**
    * Filter view for name column
    * Based on <code>filters</code> library
@@ -315,17 +352,6 @@ App.MainHostView = App.TableView.extend({
     }
   }),
 
-  /**
-   * Filter hosts by hosts with at least one alert
-   */
-  filterByAlerts:function() {
-    if (this.get('controller.filteredByAlerts')) {
-      this.updateFilter(7, '>0', 'number')
-    } else {
-      this.updateFilter(7, '', 'number')
-    }
-  }.observes('controller.filteredByAlerts'),
-
   /**
    * associations between host property and column index
    */