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/12/12 22:14:23 UTC

git commit: updated refs/heads/1958-only-fetch-db-per-page to 25a5731

Updated Branches:
  refs/heads/1958-only-fetch-db-per-page [created] 25a57313f


Fixing database landing page so that it doesn't fetch the status of every database on load.
Only fetches the # of databases showing per page.


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

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: 25a57313fccaadcb212e7ffadb5190f513ce121d
Parents: 6bb810f
Author: suelockwood <de...@apache.org>
Authored: Thu Dec 12 16:14:10 2013 -0500
Committer: suelockwood <de...@apache.org>
Committed: Thu Dec 12 16:14:10 2013 -0500

----------------------------------------------------------------------
 src/fauxton/app/modules/databases/routes.js | 15 +--------------
 src/fauxton/app/modules/databases/views.js  | 23 ++++++++++++++++++++---
 2 files changed, 21 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/25a57313/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 ac50b4b..e63c3a7 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()];
     }
   });
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/25a57313/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 7d59ac4..aa2aa11 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")),
@@ -36,7 +38,7 @@ function(app, Components, FauxtonAPI, Databases) {
 
   Views.List = FauxtonAPI.View.extend({
     dbLimit: 20,
-    perPage: 20,
+    perPage: 10,
     template: "templates/databases/list",
     events: {
       "click button.all": "selectAll",
@@ -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();
 
@@ -79,6 +93,7 @@ function(app, Components, FauxtonAPI, Databases) {
       return this.collection.slice(start, end);
     },
 
+
     beforeRender: function() {
 
       this.insertView("#newButton", new Views.NewDatabaseButton({
@@ -86,11 +101,13 @@ function(app, Components, FauxtonAPI, Databases) {
       }));
 
       _.each(this.paginated(), function(database) {
+        console.log(database);
         this.insertView("table.databases tbody", new Views.Item({
           model: database
         }));
       }, this);
 
+
       this.insertView("#database-pagination", new Components.Pagination({
         page: this.page,
         perPage: this.perPage,