ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-6112 Filter by alerts fails on Hosts table. (atkach)
Date Fri, 13 Jun 2014 11:02:23 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 901b59ce4 -> 749f65889


AMBARI-6112 Filter by alerts fails on Hosts table. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/749f6588
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/749f6588
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/749f6588

Branch: refs/heads/trunk
Commit: 749f6588983bdbaeb8f796144180301911f2456a
Parents: 901b59c
Author: atkach <atkach@hortonworks.com>
Authored: Fri Jun 13 14:00:14 2014 +0300
Committer: atkach <atkach@hortonworks.com>
Committed: Fri Jun 13 14:02:16 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/global/update_controller.js |  7 +++--
 ambari-web/app/controllers/main/host.js         | 27 ++++++++++++--------
 ambari-web/app/data/host/categories.js          |  8 +++---
 3 files changed, 26 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/749f6588/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index 0635eb7..9762946 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -66,7 +66,7 @@ App.UpdateController = Em.Controller.extend({
 
     queryParams.forEach(function (param) {
       switch (param.type) {
-        case 'PLAIN':
+        case 'EQUAL':
           params += param.key + '=' + param.value;
           break;
         case 'LESS':
@@ -84,7 +84,10 @@ App.UpdateController = Em.Controller.extend({
         case 'SORT':
           params += 'sortBy=' + param.key + '.' + param.value;
           break;
-        case 'CRITICAL_ALERTS':
+        case 'CUSTOM':
+          param.value.forEach(function(item, index){
+            param.key = param.key.replace('{' + index + '}', item);
+          }, this);
           params += param.key;
           break;
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/749f6588/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js
index 2ba0315..68b7ba2 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -73,6 +73,13 @@ App.MainHostController = Em.ArrayController.extend({
     return this.get('dataSource').filterProperty('isRequested');
   }.property('dataSource.@each.isRequested'),
 
+  /**
+   * filterProperties support follow types of filter:
+   * MATCH - match of RegExp
+   * EQUAL - equality "="
+   * MULTIPLE - multiple values to compare
+   * CUSTOM - substitute values with keys "{#}" in alias
+   */
   filterProperties: [
     {
       key: 'publicHostName',
@@ -87,17 +94,17 @@ App.MainHostController = Em.ArrayController.extend({
     {
       key: 'cpu',
       alias: 'Hosts/cpu_count',
-      type: 'PLAIN'
+      type: 'EQUAL'
     },
     {
       key: 'memoryFormatted',
       alias: 'Hosts/total_mem',
-      type: 'PLAIN'
+      type: 'EQUAL'
     },
     {
       key: 'loadAvg',
       alias: 'metrics/load/load_one',
-      type: 'PLAIN'
+      type: 'EQUAL'
     },
     {
       key: 'hostComponents',
@@ -107,22 +114,22 @@ App.MainHostController = Em.ArrayController.extend({
     {
       key: 'healthClass',
       alias: 'Hosts/host_status',
-      type: 'PLAIN'
+      type: 'EQUAL'
     },
     {
       key: 'criticalAlertsCount',
-      alias: 'alerts/summary/CRITICAL>0|alerts/summary/WARNING>0',
-      type: 'CRITICAL_ALERTS'
+      alias: 'alerts/summary/CRITICAL{0}|alerts/summary/WARNING{1}',
+      type: 'CUSTOM'
     },
     {
       key: 'componentsWithStaleConfigsCount',
       alias: 'host_components/HostRoles/stale_configs',
-      type: 'PLAIN'
+      type: 'EQUAL'
     },
     {
       key: 'componentsInPassiveStateCount',
       alias: 'host_components/HostRoles/maintenance_state',
-      type: 'PLAIN'
+      type: 'EQUAL'
     },
     {
       key: 'selected',
@@ -210,7 +217,7 @@ App.MainHostController = Em.ArrayController.extend({
       queryParams.push({
         key: property.get('alias'),
         value: property.getValue(this),
-        type: 'PLAIN'
+        type: 'EQUAL'
       })
     }, this);
 
@@ -345,7 +352,7 @@ App.MainHostController = Em.ArrayController.extend({
    */
   getComparisonType: function (value) {
     var comparisonChar = value.charAt(0);
-    var result = 'PLAIN';
+    var result = 'EQUAL';
     if (isNaN(comparisonChar)) {
       switch (comparisonChar) {
         case '>':

http://git-wip-us.apache.org/repos/asf/ambari/blob/749f6588/ambari-web/app/data/host/categories.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/host/categories.js b/ambari-web/app/data/host/categories.js
index cfdc092..5e4f6dc 100644
--- a/ambari-web/app/data/host/categories.js
+++ b/ambari-web/app/data/host/categories.js
@@ -61,8 +61,8 @@ module.exports = [
     healthClass: 'health-status-WITH-ALERTS',
     healthStatus: 'health-status-WITH-ALERTS',
     column: 7,
-    type: 'number',
-    filterValue: '>0'
+    type: 'custom',
+    filterValue: ['>0', '>0']
   },
   {
     value: Em.I18n.t('common.restart'),
@@ -72,7 +72,7 @@ module.exports = [
     healthClass: 'health-status-RESTART',
     healthStatus: 'health-status-RESTART',
     column: 8,
-    type: 'number',
+    type: 'string',
     filterValue: 'true'
   },
   {
@@ -83,7 +83,7 @@ module.exports = [
     healthClass: 'health-status-PASSIVE_STATE',
     healthStatus: 'health-status-PASSIVE_STATE',
     column: 9,
-    type: 'number',
+    type: 'string',
     filterValue: 'ON'
   }
 ];


Mime
View raw message