summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarren Smith <garren.smith@gmail.com>2013-09-09 12:02:21 +0200
committerGarren Smith <garren.smith@gmail.com>2013-09-09 12:03:58 +0200
commit466a7ec578793b3c56733c42adfe78f89e329ce6 (patch)
tree19950ade405de2ef75cc569e9190d817b74e620f
parent6f72ac9fc9b9ef918a625389b9e521ad9fbc7621 (diff)
downloadcouchdb-466a7ec578793b3c56733c42adfe78f89e329ce6.tar.gz
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.
-rw-r--r--src/fauxton/app/modules/databases/resources.js5
-rw-r--r--src/fauxton/app/modules/databases/routes.js9
2 files changed, 9 insertions, 5 deletions
diff --git a/src/fauxton/app/modules/databases/resources.js b/src/fauxton/app/modules/databases/resources.js
index e019bdda2..f613cdf47 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++;
diff --git a/src/fauxton/app/modules/databases/routes.js b/src/fauxton/app/modules/databases/routes.js
index cdcb3ca83..001fab6c8 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();
});
});