Author: yusaku
Date: Thu Apr 18 01:42:54 2013
New Revision: 1469124

URL: http://svn.apache.org/r1469124
Log:
AMBARI-1957. Hosts table: whether the alert filter is in effect or not is not 
clear. (yusaku)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-web/app/messages.js
    incubator/ambari/trunk/ambari-web/app/templates/main/host.hbs
    incubator/ambari/trunk/ambari-web/app/views/main/host.js

Modified: incubator/ambari/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1469124&r1=1469123&r2=1469124&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu Apr 18 01:42:54 2013
@@ -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

Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1469124&r1=1469123&r2=1469124&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Thu Apr 18 01:42:54 2013
@@ -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?',

Modified: incubator/ambari/trunk/ambari-web/app/templates/main/host.hbs
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/host.hbs?rev=1469124&r1=1469123&r2=1469124&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/host.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/host.hbs Thu Apr 18 
01:42:54 2013
@@ -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}}

Modified: incubator/ambari/trunk/ambari-web/app/views/main/host.js
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/host.js?rev=1469124&r1=1469123&r2=1469124&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/host.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/host.js Thu Apr 18 
01:42:54 2013
@@ -166,6 +166,43 @@ App.MainHostView = App.TableView.extend(
   },
 
   /**
+   * 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('[email protected]'),
+
+  /**
+   * 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
    */
@@ -316,17 +353,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
    */
   colPropAssoc: function(){


Reply via email to