Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E007011212 for ; Fri, 13 Jun 2014 11:02:23 +0000 (UTC) Received: (qmail 12452 invoked by uid 500); 13 Jun 2014 11:02:23 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 12422 invoked by uid 500); 13 Jun 2014 11:02:23 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 12415 invoked by uid 99); 13 Jun 2014 11:02:23 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jun 2014 11:02:23 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 72047932DFB; Fri, 13 Jun 2014 11:02:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: atkach@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: AMBARI-6112 Filter by alerts fails on Hosts table. (atkach) Date: Fri, 13 Jun 2014 11:02:23 +0000 (UTC) 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 Authored: Fri Jun 13 14:00:14 2014 +0300 Committer: atkach 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' } ];