You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2014/03/03 17:58:31 UTC

[19/34] couchdb commit: updated refs/heads/paginate-api-options to b63c791

Working on doc limit


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

Branch: refs/heads/paginate-api-options
Commit: 9ccfdd9685af2d746c1ea440fc5093eb7369110e
Parents: 0f69dc9
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Jan 29 15:48:34 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Mon Mar 3 11:18:40 2014 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/documents/resources.js | 5 ++++-
 src/fauxton/app/addons/documents/routes.js    | 3 ++-
 src/fauxton/app/addons/documents/views.js     | 4 +++-
 src/fauxton/app/addons/fauxton/components.js  | 7 +++++++
 4 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/9ccfdd96/src/fauxton/app/addons/documents/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/resources.js b/src/fauxton/app/addons/documents/resources.js
index a1f43a5..15d4d30 100644
--- a/src/fauxton/app/addons/documents/resources.js
+++ b/src/fauxton/app/addons/documents/resources.js
@@ -279,10 +279,11 @@ function(app, FauxtonAPI) {
     },
     initialize: function(_models, options) {
       this.database = options.database;
-      this.params = options.params;
+      this.params = _.clone(options.params);
       this.skipFirstItem = false;
       this.totalRowsToPaginate = 100;
       this.on("remove",this.decrementTotalRows , this);
+      this.perPageLimit = options.perPageLimit || 20;
     },
 
     url: function(context) {
@@ -315,6 +316,8 @@ function(app, FauxtonAPI) {
     },
 
     updateLimit: function (limit) {
+      this.perPageLimit = limit;
+
       if (this.params.startkey_docid && this.params.startkey) {
         //we are paginating so set limit + 1
         this.params.limit = limit + 1;

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9ccfdd96/src/fauxton/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js
index 0c95bcf..9ef8837 100644
--- a/src/fauxton/app/addons/documents/routes.js
+++ b/src/fauxton/app/addons/documents/routes.js
@@ -211,7 +211,8 @@ function(app, FauxtonAPI, Documents, Databases) {
       }));
 
       this.documentsView = this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
-        collection: this.data.database.allDocs
+        collection: this.data.database.allDocs,
+        docLimit: parseInt(docOptions.limit, 10)
       }));
 
       this.crumbs = [

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9ccfdd96/src/fauxton/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index ce06189..a33bd47 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -582,6 +582,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
         this.ddocID = options.ddocInfo.id;
       }
       this.newView = options.newView || false;
+      this.docLimit = options.docLimit;
       this.expandDocs = true;
     },
 
@@ -667,7 +668,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
 
       this.pagination = new Components.IndexPagination({
         collection: this.collection,
-        scrollToSelector: '#dashboard-content'
+        scrollToSelector: '#dashboard-content',
+        docLimit: this.docLimit
       });
     },
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9ccfdd96/src/fauxton/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/fauxton/components.js b/src/fauxton/app/addons/fauxton/components.js
index 3ead39d..225a21b 100644
--- a/src/fauxton/app/addons/fauxton/components.js
+++ b/src/fauxton/app/addons/fauxton/components.js
@@ -74,6 +74,7 @@ function(app, FauxtonAPI, ace, spin) {
       this.pageNumber = 0;
       this._pageStart = 1;
       this.perPage = 20;
+      this.docLimit = options.docLimit || 100;
     },
 
     canShowPreviousfn: function () {
@@ -87,6 +88,12 @@ function(app, FauxtonAPI, ace, spin) {
       if (this.collection.length < (this.perPage -1)) {
         return false;
       }
+
+      console.log(this.pageStart() + this.perPage, this.docLimit);
+      if ((this.pageStart() + this.perPage) >= this.docLimit) {
+        return false;
+      }
+
       return true;
     },