couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [2/6] fauxton commit: updated refs/heads/master to ae2225e
Date Wed, 27 May 2015 12:05:59 GMT
mango: display error message

show error message if index creation failed

PR: #427
PR-URL: https://github.com/apache/couchdb-fauxton/pull/427
Reviewed-By: garren smith <garren.smith@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/ae2225e9
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/ae2225e9
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/ae2225e9

Branch: refs/heads/master
Commit: ae2225e9d91926f959b2e961edf37e4ac79cfa8c
Parents: 10f9d01
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Tue May 26 16:37:12 2015 +0200
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Wed May 27 14:09:39 2015 +0200

----------------------------------------------------------------------
 app/addons/documents/mango/mango.actions.js | 59 ++++++++++++++----------
 1 file changed, 34 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/ae2225e9/app/addons/documents/mango/mango.actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/mango/mango.actions.js b/app/addons/documents/mango/mango.actions.js
index 8ba7bdd..2cd4894 100644
--- a/app/addons/documents/mango/mango.actions.js
+++ b/app/addons/documents/mango/mango.actions.js
@@ -55,37 +55,46 @@ function (app, FauxtonAPI, Documents, ActionTypes, Stores, PaginationStores,
Ind
         clear: true
       });
 
-      mangoIndex.save().then(function (res) {
-        var url = '#' + FauxtonAPI.urls('mango', 'query-app', options.database.safeID());
-
-        FauxtonAPI.dispatch({
-          type: ActionTypes.MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS,
-          options: {
-            fields: queryCode.index.fields
-          }
-        });
+      mangoIndex
+        .save()
+        .then(function (res) {
+          var url = '#' + FauxtonAPI.urls('mango', 'query-app', options.database.safeID());
+
+          FauxtonAPI.dispatch({
+            type: ActionTypes.MANGO_NEW_QUERY_FIND_CODE_FROM_FIELDS,
+            options: {
+              fields: queryCode.index.fields
+            }
+          });
 
-        var mangoIndexCollection = new Documents.MangoIndexCollection(null, {
-          database: options.database,
-          params: null,
-          paging: {
-            pageSize: PaginationStores.indexPaginationStore.getPerPage()
-          }
-        });
+          var mangoIndexCollection = new Documents.MangoIndexCollection(null, {
+            database: options.database,
+            params: null,
+            paging: {
+              pageSize: PaginationStores.indexPaginationStore.getPerPage()
+            }
+          });
 
-        this.getIndexList({indexList: mangoIndexCollection}).then(function () {
+          this.getIndexList({indexList: mangoIndexCollection}).then(function () {
 
-          IndexResultActions.reloadResultsList();
+            IndexResultActions.reloadResultsList();
 
+            FauxtonAPI.addNotification({
+              msg: 'Index is ready for querying. <a href="' + url + '">Run a Query.</a>',
+              type: 'success',
+              clear: true,
+              escape: false
+            });
+          }.bind(this));
+
+        }.bind(this))
+        .fail(function (res) {
           FauxtonAPI.addNotification({
-            msg:  'Index is ready for querying. <a href="' + url + '">Run a Query.</a>',
-            type: 'success',
-            clear: true,
-            escape: false
+            msg: res.responseJSON.reason,
+            type: 'error',
+            clear: true
           });
-        }.bind(this));
-
-      }.bind(this));
+        });
     },
 
     mangoResetIndexList: function (options) {


Mime
View raw message