You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/07/09 15:32:54 UTC

[4/7] git commit: updated refs/heads/1846-dev-server-improvements to 98a4a1b

Fauxton: move log filtered collection to serialize


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

Branch: refs/heads/1846-dev-server-improvements
Commit: 03d1b7e0c8c438d0a604c691575f9c7c15757004
Parents: 65e5074
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Jul 9 15:29:49 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Jul 9 15:29:49 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/logs/resources.js | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/03d1b7e0/src/fauxton/app/addons/logs/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/logs/resources.js b/src/fauxton/app/addons/logs/resources.js
index b64f813..072290b 100644
--- a/src/fauxton/app/addons/logs/resources.js
+++ b/src/fauxton/app/addons/logs/resources.js
@@ -97,10 +97,9 @@ function (app, FauxtonAPI, Backbone) {
       Log.events.on("log:remove", this.removeFilterLogs, this);
 
       this.filters = [];
-      this.filteredCollection = new Log.Collection(this.collection.toJSON());
 
       this.collection.on("add", function () {
-        this.createFilteredCollection();
+        this.render();
       }, this);
     },
 
@@ -109,7 +108,7 @@ function (app, FauxtonAPI, Backbone) {
     },
 
     serialize: function () {
-      return { logs: this.filteredCollection};
+      return { logs: new Log.Collection(this.createFilteredCollection())};
     },
 
     afterRender: function () {
@@ -122,18 +121,13 @@ function (app, FauxtonAPI, Backbone) {
 
     filterLogs: function (filter) {
       this.filters.push(filter);
-      this.createFilteredCollection();
-    },
-
-    resetFilterCollectionAndRender: function (logs) {
-      this.filteredCollection.reset(logs);
       this.render();
     },
 
     createFilteredCollection: function () {
       var that = this;
 
-      var filtered = _.reduce(this.filters, function (logs, filter) {
+      return _.reduce(this.filters, function (logs, filter) {
 
         return _.filter(logs, function (log) {
           var match = false;
@@ -149,12 +143,11 @@ function (app, FauxtonAPI, Backbone) {
 
       }, this.collection.toJSON(), this);
 
-      this.resetFilterCollectionAndRender(filtered);
     },
 
     removeFilterLogs: function (filter) {
       this.filters.splice(this.filters.indexOf(filter), 1);
-      this.createFilteredCollection();
+      this.render();
     },
 
     startRefreshInterval: function () {