ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject git commit: AMBARI-7830. Slider. Clear Filters click issue. (onechiporenko)
Date Fri, 17 Oct 2014 15:24:21 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 1411d8e42 -> 07772c90b


AMBARI-7830. Slider. Clear Filters click issue. (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 07772c90bf57b363ba0c8d3c10d113512702bdbd
Parents: 1411d8e
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Fri Oct 17 16:08:17 2014 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Fri Oct 17 18:23:37 2014 +0300

----------------------------------------------------------------------
 .../resources/ui/app/templates/slider_apps.hbs  |  2 +-
 .../resources/ui/app/views/common/table_view.js |  9 +++++++-
 .../resources/ui/app/views/slider_apps_view.js  |  3 ++-
 .../ui/test/integration/pages/index_test.js     | 24 ++++++++++++++++++++
 .../ui/test/unit/views/slider_apps_view_test.js |  2 +-
 5 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/07772c90/contrib/views/slider/src/main/resources/ui/app/templates/slider_apps.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/slider_apps.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/slider_apps.hbs
index 129db30..d4631e8 100644
--- a/contrib/views/slider/src/main/resources/ui/app/templates/slider_apps.hbs
+++ b/contrib/views/slider/src/main/resources/ui/app/templates/slider_apps.hbs
@@ -72,7 +72,7 @@
   <div class="page-bar">
     <div class="filtered-hosts-info span4">
       <label>{{view.filteredContentInfo}} - <a {{action clearFilters target="view"}}
-          href="#">{{t tableView.filters.clearAllFilters}}</a></label>
+          href="#" class="clearFiltersLink">{{t tableView.filters.clearAllFilters}}</a></label>
     </div>
     <div class="items-on-page">
       <label>{{t common.show}} {{view view.rowsPerPageSelectView selectionBinding="view.displayLength"}}</label>

http://git-wip-us.apache.org/repos/asf/ambari/blob/07772c90/contrib/views/slider/src/main/resources/ui/app/views/common/table_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/common/table_view.js b/contrib/views/slider/src/main/resources/ui/app/views/common/table_view.js
index 4d5df4a..fb70633 100644
--- a/contrib/views/slider/src/main/resources/ui/app/views/common/table_view.js
+++ b/contrib/views/slider/src/main/resources/ui/app/views/common/table_view.js
@@ -297,6 +297,7 @@ App.TableView = Em.View.extend({
    * @param {Number} iColumn number of column by which filter
    * @param {Object} value
    * @param {String} type
+   * @param {String} defaultValue
    */
   updateFilter: function (iColumn, value, type, defaultValue) {
     var filterCondition = this.get('filterConditions').findProperty('iColumn', iColumn);
@@ -399,13 +400,19 @@ App.TableView = Em.View.extend({
   /**
    * Run <code>clearFilter</code> in the each child filterView
    */
-  clearFilters: function() {
+  clearAllFilters: function() {
     this.set('filterConditions', []);
     this.get('_childViews').forEach(function(childView) {
       if (childView['clearFilter']) {
         childView.clearFilter();
       }
     });
+  },
+
+  actions: {
+    clearFilters: function() {
+      return this.clearAllFilters();
+    }
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/07772c90/contrib/views/slider/src/main/resources/ui/app/views/slider_apps_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/slider_apps_view.js b/contrib/views/slider/src/main/resources/ui/app/views/slider_apps_view.js
index 787378b..017cf1b 100644
--- a/contrib/views/slider/src/main/resources/ui/app/views/slider_apps_view.js
+++ b/contrib/views/slider/src/main/resources/ui/app/views/slider_apps_view.js
@@ -148,7 +148,8 @@ App.SliderAppsView = App.TableView.extend({
     onChangeValue: function(){
       this.get('parentView').updateFilter(this.get('column'), this.get('value'), 'date',
this.get('defaultValue'));
     },
-    type: 'number'
+    type: 'number',
+    emptyValue: 'All Dates'
   }),
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/07772c90/contrib/views/slider/src/main/resources/ui/test/integration/pages/index_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/integration/pages/index_test.js
b/contrib/views/slider/src/main/resources/ui/test/integration/pages/index_test.js
index b0fc3ba..f5d556a 100644
--- a/contrib/views/slider/src/main/resources/ui/test/integration/pages/index_test.js
+++ b/contrib/views/slider/src/main/resources/ui/test/integration/pages/index_test.js
@@ -96,4 +96,28 @@ test('Slider Title Popover', function () {
     equal(find('.slider-description').text(), 'DESCRIPTION', 'popover has slider description');
   });
 
+});
+
+test('Clear Filters', function () {
+
+  visit('/');
+  fillIn('#filter-row input:eq(0)', 'Some val');
+  find('#filter-row select:eq(0)  :nth-child(1)').attr('selected', 'selected');
+  fillIn('#filter-row input:eq(1)', 'Some val');
+  fillIn('#filter-row input:eq(2)', 'Some val');
+  find('#filter-row select:eq(1) :nth-child(1)').attr('selected', 'selected');
+
+  andThen(function () {
+    click('.clearFiltersLink');
+
+    andThen(function () {
+      equal(find('#filter-row input:eq(0)').val(), '');
+      equal(find('#filter-row select:eq(0)').val(), 'All Status');
+      equal(find('#filter-row input:eq(1)').val(), '');
+      equal(find('#filter-row input:eq(2)').val(), '');
+      equal(find('#filter-row select:eq(1)').val(), 'All Dates');
+
+    });
+  });
+
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/07772c90/contrib/views/slider/src/main/resources/ui/test/unit/views/slider_apps_view_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/unit/views/slider_apps_view_test.js
b/contrib/views/slider/src/main/resources/ui/test/unit/views/slider_apps_view_test.js
index a3cd020..d287d7f 100644
--- a/contrib/views/slider/src/main/resources/ui/test/unit/views/slider_apps_view_test.js
+++ b/contrib/views/slider/src/main/resources/ui/test/unit/views/slider_apps_view_test.js
@@ -29,7 +29,7 @@ test('clearFilters', function () {
   });
 
   Em.run(function () {
-    view.clearFilters();
+    view.clearAllFilters();
   });
 
   equal(view.get('pageContent.length'), 1, 'all content items should be displayed');


Mime
View raw message