You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/03/12 14:38:07 UTC

[GitHub] Antonio-Maranhao closed pull request #1064: Remove JQuery uses from database addon

Antonio-Maranhao closed pull request #1064: Remove JQuery uses from database addon
URL: https://github.com/apache/couchdb-fauxton/pull/1064
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/app/addons/databases/actions.js b/app/addons/databases/actions.js
index 1e7794ca9..5b112bc50 100644
--- a/app/addons/databases/actions.js
+++ b/app/addons/databases/actions.js
@@ -11,6 +11,7 @@
 // the License.
 import app from "../../app";
 import FauxtonAPI from "../../core/api";
+import { get } from "../../core/ajax";
 import Stores from "./stores";
 import ActionTypes from "./actiontypes";
 import Resources from "./resources";
@@ -26,17 +27,13 @@ function getDatabaseDetails (dbList, fullDbList) {
     fetch(url)
       .then((res) => {
         databaseDetails.push(res);
-      })
-      .fail(() => {
+      }).catch(() => {
         failedDbs.push(db);
-      })
-      .always(() => {
+      }).then(() => {
         seen++;
-
         if (seen !== dbList.length) {
           return;
         }
-
         updateDatabases({
           dbList: dbList,
           databaseDetails: databaseDetails,
@@ -48,11 +45,10 @@ function getDatabaseDetails (dbList, fullDbList) {
 }
 
 function fetch (url) {
-  return $.ajax({
-    cache: false,
-    url: url,
-    dataType: 'json'
-  }).then((res) => {
+  return get(url).then(res => {
+    if (res.error) {
+      throw new Error(res.reason || res.error);
+    }
     return res;
   });
 }
@@ -189,20 +185,14 @@ export default {
     });
 
     const url = `${app.host}/_all_dbs${query}`;
-    $.ajax({
-      cache: false,
-      url: url,
-      dataType: 'json'
-    }).then((dbs) => {
+    get(url).then((dbs) => {
       const options = dbs.map(db => {
         return {
           value: db,
           label: db
         };
       });
-      callback(null, {
-        options: options
-      });
+      callback(null, { options: options });
     });
   }
 };


 

----------------------------------------------------------------
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