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 28ea997 Remove JQuery uses from database addon (#1064)
28ea997 is described below
commit 28ea99710d8f1e21690728e7db5f6edd5e3665ef
Author: Antonio Maranhao <[email protected]>
AuthorDate: Mon Mar 12 10:38:05 2018 -0400
Remove JQuery uses from database addon (#1064)
---
app/addons/databases/actions.js | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/app/addons/databases/actions.js b/app/addons/databases/actions.js
index 1e7794c..5b112bc 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 });
});
}
};
--
To stop receiving notification emails like this one, please contact
[email protected].