You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by de...@apache.org on 2013/09/09 22:15:07 UTC

[3/4] git commit: updated refs/heads/1807-Replication to e0e3858

Fauxton: Database always lists databases

The database list fails to show any databases if a user is not allowed access to a database.
This fixes it so the user can still see all databases but won't get any
info for a database they don't have access to.


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

Branch: refs/heads/1807-Replication
Commit: 466a7ec578793b3c56733c42adfe78f89e329ce6
Parents: 6f72ac9
Author: Garren Smith <ga...@gmail.com>
Authored: Mon Sep 9 12:02:21 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Mon Sep 9 12:03:58 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/modules/databases/resources.js | 5 +++++
 src/fauxton/app/modules/databases/routes.js    | 9 ++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/466a7ec5/src/fauxton/app/modules/databases/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/resources.js b/src/fauxton/app/modules/databases/resources.js
index e019bdd..f613cdf 100644
--- a/src/fauxton/app/modules/databases/resources.js
+++ b/src/fauxton/app/modules/databases/resources.js
@@ -116,6 +116,11 @@ function(app, FauxtonAPI, Documents) {
       var i = -1;
       var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
       var fileSizeInBytes = this.diskSize();
+
+      if (!fileSizeInBytes) {
+        return 0;
+      }
+
       do {
           fileSizeInBytes = fileSizeInBytes / 1024;
           i++;

http://git-wip-us.apache.org/repos/asf/couchdb/blob/466a7ec5/src/fauxton/app/modules/databases/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/routes.js b/src/fauxton/app/modules/databases/routes.js
index cdcb3ca..001fab6 100644
--- a/src/fauxton/app/modules/databases/routes.js
+++ b/src/fauxton/app/modules/databases/routes.js
@@ -45,10 +45,6 @@ function(app, FauxtonAPI, Databases, Views) {
     initialize: function() {
       this.databases = new Databases.List();
       this.deferred = FauxtonAPI.Deferred();
-
-      // this.sidebarView = this.setView("#sidebar-content", new Views.Sidebar({
-      //   collection: this.databases
-      // }));
     },
 
     allDatabases: function() {
@@ -68,8 +64,11 @@ function(app, FauxtonAPI, Databases, Views) {
 
       databases.fetch().done(function(resp) {
         FauxtonAPI.when(databases.map(function(database) {
+          console.log('fetching', database);
           return database.status.fetch();
-        })).done(function(resp) {
+        })).always(function(resp) {
+          //make this always so that even if a user is not allowed access to a database
+          //they will still see a list of all databases
           deferred.resolve();
         });
       });