couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [9/50] [abbrv] git commit: Display notifications when creating a new database
Date Mon, 11 Feb 2013 11:12:15 GMT
Display notifications when creating a new database

Notifications are displayed for:

 - Creating database
 - Database created successfully
 - Create database failed


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

Branch: refs/heads/fauxton
Commit: 08de3e75577c653728628a07aada5b81dd7e8b6d
Parents: 48752ff
Author: Mike Wallace <mikewallace1979@googlemail.com>
Authored: Sun Jan 20 08:54:54 2013 -0500
Committer: Mike Wallace <mikewallace1979@googlemail.com>
Committed: Sun Jan 20 15:31:55 2013 +0000

----------------------------------------------------------------------
 src/fauxton/app/modules/databases/views.js |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/08de3e75/src/fauxton/app/modules/databases/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/views.js b/src/fauxton/app/modules/databases/views.js
index f3aae8d..fafddc5 100644
--- a/src/fauxton/app/modules/databases/views.js
+++ b/src/fauxton/app/modules/databases/views.js
@@ -104,10 +104,24 @@ function(app, FauxtonAPI) {
         id: encodeURIComponent(name),
         name: name
       });
+      var notification = FauxtonAPI.addNotification({msg: "Creating database."});
       db.save().done(function() {
+        notification = FauxtonAPI.addNotification({
+          msg: "Database created successfully",
+          type: "success",
+          clear: true
+        });
         var route = "#/database/" +  name + "/_all_docs?limit=100";
         app.router.navigate(route, { trigger: true });
       }
+      ).error(function(xhr) {
+        var responseText = JSON.parse(xhr.responseText).reason;
+        notification = FauxtonAPI.addNotification({
+          msg: "Create database failed: " + responseText,
+          type: "error",
+          clear: true
+        });
+      }
       );
     },
 


Mime
View raw message