couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathb...@apache.org
Subject [3/9] fauxton commit: updated refs/heads/secondary-indexes to bcc6dc2
Date Mon, 04 Aug 2014 13:10:43 GMT
Fauxton: Implement a filter for changes

Move the filter as a common component to Components.

- Change some <%= to <%- as <%= is not needed
- Filters can have tooltips
- Filtering is case insensitive

Closes COUCHDB-2158


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/ca7843b8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/ca7843b8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/ca7843b8

Branch: refs/heads/secondary-indexes
Commit: ca7843b81e9dc85921cb6e612e0e2cc51ce64a98
Parents: 2ece992
Author: Robert Kowalski <rok@kowalski.gd>
Authored: Sun Jul 27 12:00:41 2014 +0200
Committer: Robert Kowalski <rok@kowalski.gd>
Committed: Wed Jul 30 20:21:54 2014 +0200

----------------------------------------------------------------------
 app/addons/documents/assets/less/changes.less   | 18 ++++
 app/addons/documents/routes.js                  | 30 +++++-
 app/addons/documents/templates/changes.html     | 97 ++++++++++----------
 .../documents/templates/changes_header.html     | 31 +++++++
 app/addons/documents/tests/views-changesSpec.js | 33 ++++---
 app/addons/documents/tests/viewsSpec.js         |  3 +-
 app/addons/documents/views-changes.js           | 55 ++++++++++-
 app/addons/fauxton/components.js                | 43 +++++++--
 app/addons/fauxton/templates/filter.html        | 14 ++-
 app/addons/fauxton/tests/filterViewSpec.js      | 51 +++++-----
 app/addons/fauxton/tests/filteredViewSpec.js    | 41 +++++++++
 assets/less/fauxton.less                        | 15 ++-
 12 files changed, 316 insertions(+), 115 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/documents/assets/less/changes.less
----------------------------------------------------------------------
diff --git a/app/addons/documents/assets/less/changes.less b/app/addons/documents/assets/less/changes.less
index 43823cf..96e6d19 100644
--- a/app/addons/documents/assets/less/changes.less
+++ b/app/addons/documents/assets/less/changes.less
@@ -7,6 +7,10 @@
   right: 15px;
 }
 
+.changes-view {
+  padding-top: 70px;
+}
+
 .change-wrapper {
   margin-top: 20px;
   border-bottom: 1px solid #dddddd;
@@ -29,3 +33,17 @@
     font-weight: bold;
   }
 }
