summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarren Smith <garren.smith@gmail.com>2013-07-09 15:29:49 +0200
committerGarren Smith <garren.smith@gmail.com>2013-07-09 15:29:49 +0200
commit03d1b7e0c8c438d0a604c691575f9c7c15757004 (patch)
treeb05f5ff08d95a488e5fd69f7cc9524458af022eb
parent65e5074a3b3d23c03492f634c6c849096a14bf27 (diff)
downloadcouchdb-03d1b7e0c8c438d0a604c691575f9c7c15757004.tar.gz
Fauxton: move log filtered collection to serialize
-rw-r--r--src/fauxton/app/addons/logs/resources.js15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/fauxton/app/addons/logs/resources.js b/src/fauxton/app/addons/logs/resources.js
index b64f81327..072290ba6 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 () {