garrensmith commented on a change in pull request #950: Simplify Mango/Query 
panel layout
URL: https://github.com/apache/couchdb-fauxton/pull/950#discussion_r132897593
 
 

 ##########
 File path: app/addons/documents/mango/mango.actions.js
 ##########
 @@ -91,33 +72,31 @@ export default {
       });
   },
 
-  mangoResetIndexList: function (options) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.MANGO_RESET,
-      options: options
-    });
-  },
-
-  getIndexList: function (options) {
-    FauxtonAPI.dispatch({
-      type: ActionTypes.MANGO_NEW_AVAILABLE_INDEXES,
-      options: options
-    });
-
-    return options.indexList.fetch({reset: true}).then(() => {
-      this.mangoResetIndexList({isLoading: false});
-    }, (xhr) => {
-      let errorMsg = 'Bad request!';
-      if (xhr.responseJSON && xhr.responseJSON.error === 'not_found') {
-        const databaseName = options.indexList.database.safeID();
-        errorMsg = `The ${databaseName} database does not exist.`;
-        FauxtonAPI.navigate('/', {trigger: true});
+  runExplainQuery: function ({database, queryCode}) {
+    const url = FauxtonAPI.urls('mango', 'explain-server', database.safeID()),
+        query = JSON.parse(queryCode);
+
+    $.ajax({
+      type: 'POST',
+      url: url,
+      contentType: 'application/json; charset=utf-8',
+      dataType: 'json',
+      data: JSON.stringify(query),
+      success: function (explainPlan) {
 
 Review comment:
   Instead of using `success` callbacks. Could you rather use `.then()` promise.
 
----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to