Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B57F0200B95 for ; Tue, 27 Sep 2016 17:57:34 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B3FC6160AD2; Tue, 27 Sep 2016 15:57:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D0EED160AB9 for ; Tue, 27 Sep 2016 17:57:33 +0200 (CEST) Received: (qmail 66497 invoked by uid 500); 27 Sep 2016 15:57:33 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 66487 invoked by uid 99); 27 Sep 2016 15:57:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Sep 2016 15:57:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DC1F1DFC55; Tue, 27 Sep 2016 15:57:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: garren@apache.org To: commits@couchdb.apache.org Message-Id: <4eb5e1c5cfce497da261d8633728d052@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: fauxton commit: updated refs/heads/master to 717512f Date: Tue, 27 Sep 2016 15:57:32 +0000 (UTC) archived-at: Tue, 27 Sep 2016 15:57:34 -0000 Repository: couchdb-fauxton Updated Branches: refs/heads/master 0a13f5dca -> 717512f5f Fix design doc with include_docs This fixes the issue that if you are viewing the design docs for a database and then click on the query options and click include_docs and then run query it would stop showing the design docs. Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/717512f5 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/717512f5 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/717512f5 Branch: refs/heads/master Commit: 717512f5f7413f6513f9591dea46bdb0b9bd48fb Parents: 0a13f5d Author: Garren Smith Authored: Tue Sep 27 15:46:47 2016 +0200 Committer: Garren Smith Committed: Tue Sep 27 16:52:41 2016 +0200 ---------------------------------------------------------------------- app/addons/documents/queryoptions/stores.js | 30 ++++++++++---- .../tests/queryoptions.storesSpec.js | 43 ++++++++++++-------- 2 files changed, 49 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/717512f5/app/addons/documents/queryoptions/stores.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/queryoptions/stores.js b/app/addons/documents/queryoptions/stores.js index 19834e3..3246f3f 100644 --- a/app/addons/documents/queryoptions/stores.js +++ b/app/addons/documents/queryoptions/stores.js @@ -58,7 +58,7 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({ this._isVisible = true; }, - setTrayVisible: function (trayVisible) { + setTrayVisible (trayVisible) { this._trayVisible = trayVisible; }, @@ -78,11 +78,11 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({ return this._betweenKeys; }, - updateBetweenKeys: function (newBetweenKeys) { + updateBetweenKeys (newBetweenKeys) { this._betweenKeys = newBetweenKeys; }, - updateSkip: function (skip) { + updateSkip (skip) { this._skip = skip; }, @@ -94,7 +94,7 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({ return this._limit; }, - updateLimit: function (limit) { + updateLimit (limit) { this._limit = limit; }, @@ -102,7 +102,7 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({ return this._byKeys; }, - updateByKeys: function (keys) { + updateByKeys (keys) { this._byKeys = keys; }, @@ -142,12 +142,26 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({ return this._showBetweenKeys; }, - updateGroupLevel: function (groupLevel) { + updateGroupLevel (groupLevel) { this._groupLevel = groupLevel; }, - setQueryParams: function (params) { + sanitize (params) { + if (params.startkey) { + params.start_key = params.startkey; + delete params.startkey; + } + + if (params.endkey) { + params.end_key = params.endkey; + delete params.endkey; + } + + }, + + setQueryParams (params) { this.reset(); + this.sanitize(params); if (params.include_docs) { this._includeDocs = true; } @@ -243,7 +257,7 @@ Stores.QueryOptionsStore = FauxtonAPI.Store.extend({ return this._includeDocs; }, - dispatch: function (action) { + dispatch (action) { switch (action.type) { case ActionTypes.QUERY_RESET: this.setQueryParams(action.params); http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/717512f5/app/addons/documents/queryoptions/tests/queryoptions.storesSpec.js ---------------------------------------------------------------------- diff --git a/app/addons/documents/queryoptions/tests/queryoptions.storesSpec.js b/app/addons/documents/queryoptions/tests/queryoptions.storesSpec.js index 3966483..47c4401 100644 --- a/app/addons/documents/queryoptions/tests/queryoptions.storesSpec.js +++ b/app/addons/documents/queryoptions/tests/queryoptions.storesSpec.js @@ -19,38 +19,38 @@ var dispatchToken; var store; var opts; -describe('QueryOptions Store', function () { - beforeEach(function () { +describe('QueryOptions Store', () => { + beforeEach(() => { store = new Stores.QueryOptionsStore(); dispatchToken = FauxtonAPI.dispatcher.register(store.dispatch); }); - afterEach(function () { + afterEach(() => { FauxtonAPI.dispatcher.unregister(dispatchToken); }); - describe('Toggle By Keys and Between Keys', function () { + describe('Toggle By Keys and Between Keys', () => { - it('toggling by keys sets by keys to true', function () { + it('toggling by keys sets by keys to true', () => { store.toggleByKeys(); assert.ok(store.showByKeys()); }); - it('toggling between keys sets between keys to true', function () { + it('toggling between keys sets between keys to true', () => { store.toggleBetweenKeys(); assert.ok(store.showBetweenKeys()); }); - it('toggling between keys sets by keys to false', function () { + it('toggling between keys sets by keys to false', () => { store._showByKeys = true; store.toggleBetweenKeys(); assert.notOk(store.showByKeys()); }); - it('toggling by keys sets between keys to false', function () { + it('toggling by keys sets between keys to false', () => { store._showBetweenKeys = true; store.toggleByKeys(); assert.notOk(store.showBetweenKeys()); @@ -58,12 +58,12 @@ describe('QueryOptions Store', function () { }); - describe('getQueryParams', function () { - it('returns params for default', function () { + describe('getQueryParams', () => { + it('returns params for default', () => { assert.deepEqual(store.getQueryParams(), {}); }); - it('with betweenKeys', function () { + it('with betweenKeys', () => { store.toggleBetweenKeys(); store.updateBetweenKeys({ startkey:"a", @@ -78,7 +78,7 @@ describe('QueryOptions Store', function () { }); }); - it('with byKeys', function () { + it('with byKeys', () => { store.toggleByKeys(); store.updateByKeys("[1,2,3]"); @@ -88,9 +88,9 @@ describe('QueryOptions Store', function () { }); }); - describe('setQueryParams', function () { + describe('setQueryParams', () => { - it('sets all store values from given params', function () { + it('sets all store values from given params', () => { store.setQueryParams({ include_docs: true, @@ -105,7 +105,7 @@ describe('QueryOptions Store', function () { assert.equal(store.skip(), 5); }); - it('sets between keys', function () { + it('sets between keys', () => { store.setQueryParams({ start_key: 1, end_key: 5 @@ -117,7 +117,7 @@ describe('QueryOptions Store', function () { assert.ok(store.showBetweenKeys()); }); - it('sets by keys', function () { + it('sets by keys', () => { store.setQueryParams({ keys: [1, 2, 3] }); @@ -126,5 +126,16 @@ describe('QueryOptions Store', function () { assert.ok(store.showByKeys()); }); + it('works with startkey and endkey', () => { + store.setQueryParams({ + startkey: 1, + endkey: 5 + }); + + assert.equal(store.betweenKeys().startkey, 1); + assert.equal(store.betweenKeys().endkey, 5); + assert.ok(store.showBetweenKeys()); + }); + }); });