couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deathb...@apache.org
Subject [9/9] git commit: updated refs/heads/1958-only-fetch-db-per-page to a388706
Date Tue, 17 Dec 2013 16:18:16 GMT
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/a388706d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a388706d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a388706d

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: a388706db79031af756f1bb4be6d87a966909a17
Parents: d5f0976
Author: suelockwood <deathbear@apache.org>
Authored: Thu Dec 12 16:14:10 2013 -0500
Committer: suelockwood <deathbear@apache.org>
Committed: Tue Dec 17 11:10:19 2013 -0500

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


http://git-wip-us.apache.org/repos/asf/couchdb/blob/a388706d/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/a388706d/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..02b0297 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();
 


Mime
View raw message