couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amaran...@apache.org
Subject [couchdb-fauxton] branch master updated: Enabled JSON and Table modes when querying partitioned views (#1176)
Date Wed, 30 Jan 2019 14:55:06 GMT
This is an automated email from the ASF dual-hosted git repository.

amaranhao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git


The following commit(s) were added to refs/heads/master by this push:
     new 9fac7fa  Enabled JSON and Table modes when querying partitioned views (#1176)
9fac7fa is described below

commit 9fac7fa795e81067a2a02020e18a932abf143906
Author: Antonio Maranhao <30349380+Antonio-Maranhao@users.noreply.github.com>
AuthorDate: Wed Jan 30 11:54:59 2019 -0300

    Enabled JSON and Table modes when querying partitioned views (#1176)
---
 app/addons/documents/__tests__/results-toolbar.test.js | 4 ++--
 app/addons/documents/header/header.js                  | 4 +---
 app/addons/documents/index-results/api.js              | 3 +--
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/app/addons/documents/__tests__/results-toolbar.test.js b/app/addons/documents/__tests__/results-toolbar.test.js
index 45e2a13..614d1e1 100644
--- a/app/addons/documents/__tests__/results-toolbar.test.js
+++ b/app/addons/documents/__tests__/results-toolbar.test.js
@@ -147,14 +147,14 @@ describe('Results Toolbar', () => {
     expect(wrapper.find('button')).toHaveLength(4);
   });
 
-  it('hides Table and JSON modes when querying a partitioned view', () => {
+  it('shows Table, Metadata and JSON modes when querying a partitioned view', () => {
     const wrapper = mount(<ResultsToolBar
       {...defaultProps}
       hasResults={true}
       isListDeletable={false}
       partitionKey={'partKey1'}
       fetchUrl='/my_db/_partition/my_partition/_design/ddoc1/_view/view1'/>);
-    expect(wrapper.find('button')).toHaveLength(2);
+    expect(wrapper.find('button')).toHaveLength(4);
   });
 
   it('shows Table, Metadata and JSON modes when showing All Documents filtered by partition',
() => {
diff --git a/app/addons/documents/header/header.js b/app/addons/documents/header/header.js
index 3f1171c..c481e23 100644
--- a/app/addons/documents/header/header.js
+++ b/app/addons/documents/header/header.js
@@ -24,7 +24,6 @@ export default class BulkDocumentHeaderController extends React.Component
{
       selectedLayout,
       docType,
       queryOptionsParams,
-      partitionKey,
       fetchUrl
     } = this.props;
 
@@ -42,10 +41,9 @@ export default class BulkDocumentHeaderController extends React.Component
{
 
     // Reduce doesn't allow for include_docs=true, so we'll hide the JSON and table modes
     // since they force 'include_docs=true' when reduce is checked in the query options panel.
-    // Partitioned views don't support 'include_docs=true' either.
     const isAllDocsQuery = fetchUrl && fetchUrl.includes('/_all_docs');
     const isMangoQuery = docType === Constants.INDEX_RESULTS_DOC_TYPE.MANGO_QUERY;
-    if (isAllDocsQuery || isMangoQuery || (!queryOptionsParams.reduce && !partitionKey))
{
+    if (isAllDocsQuery || isMangoQuery || (!queryOptionsParams.reduce)) {
       table = <Button
         className={selectedLayout === Constants.LAYOUT_ORIENTATION.TABLE ? 'active' : ''}
         onClick={this.toggleLayout.bind(this, Constants.LAYOUT_ORIENTATION.TABLE)}
diff --git a/app/addons/documents/index-results/api.js b/app/addons/documents/index-results/api.js
index 9278879..7bf6370 100644
--- a/app/addons/documents/index-results/api.js
+++ b/app/addons/documents/index-results/api.js
@@ -50,7 +50,6 @@ export const queryMapReduceView = (fetchUrl, params) => {
   // removes params not supported by partitioned views
   const isPartitioned = fetchUrl.includes('/_partition/');
   if (isPartitioned) {
-    params.include_docs = undefined;
     params.stable = undefined;
     params.conflicts = undefined;
   }
@@ -63,7 +62,7 @@ export const queryMapReduceView = (fetchUrl, params) => {
     return {
       docs: json.rows,
       docType: Constants.INDEX_RESULTS_DOC_TYPE.VIEW,
-      layout: isPartitioned ? Constants.LAYOUT_ORIENTATION.METADATA : undefined
+      layout: undefined
     };
   });
 };


Mime
View raw message