You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by benkeen <gi...@git.apache.org> on 2015/03/03 23:57:20 UTC
[GitHub] couchdb-fauxton pull request: Changes react
GitHub user benkeen opened a pull request:
https://github.com/apache/couchdb-fauxton/pull/303
Changes react
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/benkeen/couchdb-fauxton changes-react
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb-fauxton/pull/303.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #303
----
commit 0867db9325a03033f71ce11c0fa66ba87b6bff69
Author: Ben Keen <be...@gmail.com>
Date: 2015-02-27T19:25:10Z
Porting over Changes page content to React
commit 6991c262b4175c944e36181009688106d0ed4d79
Author: Ben Keen <be...@gmail.com>
Date: 2015-03-03T22:55:48Z
tests and cleanup
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25778845
--- Diff: app/addons/documents/tests/changes.componentsSpec.react.jsx ---
@@ -179,7 +188,185 @@ define([
assert.equal(1, $el.find('.js-remove-filter').length);
});
+ });
+
+
+ // tests Changes Controller; includes tests in conjunction with ChangesHeaderController
+ describe('ChangesController', function () {
+ var containerEl, headerEl, changesEl;
+
+ var changeList = new Backbone.Collection([
+ { id: 'doc_1', seq: 4, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_2', seq: 1, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_3', seq: 6, deleted: true, changes: { code: 'here' } },
+ { id: 'doc_4', seq: 7, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_5', seq: 1, deleted: true, changes: { code: 'here' } }
+ ]);
+
+ beforeEach(function () {
+ Actions.setChanges({
+ changes: changeList.models,
+ filters: [],
+ databaseName: 'testDatabase'
+ });
+ headerEl = TestUtils.renderIntoDocument(<Changes.ChangesHeaderController />, containerEl);
+ changesEl = TestUtils.renderIntoDocument(<Changes.ChangesController />, containerEl);
+ });
+
+ afterEach(function () {
+ Stores.changesStore.reset();
+ React.unmountComponentAtNode(containerEl);
+ });
+
+
+ it('should list the right number of changes', function () {
+ assert.equal(changeList.length, $(changesEl.getDOMNode()).find('.change-box').length);
+ });
+
+ it('"false"/"true" filter strings should apply to change deleted status', function () {
+ // expand the header
+ var $headerEl = $(headerEl.getDOMNode());
+ TestUtils.Simulate.click($(headerEl.getDOMNode()).find('a')[0]);
+
+ // add a filter
+ var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+ var submitBtn = $headerEl.find('[type="submit"]')[0];
+ addItemField.value = 'true';
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // confirm only the two deleted items shows up and the IDs maps to the deleted rows
+ assert.equal(2, $(changesEl.getDOMNode()).find('.change-box').length);
+ assert.equal('doc_3', $(changesEl.getDOMNode()).find('.js-doc-id')[0].innerHTML);
+ assert.equal('doc_5', $(changesEl.getDOMNode()).find('.js-doc-id')[1].innerHTML);
+ });
+
+
+ it('confirms that a filter affects the actual search results', function () {
+ // expand the header
+ var $headerEl = $(headerEl.getDOMNode());
+ TestUtils.Simulate.click($(headerEl.getDOMNode()).find('a')[0]);
+
+ // add a filter
+ var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+ var submitBtn = $headerEl.find('[type="submit"]')[0];
+ addItemField.value = '6'; // should match doc_3's sequence ID
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // confirm only one item shows up and the ID maps to what we'd expect
+ assert.equal(1, $(changesEl.getDOMNode()).find('.change-box').length);
+ assert.equal('doc_3', $(changesEl.getDOMNode()).find('.js-doc-id')[0].innerHTML);
+ });
+
+
+ // confirms that if there are multiple filters, ALL are applied to return the subset of results that match
+ // all filters
+ it('multiple filters should all be applied to results', function () {
--- End diff --
For future reference this test and the test before it you could actually test at the store level since the views just render what ever changes they are given. The way you have done it here is more like an integration test than a unit test.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#issuecomment-77866810
Good call. Updated.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#issuecomment-77151150
One minor thing, you can use `$('.element').text()` or `$element.html()` in all cases where you call `$('.element')[0].innerHTML`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#issuecomment-78393772
Merged as b3e5b44
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25778926
--- Diff: app/addons/documents/tests/views-changesSpec.js ---
@@ -18,70 +18,30 @@ define([
ViewSandbox = testUtils.ViewSandbox,
viewSandbox;
- describe('Documents Changes', function () {
+ describe('ChangesReactWrapper', function () {
--- End diff --
Is this file still useful since all the tests are now in React?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25778180
--- Diff: app/addons/documents/changes/components.react.jsx ---
@@ -11,34 +11,39 @@
// the License.
define([
+ 'app',
+ 'api',
'react',
'addons/documents/changes/actions',
- 'addons/documents/changes/stores'
-], function (React, Actions, Stores) {
+ 'addons/documents/changes/stores',
+ 'addons/fauxton/components.react',
+ 'plugins/prettify'
+], function (app, FauxtonAPI, React, Actions, Stores, Components) {
+ var changesStore = Stores.changesStore;
var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
- // the top-level component for the Changes Filter section. Handles hiding/showing
- var ChangesHeader = React.createClass({
+ // the top-level component for the Changes Filter section. Handles hiding/showing of the filters form
+ var ChangesHeaderController = React.createClass({
getInitialState: function () {
return {
- showTabContent: Stores.changesHeaderStore.isTabVisible()
+ showTabContent: changesStore.isTabVisible()
--- End diff --
This and line 37 could be made into a `getStoreState()` and then for `getInitialState` can just return `getStoreState` and for onchange you can do `this.setState(this.getStoreState());`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25772481
--- Diff: app/addons/documents/changes/stores.js ---
@@ -15,51 +15,58 @@ define([
'addons/documents/changes/actiontypes'
], function (FauxtonAPI, ActionTypes) {
- var Stores = {};
-
- // tracks the state of the header (open/closed)
- var ChangesHeaderStore = FauxtonAPI.Store.extend({
+ var ChangesStore = FauxtonAPI.Store.extend({
initialize: function () {
this.reset();
},
reset: function () {
this._tabVisible = false;
+ this._filters = [];
+ this._changes = [];
+ this._databaseName = '';
+ this._maxChangesListed = 1000;
+ this._showingSubset = false;
},
- toggleTabVisibility: function () {
- this._tabVisible = !this._tabVisible;
+ setChanges: function (options) {
+ this._filters = options.filters;
+ this._databaseName = options.databaseName;
+ this._changes = _.map(options.changes, function (change) {
+ return {
+ id: change.get('id'),
+ seq: change.get('seq'),
+ deleted: change.get('deleted') ? change.get('deleted') : false,
+ changes: change.get('changes'),
+ doc: change.get('doc') // only populated with ?include_docs=true
+ };
+ });
},
- isTabVisible: function () {
- return this._tabVisible;
+ getChanges: function () {
+ var matches = _.reduce(this._filters, function (elements, filter) {
+ return _.filter(elements, function (element) {
+ var match = false;
+ _.each(element, function (value) {
+ if (!_.isUndefined(value) && new RegExp(filter, 'i').test(value.toString())) {
+ match = true;
+ }
+ });
+ return match;
+ });
+ }, this._changes, this);
+
+ this._showingSubset = matches.length > this._maxChangesListed;
+ return matches.slice(0, this._maxChangesListed);
},
--- End diff --
you can already limit the max-changes before the reduceby slicing them - that should increase performance a lot
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25772526
--- Diff: app/addons/documents/tests/changes.storesSpec.js ---
@@ -53,21 +49,50 @@ define([
it('removeFilter() removes item from store', function () {
var filter1 = 'My filter 1';
var filter2 = 'My filter 2';
- Stores.changesFilterStore.addFilter(filter1);
- Stores.changesFilterStore.addFilter(filter2);
- Stores.changesFilterStore.removeFilter(filter1);
+ Stores.changesStore.addFilter(filter1);
+ Stores.changesStore.addFilter(filter2);
+ Stores.changesStore.removeFilter(filter1);
- var filters = Stores.changesFilterStore.getFilters();
+ var filters = Stores.changesStore.getFilters();
assert.ok(filters.length === 1);
assert.ok(filters[0] === filter2);
});
it('hasFilter() finds item in store', function () {
var filter = 'My filter';
- Stores.changesFilterStore.addFilter(filter);
- assert.ok(Stores.changesFilterStore.hasFilter(filter) === true);
+ Stores.changesStore.addFilter(filter);
+ assert.ok(Stores.changesStore.hasFilter(filter) === true);
});
+
+ it('getDatabaseName() returns database name', function () {
+ var dbName = 'hoopoes';
+ Stores.changesStore.setChanges({ databaseName: dbName });
+ assert.equal(Stores.changesStore.getDatabaseName(), dbName);
+
+ Stores.changesStore.reset();
+ assert.equal(Stores.changesStore.getDatabaseName(), '');
+ });
+
+ it("getChanges() should return a subset if there are a lot of changes", function () {
+
+ // to keep the test speedy, override the default max value
+ var maxChanges = 10;
+ Stores.changesStore.setMaxChanges(maxChanges);
+
+ // better underscorey way to do this?
--- End diff --
times
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#issuecomment-77257868
Thanks for the feedback, guys. Very helpful! I've updated the code as per your feedback.
@garrensmith, I tried combining the elements into a single ChangesPageController element - turned out that part was very straightforward, even with a generic `TabbedPage` component that allowed you passing the header + body react components. But the single React element caused lots of problems with the different pages being handled by the route object. Some of them do view.remove() on the header but not the main body content when navigating around, which proved very difficult when the whole page was a single React component. After a lot of experimenting I decided it may be a little too soon for that refactor.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25777625
--- Diff: app/addons/documents/views-changes.js ---
@@ -18,108 +18,51 @@ define([
// Libs
"addons/fauxton/components",
'addons/documents/changes/components.react',
-
- // Plugins
- "plugins/prettify"
+ 'addons/documents/changes/actions'
],
-function(app, FauxtonAPI, Components, Changes, prettify, ZeroClipboard) {
+function(app, FauxtonAPI, Components, Changes, ChangesActions) {
var Views = {};
- // wrapper for React component. The wrapper allows us to tie the React component into the Fauxton
+ // wrappers for React components. The wrapper allows us to tie the React component into the Fauxton
// page load lifecycle
Views.ChangesHeaderReactWrapper = FauxtonAPI.View.extend({
afterRender: function () {
Changes.renderHeader(this.el);
},
cleanup: function () {
- Changes.removeHeader(this.el);
+ Changes.remove(this.el);
}
});
- Views.Changes = Components.FilteredView.extend({
- template: "addons/documents/templates/changes",
-
+ Views.ChangesReactWrapper = FauxtonAPI.View.extend({
initialize: function () {
this.listenTo(this.model.changes, 'sync', this.render);
this.listenTo(this.model.changes, 'cachesync', this.render);
this.filters = [];
},
- events: {
- "click button.js-toggle-json": "toggleJson"
- },
-
- toggleJson: function(event) {
- event.preventDefault();
-
- var $button = this.$(event.target),
- $container = $button.closest('.change-box').find(".js-json-container");
-
- if (!$container.is(":visible")) {
- $button
- .text("Close JSON")
- .addClass("btn-secondary")
- .removeClass("btn-primary");
- } else {
- $button.text("View JSON")
- .addClass("btn-primary")
- .removeClass("btn-secondary");
- }
-
- $container.slideToggle();
+ afterRender: function () {
+ ChangesActions.setChanges({
+ changes: this.model.changes.models,
--- End diff --
Out of interest, any specific reason you pass the model array instead of the collection? I would think it makes more sense to pass the collection.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen closed the pull request at:
https://github.com/apache/couchdb-fauxton/pull/303
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25778260
--- Diff: app/addons/documents/changes/components.react.jsx ---
@@ -268,18 +271,169 @@ define([
});
+ var ChangesController = React.createClass({
+ getInitialState: function () {
+ return this.getState();
+ },
+
+ getState: function () {
--- End diff --
could you rename to `getStoreState`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25817158
--- Diff: app/addons/documents/tests/changes.componentsSpec.react.jsx ---
@@ -179,7 +188,185 @@ define([
assert.equal(1, $el.find('.js-remove-filter').length);
});
+ });
+
+
+ // tests Changes Controller; includes tests in conjunction with ChangesHeaderController
+ describe('ChangesController', function () {
+ var containerEl, headerEl, changesEl;
+
+ var changeList = new Backbone.Collection([
+ { id: 'doc_1', seq: 4, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_2', seq: 1, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_3', seq: 6, deleted: true, changes: { code: 'here' } },
+ { id: 'doc_4', seq: 7, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_5', seq: 1, deleted: true, changes: { code: 'here' } }
+ ]);
+
+ beforeEach(function () {
+ Actions.setChanges({
+ changes: changeList.models,
+ filters: [],
+ databaseName: 'testDatabase'
+ });
+ headerEl = TestUtils.renderIntoDocument(<Changes.ChangesHeaderController />, containerEl);
+ changesEl = TestUtils.renderIntoDocument(<Changes.ChangesController />, containerEl);
+ });
+
+ afterEach(function () {
+ Stores.changesStore.reset();
+ React.unmountComponentAtNode(containerEl);
+ });
+
+
+ it('should list the right number of changes', function () {
+ assert.equal(changeList.length, $(changesEl.getDOMNode()).find('.change-box').length);
+ });
+
+ it('"false"/"true" filter strings should apply to change deleted status', function () {
+ // expand the header
+ var $headerEl = $(headerEl.getDOMNode());
+ TestUtils.Simulate.click($(headerEl.getDOMNode()).find('a')[0]);
+
+ // add a filter
+ var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+ var submitBtn = $headerEl.find('[type="submit"]')[0];
+ addItemField.value = 'true';
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // confirm only the two deleted items shows up and the IDs maps to the deleted rows
+ assert.equal(2, $(changesEl.getDOMNode()).find('.change-box').length);
+ assert.equal('doc_3', $(changesEl.getDOMNode()).find('.js-doc-id')[0].innerHTML);
+ assert.equal('doc_5', $(changesEl.getDOMNode()).find('.js-doc-id')[1].innerHTML);
+ });
+
+
+ it('confirms that a filter affects the actual search results', function () {
+ // expand the header
+ var $headerEl = $(headerEl.getDOMNode());
+ TestUtils.Simulate.click($(headerEl.getDOMNode()).find('a')[0]);
+
+ // add a filter
+ var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+ var submitBtn = $headerEl.find('[type="submit"]')[0];
+ addItemField.value = '6'; // should match doc_3's sequence ID
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // confirm only one item shows up and the ID maps to what we'd expect
+ assert.equal(1, $(changesEl.getDOMNode()).find('.change-box').length);
+ assert.equal('doc_3', $(changesEl.getDOMNode()).find('.js-doc-id')[0].innerHTML);
+ });
+
+
+ // confirms that if there are multiple filters, ALL are applied to return the subset of results that match
+ // all filters
+ it('multiple filters should all be applied to results', function () {
--- End diff --
Yeah that makes sense, thanks.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25785476
--- Diff: app/addons/documents/changes/stores.js ---
@@ -15,51 +15,58 @@ define([
'addons/documents/changes/actiontypes'
], function (FauxtonAPI, ActionTypes) {
- var Stores = {};
-
- // tracks the state of the header (open/closed)
- var ChangesHeaderStore = FauxtonAPI.Store.extend({
+ var ChangesStore = FauxtonAPI.Store.extend({
initialize: function () {
this.reset();
},
reset: function () {
this._tabVisible = false;
+ this._filters = [];
+ this._changes = [];
+ this._databaseName = '';
+ this._maxChangesListed = 1000;
+ this._showingSubset = false;
},
- toggleTabVisibility: function () {
- this._tabVisible = !this._tabVisible;
+ setChanges: function (options) {
+ this._filters = options.filters;
+ this._databaseName = options.databaseName;
+ this._changes = _.map(options.changes, function (change) {
+ return {
+ id: change.get('id'),
+ seq: change.get('seq'),
+ deleted: change.get('deleted') ? change.get('deleted') : false,
+ changes: change.get('changes'),
+ doc: change.get('doc') // only populated with ?include_docs=true
+ };
+ });
--- End diff --
True! The thing is, the models have a whole bunch of stuff in them - I just wanted to specify exactly what's needed for the element, so although it's manual you can see at a glance what the changes array contains. Also, it forces the `deleted` property to have a default `false` value, which is needed for the filter searches later.
This okay?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25779497
--- Diff: app/addons/documents/tests/changes.componentsSpec.react.jsx ---
@@ -179,7 +188,185 @@ define([
assert.equal(1, $el.find('.js-remove-filter').length);
});
+ });
+
+
+ // tests Changes Controller; includes tests in conjunction with ChangesHeaderController
+ describe('ChangesController', function () {
+ var containerEl, headerEl, changesEl;
+
+ var changeList = new Backbone.Collection([
+ { id: 'doc_1', seq: 4, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_2', seq: 1, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_3', seq: 6, deleted: true, changes: { code: 'here' } },
+ { id: 'doc_4', seq: 7, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_5', seq: 1, deleted: true, changes: { code: 'here' } }
+ ]);
+
+ beforeEach(function () {
+ Actions.setChanges({
+ changes: changeList.models,
+ filters: [],
+ databaseName: 'testDatabase'
+ });
+ headerEl = TestUtils.renderIntoDocument(<Changes.ChangesHeaderController />, containerEl);
+ changesEl = TestUtils.renderIntoDocument(<Changes.ChangesController />, containerEl);
+ });
+
+ afterEach(function () {
+ Stores.changesStore.reset();
+ React.unmountComponentAtNode(containerEl);
+ });
+
+
+ it('should list the right number of changes', function () {
+ assert.equal(changeList.length, $(changesEl.getDOMNode()).find('.change-box').length);
+ });
+
+ it('"false"/"true" filter strings should apply to change deleted status', function () {
+ // expand the header
+ var $headerEl = $(headerEl.getDOMNode());
+ TestUtils.Simulate.click($(headerEl.getDOMNode()).find('a')[0]);
+
+ // add a filter
+ var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+ var submitBtn = $headerEl.find('[type="submit"]')[0];
+ addItemField.value = 'true';
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // confirm only the two deleted items shows up and the IDs maps to the deleted rows
+ assert.equal(2, $(changesEl.getDOMNode()).find('.change-box').length);
+ assert.equal('doc_3', $(changesEl.getDOMNode()).find('.js-doc-id')[0].innerHTML);
+ assert.equal('doc_5', $(changesEl.getDOMNode()).find('.js-doc-id')[1].innerHTML);
+ });
+
+
+ it('confirms that a filter affects the actual search results', function () {
+ // expand the header
+ var $headerEl = $(headerEl.getDOMNode());
+ TestUtils.Simulate.click($(headerEl.getDOMNode()).find('a')[0]);
+
+ // add a filter
+ var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+ var submitBtn = $headerEl.find('[type="submit"]')[0];
+ addItemField.value = '6'; // should match doc_3's sequence ID
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // confirm only one item shows up and the ID maps to what we'd expect
+ assert.equal(1, $(changesEl.getDOMNode()).find('.change-box').length);
+ assert.equal('doc_3', $(changesEl.getDOMNode()).find('.js-doc-id')[0].innerHTML);
+ });
+
+
+ // confirms that if there are multiple filters, ALL are applied to return the subset of results that match
+ // all filters
+ it('multiple filters should all be applied to results', function () {
+ var $headerEl = $(headerEl.getDOMNode());
+ TestUtils.Simulate.click($(headerEl.getDOMNode()).find('a')[0]);
+
+ // add the filters
+ var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+ var submitBtn = $headerEl.find('[type="submit"]')[0];
+
+ // *** should match doc_1, doc_2 and doc_5
+ addItemField.value = '1';
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // *** should match doc_3 and doc_5
+ addItemField.value = 'true';
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // confirm only one item shows up and that it's doc_5
+ assert.equal(1, $(changesEl.getDOMNode()).find('.change-box').length);
+ assert.equal('doc_5', $(changesEl.getDOMNode()).find('.js-doc-id')[0].innerHTML);
+ });
+ });
+
+
+ describe('ChangesController max results', function () {
+ var containerEl, changesEl;
+ var maxChanges = 10;
+
+ beforeEach(function () {
+
+ // to keep the test speedy, override the default value (1000)
+ Stores.changesStore.setMaxChanges(maxChanges);
+
+ // better underscorey way to do this?
+ var changes = [];
+ for (var i=0; i<maxChanges + 10; i++) {
--- End diff --
Niiiice :D
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#issuecomment-77867414
@benkeen great I'm +1 then.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25772291
--- Diff: app/addons/documents/tests/changes.componentsSpec.react.jsx ---
@@ -179,7 +188,185 @@ define([
assert.equal(1, $el.find('.js-remove-filter').length);
});
+ });
+
+
+ // tests Changes Controller; includes tests in conjunction with ChangesHeaderController
+ describe('ChangesController', function () {
+ var containerEl, headerEl, changesEl;
+
+ var changeList = new Backbone.Collection([
+ { id: 'doc_1', seq: 4, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_2', seq: 1, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_3', seq: 6, deleted: true, changes: { code: 'here' } },
+ { id: 'doc_4', seq: 7, deleted: false, changes: { code: 'here' } },
+ { id: 'doc_5', seq: 1, deleted: true, changes: { code: 'here' } }
+ ]);
+
+ beforeEach(function () {
+ Actions.setChanges({
+ changes: changeList.models,
+ filters: [],
+ databaseName: 'testDatabase'
+ });
+ headerEl = TestUtils.renderIntoDocument(<Changes.ChangesHeaderController />, containerEl);
+ changesEl = TestUtils.renderIntoDocument(<Changes.ChangesController />, containerEl);
+ });
+
+ afterEach(function () {
+ Stores.changesStore.reset();
+ React.unmountComponentAtNode(containerEl);
+ });
+
+
+ it('should list the right number of changes', function () {
+ assert.equal(changeList.length, $(changesEl.getDOMNode()).find('.change-box').length);
+ });
+
+ it('"false"/"true" filter strings should apply to change deleted status', function () {
+ // expand the header
+ var $headerEl = $(headerEl.getDOMNode());
+ TestUtils.Simulate.click($(headerEl.getDOMNode()).find('a')[0]);
+
+ // add a filter
+ var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+ var submitBtn = $headerEl.find('[type="submit"]')[0];
+ addItemField.value = 'true';
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // confirm only the two deleted items shows up and the IDs maps to the deleted rows
+ assert.equal(2, $(changesEl.getDOMNode()).find('.change-box').length);
+ assert.equal('doc_3', $(changesEl.getDOMNode()).find('.js-doc-id')[0].innerHTML);
+ assert.equal('doc_5', $(changesEl.getDOMNode()).find('.js-doc-id')[1].innerHTML);
+ });
+
+
+ it('confirms that a filter affects the actual search results', function () {
+ // expand the header
+ var $headerEl = $(headerEl.getDOMNode());
+ TestUtils.Simulate.click($(headerEl.getDOMNode()).find('a')[0]);
+
+ // add a filter
+ var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+ var submitBtn = $headerEl.find('[type="submit"]')[0];
+ addItemField.value = '6'; // should match doc_3's sequence ID
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // confirm only one item shows up and the ID maps to what we'd expect
+ assert.equal(1, $(changesEl.getDOMNode()).find('.change-box').length);
+ assert.equal('doc_3', $(changesEl.getDOMNode()).find('.js-doc-id')[0].innerHTML);
+ });
+
+
+ // confirms that if there are multiple filters, ALL are applied to return the subset of results that match
+ // all filters
+ it('multiple filters should all be applied to results', function () {
+ var $headerEl = $(headerEl.getDOMNode());
+ TestUtils.Simulate.click($(headerEl.getDOMNode()).find('a')[0]);
+
+ // add the filters
+ var addItemField = $headerEl.find('.js-changes-filter-field')[0];
+ var submitBtn = $headerEl.find('[type="submit"]')[0];
+
+ // *** should match doc_1, doc_2 and doc_5
+ addItemField.value = '1';
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // *** should match doc_3 and doc_5
+ addItemField.value = 'true';
+ TestUtils.Simulate.change(addItemField);
+ TestUtils.Simulate.submit(submitBtn);
+
+ // confirm only one item shows up and that it's doc_5
+ assert.equal(1, $(changesEl.getDOMNode()).find('.change-box').length);
+ assert.equal('doc_5', $(changesEl.getDOMNode()).find('.js-doc-id')[0].innerHTML);
+ });
+ });
+
+
+ describe('ChangesController max results', function () {
+ var containerEl, changesEl;
+ var maxChanges = 10;
+
+ beforeEach(function () {
+
+ // to keep the test speedy, override the default value (1000)
+ Stores.changesStore.setMaxChanges(maxChanges);
+
+ // better underscorey way to do this?
+ var changes = [];
+ for (var i=0; i<maxChanges + 10; i++) {
--- End diff --
```js
_(10).times(function (i) {
changes.push(new Backbone.Model({ id: 'doc_' + i, seq: 1, changes: { code: 'here' } }));
});
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25771191
--- Diff: app/addons/documents/routes-documents.js ---
@@ -219,16 +217,6 @@ function(app, FauxtonAPI, BaseRoute, Documents, Changes, Index, DocEditor, Datab
};
},
- 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();
- },
-
--- End diff --
:heart_eyes:
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25785813
--- Diff: app/addons/documents/views-changes.js ---
@@ -18,108 +18,51 @@ define([
// Libs
"addons/fauxton/components",
'addons/documents/changes/components.react',
-
- // Plugins
- "plugins/prettify"
+ 'addons/documents/changes/actions'
],
-function(app, FauxtonAPI, Components, Changes, prettify, ZeroClipboard) {
+function(app, FauxtonAPI, Components, Changes, ChangesActions) {
var Views = {};
- // wrapper for React component. The wrapper allows us to tie the React component into the Fauxton
+ // wrappers for React components. The wrapper allows us to tie the React component into the Fauxton
// page load lifecycle
Views.ChangesHeaderReactWrapper = FauxtonAPI.View.extend({
afterRender: function () {
Changes.renderHeader(this.el);
},
cleanup: function () {
- Changes.removeHeader(this.el);
+ Changes.remove(this.el);
}
});
- Views.Changes = Components.FilteredView.extend({
- template: "addons/documents/templates/changes",
-
+ Views.ChangesReactWrapper = FauxtonAPI.View.extend({
initialize: function () {
this.listenTo(this.model.changes, 'sync', this.render);
this.listenTo(this.model.changes, 'cachesync', this.render);
this.filters = [];
},
- events: {
- "click button.js-toggle-json": "toggleJson"
- },
-
- toggleJson: function(event) {
- event.preventDefault();
-
- var $button = this.$(event.target),
- $container = $button.closest('.change-box').find(".js-json-container");
-
- if (!$container.is(":visible")) {
- $button
- .text("Close JSON")
- .addClass("btn-secondary")
- .removeClass("btn-primary");
- } else {
- $button.text("View JSON")
- .addClass("btn-primary")
- .removeClass("btn-secondary");
- }
-
- $container.slideToggle();
+ afterRender: function () {
+ ChangesActions.setChanges({
+ changes: this.model.changes.models,
--- End diff --
This relates to the recent conversation on Slack. I wanted to remove as much Backbone as possible before sending it to the store. Just felt a bit cleaner passing an array rather than a collection. But I realize this is kind of moot since they're models anyway. I can pass the collection.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#issuecomment-77167523
@benkeen this is excellent. I also like the idea of grouping this into one React component. If its not too much extra work could you convert it to do that.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25797108
--- Diff: app/addons/documents/changes/stores.js ---
@@ -15,51 +15,58 @@ define([
'addons/documents/changes/actiontypes'
], function (FauxtonAPI, ActionTypes) {
- var Stores = {};
-
- // tracks the state of the header (open/closed)
- var ChangesHeaderStore = FauxtonAPI.Store.extend({
+ var ChangesStore = FauxtonAPI.Store.extend({
initialize: function () {
this.reset();
},
reset: function () {
this._tabVisible = false;
+ this._filters = [];
+ this._changes = [];
+ this._databaseName = '';
+ this._maxChangesListed = 1000;
+ this._showingSubset = false;
},
- toggleTabVisibility: function () {
- this._tabVisible = !this._tabVisible;
+ setChanges: function (options) {
+ this._filters = options.filters;
+ this._databaseName = options.databaseName;
+ this._changes = _.map(options.changes, function (change) {
+ return {
+ id: change.get('id'),
+ seq: change.get('seq'),
+ deleted: change.get('deleted') ? change.get('deleted') : false,
+ changes: change.get('changes'),
+ doc: change.get('doc') // only populated with ?include_docs=true
+ };
+ });
},
- isTabVisible: function () {
- return this._tabVisible;
+ getChanges: function () {
+ var matches = _.reduce(this._filters, function (elements, filter) {
+ return _.filter(elements, function (element) {
+ var match = false;
+ _.each(element, function (value) {
+ if (!_.isUndefined(value) && new RegExp(filter, 'i').test(value.toString())) {
+ match = true;
+ }
+ });
+ return match;
+ });
+ }, this._changes, this);
+
+ this._showingSubset = matches.length > this._maxChangesListed;
+ return matches.slice(0, this._maxChangesListed);
},
--- End diff --
True!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25784505
--- Diff: app/addons/documents/changes/stores.js ---
@@ -15,51 +15,58 @@ define([
'addons/documents/changes/actiontypes'
], function (FauxtonAPI, ActionTypes) {
- var Stores = {};
-
- // tracks the state of the header (open/closed)
- var ChangesHeaderStore = FauxtonAPI.Store.extend({
+ var ChangesStore = FauxtonAPI.Store.extend({
initialize: function () {
this.reset();
},
reset: function () {
this._tabVisible = false;
+ this._filters = [];
+ this._changes = [];
+ this._databaseName = '';
+ this._maxChangesListed = 1000;
+ this._showingSubset = false;
},
- toggleTabVisibility: function () {
- this._tabVisible = !this._tabVisible;
+ setChanges: function (options) {
+ this._filters = options.filters;
+ this._databaseName = options.databaseName;
+ this._changes = _.map(options.changes, function (change) {
+ return {
+ id: change.get('id'),
+ seq: change.get('seq'),
+ deleted: change.get('deleted') ? change.get('deleted') : false,
+ changes: change.get('changes'),
+ doc: change.get('doc') // only populated with ?include_docs=true
+ };
+ });
--- End diff --
You can do `return change.toJSON()` instead, much shorter and no need to manually maintain it in the future
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#issuecomment-77829302
@benkeen I've spotted some performance issues while testing. Even though you set a display limit of 1000, the changes request still fetches ALL changes. So I have a database with 37000 changes. Those changes are still kept in memory.
To fix this change the `buildChanges` function in `/app/addons/databases/resources.js` to something like this:
```javascript
buildChanges: function (params) {
if (!params.limit) {
params.limit = 100;
}
this.changes = new Databases.Changes({
database: this,
params: params
});
return this.changes;
}
```
I've set a limit of 100. I think thats actually a better size. I think once this PR has landed We need to add the functionality for a user to look at older changes and also see any new changes while viewing the changes page.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#issuecomment-77153918
Commit message is missing that it also limit the number of changes to 1000 which closes COUCHDB-2216
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25778339
--- Diff: app/addons/documents/changes/components.react.jsx ---
@@ -268,18 +271,169 @@ define([
});
+ var ChangesController = React.createClass({
+ getInitialState: function () {
+ return this.getState();
+ },
+
+ getState: function () {
+ return {
+ changes: changesStore.getChanges(),
+ databaseName: changesStore.getDatabaseName(),
+ isShowingSubset: changesStore.isShowingSubset()
+ };
+ },
+
+ onChange: function () {
+ this.setState(this.getState());
+ },
+
+ componentDidMount: function () {
+ changesStore.on('change', this.onChange, this);
+ },
+
+ componentWillUnmount: function () {
+ changesStore.off('change', this.onChange);
+ },
+
+ showingSubsetMsg: function () {
+ var msg = '';
+ if (this.state.isShowingSubset) {
+ var numChanges = this.state.changes.length;
+ msg = <p className="changes-result-limit">Limiting results to latest <b>{numChanges}</b> changes.</p>;
+ }
+ return msg;
+ },
+
+ getRows: function () {
+ return _.map(this.state.changes, function (change) {
+ return <ChangeRow change={change} key={change.id} databaseName={this.state.databaseName} />;
+ }, this);
+ },
+
+ render: function () {
+ return (
+ <div className="js-changes-view">
+ {this.showingSubsetMsg()}
+ {this.getRows()}
+ </div>
+ );
+ }
+ });
+
+
+ var ChangeRow = React.createClass({
+ propTypes: function () {
+ return {
+ change: React.PropTypes.object,
+ databaseName: React.PropTypes.string.isRequired
+ };
+ },
+
+ getInitialState: function () {
+ return {
+ codeVisible: false
+ };
+ },
+
+ toggleJSON: function (e) {
+ e.preventDefault();
+ this.setState({ codeVisible: !this.state.codeVisible });
+ },
+
+ getChangesCode: function () {
+ var json = '';
+ if (this.state.codeVisible) {
+ var code = {
--- End diff --
You could neaten this a bit by moving it into a function.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by robertkowalski <gi...@git.apache.org>.
Github user robertkowalski commented on a diff in the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#discussion_r25784666
--- Diff: app/addons/documents/changes/stores.js ---
@@ -15,51 +15,58 @@ define([
'addons/documents/changes/actiontypes'
], function (FauxtonAPI, ActionTypes) {
- var Stores = {};
-
- // tracks the state of the header (open/closed)
- var ChangesHeaderStore = FauxtonAPI.Store.extend({
+ var ChangesStore = FauxtonAPI.Store.extend({
initialize: function () {
this.reset();
},
reset: function () {
this._tabVisible = false;
+ this._filters = [];
+ this._changes = [];
+ this._databaseName = '';
+ this._maxChangesListed = 1000;
+ this._showingSubset = false;
},
- toggleTabVisibility: function () {
- this._tabVisible = !this._tabVisible;
+ setChanges: function (options) {
+ this._filters = options.filters;
+ this._databaseName = options.databaseName;
+ this._changes = _.map(options.changes, function (change) {
+ return {
+ id: change.get('id'),
+ seq: change.get('seq'),
+ deleted: change.get('deleted') ? change.get('deleted') : false,
+ changes: change.get('changes'),
+ doc: change.get('doc') // only populated with ?include_docs=true
+ };
+ });
--- End diff --
oh wait, even simpler:
```js
this._changes = options.changes.toJSON();
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-fauxton pull request: Changes page content moved to React
Posted by benkeen <gi...@git.apache.org>.
Github user benkeen commented on the pull request:
https://github.com/apache/couchdb-fauxton/pull/303#issuecomment-78086562
Rebased with master; a new test in master caused the last build to fail. Patched.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---