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 8277F17F81 for ; Tue, 24 Feb 2015 14:08:47 +0000 (UTC) Received: (qmail 93485 invoked by uid 500); 24 Feb 2015 14:08:34 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 93387 invoked by uid 500); 24 Feb 2015 14:08:34 -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 93377 invoked by uid 99); 24 Feb 2015 14:08:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Feb 2015 14:08:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 90955E00CA; Tue, 24 Feb 2015 14:08:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ababiichuk@apache.org To: commits@ambari.apache.org Date: Tue, 24 Feb 2015 14:08:35 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/2] ambari git commit: AMBARI-8990 Link for clearing filter is being shown even when none of the filter is active (ababiichuk) AMBARI-8990 Link for clearing filter is being shown even when none of the filter is active (ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/32c30c8f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/32c30c8f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/32c30c8f Branch: refs/heads/trunk Commit: 32c30c8f9678477a0be53678e36577e5c9a40897 Parents: 0c23443 Author: aBabiichuk Authored: Tue Feb 24 12:43:35 2015 +0200 Committer: aBabiichuk Committed: Tue Feb 24 16:07:17 2015 +0200 ---------------------------------------------------------------------- .../templates/main/dashboard/config_history.hbs | 2 ++ ambari-web/app/templates/main/host.hbs | 4 +++- .../app/templates/main/host/host_alerts.hbs | 6 ++++-- .../app/templates/main/host/stack_versions.hbs | 6 ++++-- ambari-web/app/views/common/table_view.js | 20 +++++++++++++++++++ ambari-web/test/views/common/table_view_test.js | 21 ++++++++++++++++++++ 6 files changed, 54 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/32c30c8f/ambari-web/app/templates/main/dashboard/config_history.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/dashboard/config_history.hbs b/ambari-web/app/templates/main/dashboard/config_history.hbs index af921fb..ccbcf05 100644 --- a/ambari-web/app/templates/main/dashboard/config_history.hbs +++ b/ambari-web/app/templates/main/dashboard/config_history.hbs @@ -87,8 +87,10 @@
+ {{#if view.showFilteredContent}} + {{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/32c30c8f/ambari-web/app/templates/main/host.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/host.hbs b/ambari-web/app/templates/main/host.hbs index 3474686..01f2951 100644 --- a/ambari-web/app/templates/main/host.hbs +++ b/ambari-web/app/templates/main/host.hbs @@ -169,7 +169,9 @@
- + {{#if view.showFilteredContent}} + + {{/if}}
{{#if view.showSelectedFilter}} http://git-wip-us.apache.org/repos/asf/ambari/blob/32c30c8f/ambari-web/app/templates/main/host/host_alerts.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/host/host_alerts.hbs b/ambari-web/app/templates/main/host/host_alerts.hbs index 407cca8..344fb7a 100644 --- a/ambari-web/app/templates/main/host/host_alerts.hbs +++ b/ambari-web/app/templates/main/host/host_alerts.hbs @@ -72,8 +72,10 @@
- + {{#if view.showFilteredContent}} + + {{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/32c30c8f/ambari-web/app/templates/main/host/stack_versions.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/host/stack_versions.hbs b/ambari-web/app/templates/main/host/stack_versions.hbs index 0627ae1..ea5a74b 100644 --- a/ambari-web/app/templates/main/host/stack_versions.hbs +++ b/ambari-web/app/templates/main/host/stack_versions.hbs @@ -69,8 +69,10 @@
- + {{#if view.showFilteredContent}} + + {{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/32c30c8f/ambari-web/app/views/common/table_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/table_view.js b/ambari-web/app/views/common/table_view.js index b17c011..cc1c2d6 100644 --- a/ambari-web/app/views/common/table_view.js +++ b/ambari-web/app/views/common/table_view.js @@ -413,6 +413,26 @@ App.TableView = Em.View.extend(App.UserPref, { }.property('filteredCount', 'startIndex', 'endIndex'), /** + * flag to toggle displaying filtered hosts counter + */ + showFilteredContent: function () { + var result = false; + if (this.get('filterConditions.length') > 0) { + this.get('filterConditions').forEach(function(f) { + if (f.value) { + if (Em.typeOf(f.value) == "array") { + if (f.value[0] || f.value[1]) { + result = true; + } + } else { + result = true; + } + } + }); + } + return result; + }.property('filteredContent'), + /** * Filter table by filterConditions */ filter: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/32c30c8f/ambari-web/test/views/common/table_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/table_view_test.js b/ambari-web/test/views/common/table_view_test.js index a7554a6..c311834 100644 --- a/ambari-web/test/views/common/table_view_test.js +++ b/ambari-web/test/views/common/table_view_test.js @@ -265,4 +265,25 @@ describe('App.TableView', function () { }); + describe("#showFilteredContent", function() { + beforeEach(function() { + view = App.TableView.create({}); + }); + + it('hide clear filters link', function () { + view.set('filterConditions', []); + expect(view.get('showFilteredContent')).to.be.false; + }); + + it('shows clear filters link', function () { + view.set('filterConditions', [{value: "1"}]); + expect(view.get('showFilteredContent')).to.be.true; + }); + + it('shows clear filters link for array filter', function () { + view.set('filterConditions', [{value: ["1", "2"]}]); + expect(view.get('showFilteredContent')).to.be.true; + }); + }); + });