+
+.changes-header {
+  padding-top: 30px;
+  height: 160px;
+  border-bottom: 1px solid #999999;
+  .label {
+    float: left;
+    margin-right: 5px;
+  }
+  .js-filter-form {
+    padding-right: 15px;
+    margin: 0;
+  }
+}

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes.js b/app/addons/documents/routes.js
index 9c266be..3fd94f9 100644
--- a/app/addons/documents/routes.js
+++ b/app/addons/documents/routes.js
@@ -23,10 +23,11 @@ define([
   "addons/documents/views-doceditor",
 
   "addons/databases/base",
-  "addons/documents/resources"
+  "addons/documents/resources",
+  "addons/fauxton/components"
 ],
 
-function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases, Resources) {
+function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases, Resources, Components)
{
 
   var DocEditorRouteObject = FauxtonAPI.RouteObject.extend({
     layout: "one_pane",
@@ -163,7 +164,9 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases,
Resou
       "route:updatePreviewDocs": "updateAllDocsFromPreview",
       "route:reloadDesignDocs": "reloadDesignDocs",
       "route:paginate": "paginate",
-      "route:perPageChange": "perPageChange"
+      "route:perPageChange": "perPageChange",
+      "route:changesFilterAdd": "addFilter",
+      "route:changesFilterRemove": "removeFilter"
     },
 
     initialize: function (route, masterLayout, options) {
@@ -504,10 +507,17 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases,
Resou
       var docParams = app.getParams();
       this.data.database.buildChanges(docParams);
 
-      this.documentsView = this.setView("#dashboard-lower-content", new Changes.Changes({
+      this.changesView = this.setView("#dashboard-lower-content", new Changes.Changes({
         model: this.data.database
       }));
 
+      this.filterView = new Components.FilterView({
+        eventNamespace: "changes"
+      });
+      this.headerView = this.setView("#dashboard-upper-content", new Changes.ChangesHeader({
+        filterView: this.filterView
+      }));
+
       this.toolsView && this.toolsView.remove();
       this.viewEditor && this.viewEditor.remove();
 
@@ -523,7 +533,17 @@ function(app, FauxtonAPI, Documents, Changes, Index, DocEditor, Databases,
Resou
       this.apiUrl = function() {
         return [this.data.database.url("apiurl"), this.data.database.documentation()];
       };
-    }
+    },
+
+    addFilter: function (filter) {
+      this.changesView.filters.push(filter);
+      this.changesView.render();
+    },
+
+    removeFilter: function (filter) {
+      this.changesView.filters.splice(this.changesView.filters.indexOf(filter), 1);
+      this.changesView.render();
+    },
 
   });
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/documents/templates/changes.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/changes.html b/app/addons/documents/templates/changes.html
index 50cc85c..a9bfbaf 100644
--- a/app/addons/documents/templates/changes.html
+++ b/app/addons/documents/templates/changes.html
@@ -11,58 +11,59 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 License for the specific language governing permissions and limitations under
 the License.
 -->
-
-<% _.each(changes, function (change) { %>
-  <div class="change-wrapper">
-    <div class="change-box">
-      <div class="row-fluid">
-        <div class="span2">
-          seq
-        </div>
-        <div class="span8 change-sequence">
-          <%= change.seq %>
+<div class="changes-view">
+  <% _.each(changes, function (change) { %>
+    <div class="change-wrapper">
+      <div class="change-box">
+        <div class="row-fluid">
+          <div class="span2">
+            seq
+          </div>
+          <div class="span8 change-sequence">
+            <%- change.seq %>
+          </div>
+          <div class="span2 text-right">
+            <a class="js-copy" data-clipboard-text="<%- change.seq %>" data-bypass="true"
href="#">
+              <i class="fonticon-clipboard"></i>
+            </a>
+          </div>
         </div>
-        <div class="span2 text-right">
-          <a class="js-copy" data-clipboard-text="<%= change.seq %>" data-bypass="true"
href="#">
-            <i class="fonticon-clipboard"></i>
-          </a>
+        <div class="row-fluid">
+          <div class="span2">
+            id
+          </div>
+          <div class="span8">
+            <% if (change.deleted) { %>
+              <%- change.id %>
+            <% } else { %>
+              <a href="#<%- database.url('app') %>/<%- safeURL(change.id) %>"><%-
change.id %></a>
+            <% } %>    </div>
+          <div class="span2 text-right">
+            <a class="js-copy" data-clipboard-text="<%- change.id %>" data-bypass="true"
href="#">
+              <i class="fonticon-clipboard"></i>
+            </a>
+          </div>
         </div>
-      </div>
-      <div class="row-fluid">
-        <div class="span2">
-          id
+        <div class="row-fluid">
+          <div class="span2">
+            changes
+          </div>
+          <div class="span10">
+            <button class="js-toggle-json btn btn-small btn-primary" type="button">View
JSON</button>
+          </div>
         </div>
-        <div class="span8">
-          <% if (change.deleted) { %>
-            <%= change.id %>
-          <% } else { %>
-            <a href="#<%- database.url('app') %>/<%- safeURL(change.id) %>"><%=
change.id %></a>
-          <% } %>    </div>
-        <div class="span2 text-right">
-          <a class="js-copy" data-clipboard-text="<%= change.id %>" data-bypass="true"
href="#">
-            <i class="fonticon-clipboard"></i>
-          </a>
-        </div>
-      </div>
-      <div class="row-fluid">
-        <div class="span2">
-          changes
-        </div>
-        <div class="span10">
-          <button class="js-toggle-json btn btn-small btn-primary" type="button">View
JSON</button>
-        </div>
-      </div>
-      <div class="js-json-container">
-        <pre class="prettyprint"><%- JSON.stringify({changes: change.changes, doc:
change.doc}, null, " ") %></pre>
-      </div>
-      <div class="row-fluid">
-        <div class="span2">
-          deleted
+        <div class="js-json-container">
+          <pre class="prettyprint"><%- JSON.stringify({changes: change.changes,
doc: change.doc}, null, " ") %></pre>
         </div>
-        <div class="span10">
-          <%= change.deleted ? "True" : "False" %>
+        <div class="row-fluid">
+          <div class="span2">
+            deleted
+          </div>
+          <div class="span10">
+            <%- change.deleted ? "True" : "False" %>
+          </div>
         </div>
       </div>
     </div>
-  </div>
-<% }); %>
+  <% }); %>
+</div>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/documents/templates/changes_header.html
----------------------------------------------------------------------
diff --git a/app/addons/documents/templates/changes_header.html b/app/addons/documents/templates/changes_header.html
new file mode 100644
index 0000000..3d6031f
--- /dev/null
+++ b/app/addons/documents/templates/changes_header.html
@@ -0,0 +1,31 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+
+<div class="dashboard-upper-menu">
+  <ul class="nav nav-tabs window-resizeable" id="db-views-tabs-nav">
+    <li>
+      <a class="js-toggle-filter" href="#filter" data-bypass="true" data-toggle="tab">
+        <i class="fonticon fonticon-plus"></i>Filter
+      </a>
+    </li>
+  </ul>
+</div>
+
+<div class="tab-content">
+  <div class="tab-pane" id="query">
+    <div class="changes-header">
+      <div class="pull-right js-filter"></div>
+    </div>
+  </div>
+</div>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/documents/tests/views-changesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/views-changesSpec.js b/app/addons/documents/tests/views-changesSpec.js
index 51ccb92..4d4b2b3 100644
--- a/app/addons/documents/tests/views-changesSpec.js
+++ b/app/addons/documents/tests/views-changesSpec.js
@@ -11,23 +11,30 @@
 // the License.
 define([
         'addons/documents/views-changes',
+        'addons/databases/base',
         'testUtils'
-], function (Views, testUtils) {
-  var assert = testUtils.assert,
-      ViewSandbox = testUtils.ViewSandbox,
-      viewSandbox;
+], function (Views, Databases, testUtils) {
+  var assert = testUtils.assert;
 
   describe('Documents Changes', function () {
-    var view;
-      beforeEach(function () {
-        viewSandbox = new ViewSandbox();
-        viewSandbox.renderView(view);
+    var filteredView;
+    beforeEach(function () {
+      var database = new Databases.Model({id: 'bla'});
+      database.buildChanges({descending: 'true', limit: '100', include_docs: 'true'} );
+      filteredView = new Views.Changes({
+        model: database
       });
+    });
 
-      afterEach(function () {
-        viewSandbox.remove();
-      });
+    it('filter false in case of deleted documents in the changes feed', function () {
+      filteredView.filters = [false];
+      var res = filteredView.createFilteredData([
+        {id: 'LALA', bar: 'ENTE'},
+        {id: '1', bar: '1', deleted: true},
+        {id: '2', bar: '2'}
+      ]);
+
+      assert.equal(res.length, 2);
+    });
   });
 });
-
-

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/documents/tests/viewsSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/viewsSpec.js b/app/addons/documents/tests/viewsSpec.js
index 341ed8e..639b116 100644
--- a/app/addons/documents/tests/viewsSpec.js
+++ b/app/addons/documents/tests/viewsSpec.js
@@ -11,8 +11,9 @@
 // the License.
 define([
         'addons/documents/views',
+        'addons/databases/base',
         'testUtils'
-], function (Views, testUtils) {
+], function (Views, Databases, testUtils) {
   var assert = testUtils.assert;
 
   describe('DocumentsViews', function () {

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/documents/views-changes.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-changes.js b/app/addons/documents/views-changes.js
index 2f91c21..3404346 100644
--- a/app/addons/documents/views-changes.js
+++ b/app/addons/documents/views-changes.js
@@ -16,6 +16,7 @@ define([
        "api",
        // Libs
        "addons/fauxton/resizeColumns",
+       "addons/fauxton/components",
 
        // Plugins
        "plugins/prettify",
@@ -24,16 +25,33 @@ define([
        "plugins/zeroclipboard/ZeroClipboard"
 ],
 
-function(app, FauxtonAPI, resizeColumns,  prettify, ZeroClipboard) {
+function(app, FauxtonAPI, resizeColumns, Components, prettify, ZeroClipboard) {
 
   var Views = {};
 
-  Views.Changes = FauxtonAPI.View.extend({
+  Views.ChangesHeader = FauxtonAPI.View.extend({
+    template: "addons/documents/templates/changes_header",
+
+    events: {
+      'click .js-toggle-filter': "toggleQuery"
+    },
+
+    toggleQuery: function (event) {
+      $('#dashboard-content').scrollTop(0);
+      this.$('#query').toggle('slow');
+    },
+
+    initialize: function () {
+      this.setView(".js-filter", this.filterView);
+    }
+  });
+
+  Views.Changes = Components.FilteredView.extend({
     template: "addons/documents/templates/changes",
 
     initialize: function () {
-      this.listenTo( this.model.changes, 'sync', this.render);
-      this.listenTo( this.model.changes, 'cachesync', this.render);
+      this.listenTo(this.model.changes, 'sync', this.render);
+      this.listenTo(this.model.changes, 'cachesync', this.render);
     },
 
     events: {
@@ -65,12 +83,39 @@ function(app, FauxtonAPI, resizeColumns,  prettify, ZeroClipboard) {
     },
 
     serialize: function () {
+      var json = this.model.changes.toJSON(),
+          filteredData = this.createFilteredData(json);
+
       return {
-        changes: this.model.changes.toJSON(),
+        changes: filteredData,
         database: this.model
       };
     },
 
+    createFilteredData: function (json) {
+      var that = this;
+
+      return _.reduce(this.filters, function (elements, filter) {
+
+        return _.filter(elements, function (element) {
+          var match = false;
+
+          // make deleted searchable
+          if (!element.deleted) {
+            element.deleted = false;
+          }
+          _.each(element, function (value) {
+            if (new RegExp(filter, 'i').test(value.toString())) {
+              match = true;
+            }
+          });
+          return match;
+        });
+
+
+      }, json, this);
+    },
+
     afterRender: function(){
       prettyPrint();
       ZeroClipboard.config({ moviePath: "/assets/js/plugins/zeroclipboard/ZeroClipboard.swf"
});

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index fc0f500..d77af4a 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -339,19 +339,43 @@ function(app, FauxtonAPI, ace, spin) {
     }
   });
 
+  Components.FilteredView = FauxtonAPI.View.extend({
+    filters: [],
+    createFilteredData: function (json) {
+      var that = this;
+      return _.reduce(this.filters, function (elements, filter) {
+        return _.filter(elements, function (element) {
+          var match = false;
+          _.each(element, function (value) {
+            if (new RegExp(filter, 'i').test(value.toString())) {
+              match = true;
+            }
+          });
+          return match;
+        });
+      }, json, this);
+    }
+  });
+
   Components.FilterView = FauxtonAPI.View.extend({
     template: "addons/fauxton/templates/filter",
 
     initialize: function (options) {
-      this.eventListener = options.eventListener;
       this.eventNamespace = options.eventNamespace;
+      this.tooltipText = options.tooltipText;
     },
 
     events: {
-      "submit .js-log-filter-form": "filterLogs"
+      "submit .js-filter-form": "filterItems"
     },
 
-    filterLogs: function (event) {
+    serialize: function () {
+      return {
+        tooltipText: this.tooltipText
+      };
+    },
+
+    filterItems: function (event) {
       event.preventDefault();
       var $filter = this.$('input[name="filter"]'),
           filter = $.trim($filter.val());
@@ -360,17 +384,21 @@ function(app, FauxtonAPI, ace, spin) {
         return;
       }
 
-      this.eventListener.trigger(this.eventNamespace + ":filter", filter);
+      FauxtonAPI.triggerRouteEvent(this.eventNamespace + "FilterAdd", filter);
 
       this.insertView(".filter-list", new Components.FilterItemView({
         filter: filter,
-        eventListener: this.eventListener,
         eventNamespace: this.eventNamespace
       })).render();
 
       $filter.val('');
-    }
+    },
 
+    afterRender: function () {
+      if (this.tooltipText) {
+        this.$el.find(".js-filter-tooltip").tooltip();
+      }
+    }
   });
 
   Components.FilterItemView = FauxtonAPI.View.extend({
@@ -379,7 +407,6 @@ function(app, FauxtonAPI, ace, spin) {
 
     initialize: function (options) {
       this.filter = options.filter;
-      this.eventListener = options.eventListener;
       this.eventNamespace = options.eventNamespace;
     },
 
@@ -396,7 +423,7 @@ function(app, FauxtonAPI, ace, spin) {
     removeFilter: function (event) {
       event.preventDefault();
 
-      this.eventListener.trigger(this.eventNamespace + ":remove", this.filter);
+      FauxtonAPI.triggerRouteEvent(this.eventNamespace + "FilterRemove", this.filter);
       this.remove();
     }
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/fauxton/templates/filter.html
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/templates/filter.html b/app/addons/fauxton/templates/filter.html
index d7930fc..f7bc7c7 100644
--- a/app/addons/fauxton/templates/filter.html
+++ b/app/addons/fauxton/templates/filter.html
@@ -12,11 +12,17 @@ License for the specific language governing permissions and limitations
under
 the License.
 -->
 
-<form class="form-inline js-log-filter-form">
+<form class="form-inline js-filter-form">
   <fieldset>
-    <input type="text" name="filter" placeholder="Type a filter to sort the logs by">
-    <button type="submit" class="btn">Filter</button>
-    <span class="help-block"> <h6> Eg. debug or <1.4.1> or any regex </h6>
</span>
+    <input type="text" name="filter" placeholder="Type a filter">
+    <button type="submit" class="btn btn-primary">Filter</button>
+    <div class="help-block">
+      <strong> Eg. debug or <1.4.1> or any regex </strong>
+      <% if (tooltipText) { %>
+        <i class="js-filter-tooltip icon icon-question-sign" data-toggle="tooltip"
+          title="" data-original-title="<%- tooltipText %>"></i>
+      <% } %>
+    </div>
   </fieldset>
 </form>
 <ul class="filter-list"></ul>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/fauxton/tests/filterViewSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/filterViewSpec.js b/app/addons/fauxton/tests/filterViewSpec.js
index fec970d..1eefa05 100644
--- a/app/addons/fauxton/tests/filterViewSpec.js
+++ b/app/addons/fauxton/tests/filterViewSpec.js
@@ -17,18 +17,18 @@ define([
        'api'
 ], function (app, Components, testUtils, FauxtonAPI) {
   var assert = testUtils.assert,
-      ViewSandbox = testUtils.ViewSandbox,
-      myEvents = {};
-
-  _.extend(myEvents, Backbone.Events);
+      ViewSandbox = testUtils.ViewSandbox;
 
   describe('FilterView', function () {
     var viewSandbox,
         filterView;
 
+    if (!FauxtonAPI.router.triggerRouteEvent) {
+      FauxtonAPI.router.triggerRouteEvent = function () {};
+    }
+
     beforeEach(function () {
       filterView = new Components.FilterView({
-        eventListener: myEvents,
         eventNamespace: 'mynamespace'
       });
 
@@ -40,38 +40,20 @@ define([
       viewSandbox.remove();
     });
 
-    it('should trigger an event on add', function () {
-      filterView.$('[name="filter"]').val('i am a lonely filter');
-      myEvents.listenToOnce(myEvents, 'ente:filter', function (msg) {
-        assert.equal('i am a lonely filter', msg);
-      });
-      filterView.$('.js-log-filter-form').submit();
-    });
-
-    it('should trigger an event on remove', function () {
-      myEvents.listenToOnce(myEvents, 'mynamespace:filter', function (msg) {
-        assert.equal('i am a lonely filter', msg);
-      });
-
-      filterView.$('[name="filter"]').val('i am a lonely filter');
-      filterView.$('.js-log-filter-form').submit();
-      filterView.$('.js-remove-filter').click();
-    });
-
     it('should add filter markup', function () {
       filterView.$('[name="filter"]').val('i was a lonely filter');
-      filterView.$('.js-log-filter-form').submit();
+      filterView.$('.js-filter-form').submit();
 
       filterView.$('[name="filter"]').val('i am a filter');
-      filterView.$('.js-log-filter-form').submit();
+      filterView.$('.js-filter-form').submit();
       assert.equal(2, filterView.$('.js-remove-filter').length);
     });
 
     it('should remove filter markup', function () {
       filterView.$('[name="filter"]').val('i was a lonely filter');
-      filterView.$('.js-log-filter-form').submit();
+      filterView.$('.js-filter-form').submit();
       filterView.$('[name="filter"]').val('i am a filter');
-      filterView.$('.js-log-filter-form').submit();
+      filterView.$('.js-filter-form').submit();
 
       filterView.$('.js-remove-filter').click();
 
@@ -80,8 +62,21 @@ define([
 
     it('should not add empty filters', function () {
       filterView.$('[name="filter"]').val('');
-      filterView.$('.js-log-filter-form').submit();
+      filterView.$('.js-filter-form').submit();
       assert.equal(0, filterView.$('.js-remove-filter').length);
     });
+
+    it('should not add tooltips by default', function () {
+      assert.equal(0, filterView.$('.js-filter-tooltip').length);
+    });
+
+    it('should add tooltips when a text for it is defined', function () {
+      filterView = new Components.FilterView({
+        eventNamespace: 'mynamespace',
+        tooltipText: 'ente ente'
+      });
+      viewSandbox.renderView(filterView);
+      assert.equal(1, filterView.$('.js-filter-tooltip').length);
+    });
   });
 });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/app/addons/fauxton/tests/filteredViewSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/filteredViewSpec.js b/app/addons/fauxton/tests/filteredViewSpec.js
new file mode 100644
index 0000000..c24d439
--- /dev/null
+++ b/app/addons/fauxton/tests/filteredViewSpec.js
@@ -0,0 +1,41 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+       'app',
+       'addons/fauxton/components',
+       'testUtils'
+], function (app, Components, testUtils) {
+  var assert = testUtils.assert;
+
+  describe('FilteredView', function () {
+    var filteredView;
+
+
+    beforeEach(function () {
+      filteredView = new Components.FilteredView();
+    });
+
+    afterEach(function () {
+    });
+
+    it('should be case insensitive', function () {
+      filteredView.filters = ['ente'];
+      var res = filteredView.createFilteredData([
+        {id: 'LALA', bar: 'ENTE'},
+        {id: '1', bar: '1', deleted: true},
+        {id: '2', bar: '2'}
+      ]);
+      assert.equal(res.length, 1);
+    });
+  });
+});

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ca7843b8/assets/less/fauxton.less
----------------------------------------------------------------------
diff --git a/assets/less/fauxton.less b/assets/less/fauxton.less
index a9ff31b..463b1e0 100644
--- a/assets/less/fauxton.less
+++ b/assets/less/fauxton.less
@@ -947,8 +947,8 @@ div.spinner {
     .copying {
       background-color: #999;
     }
-    .zeroclipboard-is-hover { 
-      background-color: #cbcbcb; 
+    .zeroclipboard-is-hover {
+      background-color: #cbcbcb;
     }
     .icon {
       vertical-align: bottom;
@@ -968,7 +968,16 @@ div.spinner {
   height: 0;
 }
 
-.js-log-filter-form {
+.js-filter-form {
+  .help-block {
+    padding: 5px 0 5px 0;
+  }
+  .icon {
+    font-size: 16px;
+  }
+}
+
+.js-filter {
   ul {
     margin-left: 0px;
   }


Mime
View raw message