couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [couchdb-fauxton] branch master updated: Remove default JSON link from API Bar (#991)
Date Wed, 04 Oct 2017 07:07:28 GMT
This is an automated email from the ASF dual-hosted git repository.

garren 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 7cf251f  Remove default JSON link from API Bar (#991)
7cf251f is described below

commit 7cf251f2e239b375bee5a8d802f930ecbf8bfaee
Author: Antonio Maranhao <30349380+Antonio-Maranhao@users.noreply.github.com>
AuthorDate: Wed Oct 4 03:07:26 2017 -0400

    Remove default JSON link from API Bar (#991)
---
 .../index-results/containers/ApiBarContainer.js    | 25 ++++++----------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/app/addons/documents/index-results/containers/ApiBarContainer.js b/app/addons/documents/index-results/containers/ApiBarContainer.js
index c126090..2f37753 100644
--- a/app/addons/documents/index-results/containers/ApiBarContainer.js
+++ b/app/addons/documents/index-results/containers/ApiBarContainer.js
@@ -17,28 +17,15 @@ import { ApiBarWrapper } from '../../../components/layouts';
 import { getQueryOptionsParams } from '../reducers';
 import FauxtonAPI from '../../../../core/api';
 
-const urlRef = (databaseName, params) => {
-  let query = queryString.stringify(params);
-
-  if (query) {
-    query = `?${query}`;
-  }
-
-  return FauxtonAPI.urls('allDocs', "apiurl", encodeURIComponent(databaseName), query);
-};
-
-const mapStateToProps = ({indexResults}, {docUrl, endpoint, databaseName, endpointAddQueryOptions})
=> {
+const mapStateToProps = ({indexResults}, {docUrl, endpoint, endpointAddQueryOptions}) =>
{
   if (!docUrl) {
     docUrl = FauxtonAPI.constants.DOC_URLS.GENERAL;
   }
-  if (!endpoint) {
-    endpoint = urlRef(databaseName, getQueryOptionsParams(indexResults));
-  } else {
-    if (endpointAddQueryOptions) {
-      const query = queryString.stringify(getQueryOptionsParams(indexResults));
-      if (query) {
-        endpoint = endpoint.indexOf('?') == -1 ? `${endpoint}?${query}` : `${endpoint}&${query}`;
-      }
+
+  if (endpoint && endpointAddQueryOptions) {
+    const query = queryString.stringify(getQueryOptionsParams(indexResults));
+    if (query) {
+      endpoint = endpoint.indexOf('?') == -1 ? `${endpoint}?${query}` : `${endpoint}&${query}`;
     }
   }
   return { docUrl, endpoint };

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message