summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsuelockwood <deathbear@apache.org>2013-12-12 16:14:10 -0500
committersuelockwood <deathbear@apache.org>2013-12-17 11:10:19 -0500
commita388706db79031af756f1bb4be6d87a966909a17 (patch)
treee4f5eaed20c81d802a99d17e71539a777d322aab
parentd5f0976784ccd70883c8b7c17b1d4503af72f554 (diff)
downloadcouchdb-1958-only-fetch-db-per-page.tar.gz
Fixing database landing page so that it doesn't fetch the status of every database on load.1958-only-fetch-db-per-page
Only fetches the # of databases showing per page.
-rw-r--r--src/fauxton/app/modules/databases/routes.js15
-rw-r--r--src/fauxton/app/modules/databases/views.js18
2 files changed, 17 insertions, 16 deletions
diff --git a/src/fauxton/app/modules/databases/routes.js b/src/fauxton/app/modules/databases/routes.js
index ac50b4bc8..e63c3a769 100644
--- a/src/fauxton/app/modules/databases/routes.js
+++ b/src/fauxton/app/modules/databases/routes.js
@@ -59,20 +59,7 @@ function(app, FauxtonAPI, Databases, Views) {
},
establish: function() {
- var databases = this.databases;
- var deferred = this.deferred;
-
- databases.fetch().done(function(resp) {
- FauxtonAPI.when(databases.map(function(database) {
- return database.status.fetch();
- })).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();
- });
- });
-
- return [deferred];
+ return [this.databases.fetch()];
}
});
diff --git a/src/fauxton/app/modules/databases/views.js b/src/fauxton/app/modules/databases/views.js
index 7d59ac42d..02b0297b7 100644
--- a/src/fauxton/app/modules/databases/views.js
+++ b/src/fauxton/app/modules/databases/views.js
@@ -24,7 +24,9 @@ function(app, Components, FauxtonAPI, Databases) {
Views.Item = FauxtonAPI.View.extend({
template: "templates/databases/item",
tagName: "tr",
-
+ establish: function(){
+ return [this.model.fetch()];
+ },
serialize: function() {
return {
encoded: encodeURIComponent(this.model.get("name")),
@@ -54,7 +56,19 @@ function(app, Components, FauxtonAPI, Databases) {
databases: this.collection
};
},
-
+ establish: function(){
+ var currentDBs = this.paginated();
+ var deferred = FauxtonAPI.Deferred();
+
+ FauxtonAPI.when(currentDBs.map(function(database) {
+ return database.status.fetch();
+ })).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();
+ });
+ return [deferred];
+ },
switchDatabase: function(event, selectedName) {
event && event.preventDefault();