You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/08/30 13:41:39 UTC

[GitHub] garrensmith commented on a change in pull request #971: WIP - Refactor documents/mango addon to use Redux

garrensmith commented on a change in pull request #971: WIP - Refactor documents/mango addon to use Redux
URL: https://github.com/apache/couchdb-fauxton/pull/971#discussion_r136064892
 
 

 ##########
 File path: app/addons/documents/index-results/apis/fetch.js
 ##########
 @@ -183,14 +198,30 @@ export const postToBulkDocs = (databaseName, payload) => {
   .then(res => res.json());
 };
 
-export const processBulkDeleteResponse = (res, originalDocs, designDocs) => {
+export const postToIndexBulkDelete = (databaseName, payload) => {
+  const url = FauxtonAPI.urls('mango', 'index-server-bulk-delete', databaseName);
+  return fetch(url, {
+    method: 'POST',
+    credentials: 'include',
+    body: JSON.stringify(payload),
+    headers: {
+      'Accept': 'application/json; charset=utf-8',
+      'Content-Type': 'application/json'
+    }
+  })
+  .then(res => res.json());
+};
+
+export const processBulkDeleteResponse = (res, deletedDocs, designDocs, docType) => {
   FauxtonAPI.addNotification({
     msg: 'Successfully deleted your docs',
     clear:  true
   });
 
-  const failedDocs = res.filter(doc => !!doc.error).map(doc => doc.id);
-  const hasDesignDocs = !!originalDocs.map(d => d._id).find((_id) => /_design/.test(_id));
+  const failedDocs = docType === 'MangoIndex' ?
+    (res.fail ? res.fail.map(doc => doc.id) : [])
 
 Review comment:
   I think lets expand this. Its pretty tricky to read.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services