You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by garrensmith <gi...@git.apache.org> on 2014/03/03 18:19:27 UTC
[GitHub] couchdb pull request: New pagination
GitHub user garrensmith opened a pull request:
https://github.com/apache/couchdb/pull/162
New pagination
This is a much pagination for Fauxton.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/couchdb paginate-api-options
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb/pull/162.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #162
----
commit 0f69dc941479957a3eccb5c581af781da553d893
Author: Garren Smith <ga...@gmail.com>
Date: 2014-01-28T14:30:38Z
add per page view limit and new advanced options
commit 9ccfdd9685af2d746c1ea440fc5093eb7369110e
Author: Garren Smith <ga...@gmail.com>
Date: 2014-01-29T13:48:34Z
Working on doc limit
commit fa33d4d3e7c13ac99c4e79f69cc191cdb8091f9c
Author: Garren Smith <ga...@gmail.com>
Date: 2014-01-29T15:44:49Z
More working
commit 55b6ea67ac7e3b0180b216007c2018cd140e5703
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-03T10:10:08Z
Set view limit on pagination
commit 2cf0f41324b5332e0b60690be669deec234c395e
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-03T13:08:20Z
fix previous paginate
commit 69fa6c43e4cc23bf29b0aeeeb625bba20e4571ba
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-11T06:49:47Z
remove api options
commit 98b54724520bbebe46c09c8164690a42a3cda3d5
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-11T15:24:02Z
Paginiation with no limit
commit 4e10385a13e335d00f5b342e32ac6964fbb6634f
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-13T11:46:11Z
Fix query options not toggling
commit f796b38ef2474bdfed5303a627136ee3ad8ea8d2
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-19T13:23:52Z
Add new pagination algorithmn
commit 0beb91caeb1733d07f920a329ecbe3bb07f55187
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-19T14:47:30Z
More pagination improvements
commit 9848c76d30b17bdfec68edc28b18ee0fc1b786ab
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-20T09:15:16Z
More improvements
commit 77c06c28878015613c30f8c042aeaabdbb3423c8
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-20T16:02:45Z
More pagination fixes
commit 747e0040b1c491db47b932c807aef1982f61f394
Author: suelockwood <de...@apache.org>
Date: 2014-02-20T20:10:43Z
Invalid combination of query options causes the dashboard to hang
commit 0901b9bbd6ba43652d27210be1b809186777bd6c
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-21T04:06:03Z
Continued work
commit 8a27510e0ca8b3a9964df1232697a231c4d799af
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-21T13:50:24Z
Improvements around parameter parsing
commit cf7a92a090d52f71bf00c6ca147125157688d7cd
Author: Garren Smith <ga...@gmail.com>
Date: 2014-02-21T15:53:12Z
More pagination goodness
commit 7df61e79084a4a63ef0661d2e5eac556f6b8f5d4
Author: Garren Smith <ga...@gmail.com>
Date: 2014-03-03T09:31:26Z
Fix page count on perPage change
commit b63c79130e15c08810b1288495e0c0ba89358c3d
Author: Garren Smith <ga...@gmail.com>
Date: 2014-03-03T16:28:09Z
Code improvements to pagination
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220399
--- Diff: src/fauxton/app/addons/documents/routes.js ---
@@ -345,14 +376,62 @@ function(app, FauxtonAPI, Documents, Databases) {
}));
},
- paginate: function (direction) {
- _.extend(this.documentsView.collection.params, app.getParams());
+ perPageChange: function (perPage) {
+ var params = app.getParams();
+ this.perPage = perPage;
+ this.documentsView.updatePerPage(perPage);
+ this.documentsView.forceRender();
+ params.limit = perPage;
+ this.documentsView.collection.params = params;
+ this.setDocPerPageLimit(perPage);
+ },
+
+ paginate: function (options) {
+ var params = {},
+ urlParams = app.getParams(),
+ collection = this.documentsView.collection;
+
this.documentsView.forceRender();
- if (direction === 'next') {
- this.documentsView.collection.skipFirstItem = true;
+ var rawCollection = collection.map(function (item) { return item.toJSON(); });
+
+ // this is really ugly. But we basically need to make sure that
+ // all parameters are in the correct state and have been parsed before we
+ // calculate how to paginate the collection
+ _.each(['startkey', 'endkey', 'key'], function (key) {
+ if (_.has(collection.params, key)) {
+ collection.params[key] = JSON.parse(collection.params[key]);
+ }
+
+ if (_.has(urlParams, key)) {
+ urlParams[key] = JSON.parse(urlParams[key]);
+ }
+ });
+
+ if (options.direction === 'next') {
+ params = Documents.paginate.next(rawCollection,
+ collection.params,
+ options.perPage,
+ !!collection.isAllDocs);
} else {
- this.documentsView.collection.skipFirstItem = false;
+ params = Documents.paginate.previous(rawCollection,
+ collection.params,
+ options.perPage,
+ !!collection.isAllDocs);
}
+
+ // use the perPage sent from IndexPagination as it calculates how many
+ // docs to fetch for next page
+ params.limit = options.perPage;
+
+ // again not pretty but need to make sure all the parameters can be correctly
+ // built into a query
+ _.each(['startkey', 'endkey', 'key'], function (key) {
--- End diff --
same as prev. comment. Just pull it out and then you can reuse it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220493
--- Diff: src/fauxton/app/addons/documents/templates/advanced_options_menu.html ---
@@ -0,0 +1,46 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<div class="row-fluid custom-inputs">
+ <div class="controls controls-row">
+ <div class="checkbox inline">
+ <input id="include-docs-views" type="checkbox" name="include-docs" value="true">
+ <label for="include-docs-views">
+ Include Docs</label>
+ </div>
+ <% if (hasReduce) { %>
+ <div class="checkbox inline">
+ <input id="reduce" name="reduce" type="checkbox" value="true">
+ <label for="reduce">Reduce</label>
+ <label id="group-level-label" style="display:none" class="drop-down inline">
--- End diff --
add for="group-level"
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36539755
or another case: you configured query for specific view in Fauxton and know wanted to make the same request via curl or whatever client. Just copypaste the URL and remove `/_utils/fauxton` substring is better than typing all view query options manually again.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220526
--- Diff: src/fauxton/app/addons/documents/templates/all_docs_number.html ---
@@ -11,13 +11,25 @@
License for the specific language governing permissions and limitations under
the License.
-->
-<% if (totalRows === "unknown"){ %>
- Showing 0 documents. <a href="#/database/<%=database%>/new"> Create your first document.</a>
-<% } else if (showNumbers) { %>
- Showing <%=offset%> - <%= numModels %> of <%= totalRows %> rows
+<% if (totalRows === "unknown" || totalRows === 0){ %>
+Showing 0 documents. <a href="#/database/<%=database%>/new"> Create your first document.</a>
<% } else { %>
- Showing <%=pageStart%> - <%= pageEnd %>
+Showing <%=pageStart%> - <%= pageEnd %>
<%}%>
<% if (updateSeq) { %>
- -- Update Sequence: <%= updateSeq %>
+-- Update Sequence: <%= updateSeq %>
<% } %>
+
+<div id="per-page">
+ <label id="per-page" class="drop-down inline">
--- End diff --
add for="select-per-page"
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36782400
Testing this now and nothing is breaking for me.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220586
--- Diff: src/fauxton/app/addons/documents/views.js ---
@@ -477,17 +493,14 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
previewFn: this.previewView,
hasReduce: false,
showPreview: false,
- database: this.database
+ database: this.database,
--- End diff --
extra comma
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220050
--- Diff: src/fauxton/app/addons/documents/resources.js ---
@@ -274,20 +338,31 @@ function(app, FauxtonAPI) {
Documents.AllDocs = FauxtonAPI.Collection.extend({
model: Documents.Doc,
+ isAllDocs: true,
documentation: function(){
return "docs";
},
initialize: function(_models, options) {
this.database = options.database;
- this.params = options.params;
- this.skipFirstItem = false;
-
+ this.params = _.clone(options.params);
--- End diff --
Clone is neat. Why chose this over duplicating the options.params?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10245597
--- Diff: src/fauxton/test/mocha/chai.js ---
@@ -27,10 +27,14 @@ function require(path, parent, orig) {
// perform real require()
--- End diff --
Yeah, I was adding tests and realised we needed latest chai. This is stupid to update chai.js while working on a patch. So sorry about that.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36538662
@deathbearbrown hm?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36538352
Also, if I set bad value for `limit` in URL like `limit=foo`, Fauxton will show `Bad request` error popup and resets limit to 100 while default value is 20.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220754
--- Diff: src/fauxton/test/mocha/chai.js ---
@@ -27,10 +27,14 @@ function require(path, parent, orig) {
// perform real require()
--- End diff --
heh did you update chai too?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36539425
@deathbearbrown if so, than Fauxton shouldn't process them. However, I see that you wanted to kill the feature: processing query params from route url allows users to exchange views requests via URL and without talks like: "open view X, click query options, set startkey=Y, endkey=Z, limit=Q, reduce=false and you'll see the result as I do"
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220227
--- Diff: src/fauxton/app/addons/documents/routes.js ---
@@ -170,9 +168,11 @@ function(app, FauxtonAPI, Documents, Databases) {
this.data.designDocs = new Documents.AllDocs(null, {
database: this.data.database,
- params: {startkey: '"_design"',
+ params: {
+ startkey: '"_design"',
endkey: '"_design1"',
--- End diff --
Why "_design1"?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10221023
--- Diff: src/fauxton/app/addons/documents/routes.js ---
@@ -170,9 +168,11 @@ function(app, FauxtonAPI, Documents, Databases) {
this.data.designDocs = new Documents.AllDocs(null, {
database: this.data.database,
- params: {startkey: '"_design"',
+ params: {
+ startkey: '"_design"',
endkey: '"_design1"',
--- End diff --
To select only design documents. Is there any other way to do this?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36538924
I think we want to move away from passing the limit parameters in the route fragment.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36538603
> Bug: Page sizes 50 and 100 for browsing views doesn't works. Actually, it applies last selected page size or 20.
More notes: it only raises if `limit=N` is in URL. By default it's missed, but just navigate to some document and click on "Back to _all_docs" or enter it manually.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36604411
@kxepal Can you explain what you mean by the 50 and 100 limits not working?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36609679
@deathbearbrown
> The API URL button is what is going to show the URL for you to do curl commands, not the fauxton url.
Yes, and I was talking about sharing URL with Fauxton with all setted view query parameters. Different things.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220337
--- Diff: src/fauxton/app/addons/documents/routes.js ---
@@ -345,14 +376,62 @@ function(app, FauxtonAPI, Documents, Databases) {
}));
},
- paginate: function (direction) {
- _.extend(this.documentsView.collection.params, app.getParams());
+ perPageChange: function (perPage) {
+ var params = app.getParams();
+ this.perPage = perPage;
+ this.documentsView.updatePerPage(perPage);
+ this.documentsView.forceRender();
+ params.limit = perPage;
+ this.documentsView.collection.params = params;
+ this.setDocPerPageLimit(perPage);
+ },
+
+ paginate: function (options) {
+ var params = {},
+ urlParams = app.getParams(),
+ collection = this.documentsView.collection;
+
this.documentsView.forceRender();
- if (direction === 'next') {
- this.documentsView.collection.skipFirstItem = true;
+ var rawCollection = collection.map(function (item) { return item.toJSON(); });
+
+ // this is really ugly. But we basically need to make sure that
+ // all parameters are in the correct state and have been parsed before we
+ // calculate how to paginate the collection
+ _.each(['startkey', 'endkey', 'key'], function (key) {
--- End diff --
can you pull this out into it's own function?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220446
--- Diff: src/fauxton/app/addons/documents/routes.js ---
@@ -170,9 +168,11 @@ function(app, FauxtonAPI, Documents, Databases) {
this.data.designDocs = new Documents.AllDocs(null, {
database: this.data.database,
- params: {startkey: '"_design"',
+ params: {
+ startkey: '"_design"',
endkey: '"_design1"',
--- End diff --
Futon sets `endkey` as `_design0`. But actual request that Fauxton makes is `endkey="_e"`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220922
--- Diff: src/fauxton/app/addons/documents/routes.js ---
@@ -170,9 +168,11 @@ function(app, FauxtonAPI, Documents, Databases) {
this.data.designDocs = new Documents.AllDocs(null, {
database: this.data.database,
- params: {startkey: '"_design"',
+ params: {
+ startkey: '"_design"',
endkey: '"_design1"',
--- End diff --
Ok, but why "_design0" or "_design1" or "_e"
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36539801
kxe
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10316575
--- Diff: src/fauxton/app/addons/documents/resources.js ---
@@ -274,20 +338,31 @@ function(app, FauxtonAPI) {
Documents.AllDocs = FauxtonAPI.Collection.extend({
model: Documents.Doc,
+ isAllDocs: true,
documentation: function(){
return "docs";
},
initialize: function(_models, options) {
this.database = options.database;
- this.params = options.params;
- this.skipFirstItem = false;
-
+ this.params = _.clone(options.params);
--- End diff --
NM, I googled. Garren, I can't write proper questions. Sorry
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36538591
kxep
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
Re: [GitHub] couchdb pull request: New pagination
Posted by Simon Metson <si...@cloudant.com>.
I think the right thing to do is have some kind of "expecting more docs? Check your <advanced options>" message if the number of docs is less than the page size, and advanced options are set.
The alternative is removing the limit option, which doesn't solve the problem for other limiting options, or having conditional messaging around the page size.
On Tuesday, 4 March 2014 at 10:55, kxepal wrote:
> Github user kxepal commented on the pull request:
>
> https://github.com/apache/couchdb/pull/162#issuecomment-36612933
> Simon:
> I and @garrensmith just discussed this topic in IRC. TL;DR this is could be correct behaviour for Fauxton, but 1) it's not oblivious 2) 90% users will come to Fuaxton with Futon experience and such behaviour is completely unexpected to them and could be only recognized as a bug.
> If so and it's expected, Fauxton shouldn't provide options to select that doesn't works and it should explicitly declare "why functionality which I have used two minutes ago is missed". If you take a look on screen, you'll didn't notice any page size cap. Only 1) if you open Query Options, but it consumes a lot of visible space to keep it always opened 2) if you take a look on URL, but there could be a lot of parameters and @deathbearbrown going to get rid them from there.
> So, whatever the behavior is, there are problems with it.
>
>
> ---
> If your project is set up for it, you can reply to this email and have your
> reply appear on GitHub as well. If your project does not have this feature
> enabled and wishes so, or if the feature is enabled but not working, please
> contact infrastructure at infrastructure@apache.org or file a JIRA ticket
> with INFRA.
> ---
>
>
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36612933
Simon:
I and @garrensmith just discussed this topic in IRC. TL;DR this is could be correct behaviour for Fauxton, but 1) it's not oblivious 2) 90% users will come to Fuaxton with Futon experience and such behaviour is completely unexpected to them and could be only recognized as a bug.
If so and it's expected, Fauxton shouldn't provide options to select that doesn't works and it should explicitly declare "why functionality which I have used two minutes ago is missed". If you take a look on screen, you'll didn't notice any page size cap. Only 1) if you open Query Options, but it consumes a lot of visible space to keep it always opened 2) if you take a look on URL, but there could be a lot of parameters and @deathbearbrown going to get rid them from there.
So, whatever the behavior is, there are problems with it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36537099
Looks as a lot of work! But could you provide some summary what have changed, what does it improved and...why?(:
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10244737
--- Diff: src/fauxton/app/addons/documents/resources.js ---
@@ -274,20 +338,31 @@ function(app, FauxtonAPI) {
Documents.AllDocs = FauxtonAPI.Collection.extend({
model: Documents.Doc,
+ isAllDocs: true,
documentation: function(){
return "docs";
},
initialize: function(_models, options) {
this.database = options.database;
- this.params = options.params;
- this.skipFirstItem = false;
-
+ this.params = _.clone(options.params);
--- End diff --
I don't quite follow you here, `_.clone` is basically a duplicate?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10316437
--- Diff: src/fauxton/test/mocha/chai.js ---
@@ -27,10 +27,14 @@ function require(path, parent, orig) {
// perform real require()
--- End diff --
haha it's fine. I was just like "wow lotta files changed for pagination"
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith closed the pull request at:
https://github.com/apache/couchdb/pull/162
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
Re: [GitHub] couchdb pull request: New pagination
Posted by Simon Metson <si...@cloudant.com>.
That sounds like the correct behaviour. You've constrained the result set to 20 docs, so a page size >20 isn't going to show more docs. The same would happen if the DB only had 20 docs in.
On Tuesday, 4 March 2014 at 10:16, kxepal wrote:
> Github user kxepal commented on the pull request:
>
> https://github.com/apache/couchdb/pull/162#issuecomment-36609594
> @garrensmith get it 100% reproduce:
> - Navigate to any view
> - Open Query Options
> - Set Limit to lets say 20
> - Query the view
> - Collapse Query Options
> - Try to set page size 5 - ok
> - Try to set page size 20 - ok
> - Try to set page size 30 - it's still will be 20
> - Try to set page size 50 - again
> - Try to set page size 100 - and again
> - Going back to page size 10 - everything is fine
> Sorry, no video: just found that gtk-recordMyDesktop generates broken picture.
>
>
> ---
> If your project is set up for it, you can reply to this email and have your
> reply appear on GitHub as well. If your project does not have this feature
> enabled and wishes so, or if the feature is enabled but not working, please
> contact infrastructure at infrastructure@apache.org or file a JIRA ticket
> with INFRA.
> ---
>
>
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36609594
@garrensmith get it 100% reproduce:
- Navigate to any view
- Open Query Options
- Set Limit to lets say 20
- Query the view
- Collapse Query Options
- Try to set page size 5 - ok
- Try to set page size 20 - ok
- Try to set page size 30 - it's still will be 20
- Try to set page size 50 - again
- Try to set page size 100 - and again
- Going back to page size 10 - everything is fine
Sorry, no video: just found that gtk-recordMyDesktop generates broken picture.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by garrensmith <gi...@git.apache.org>.
Github user garrensmith commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10244755
--- Diff: src/fauxton/app/addons/documents/routes.js ---
@@ -170,9 +168,11 @@ function(app, FauxtonAPI, Documents, Databases) {
this.data.designDocs = new Documents.AllDocs(null, {
database: this.data.database,
- params: {startkey: '"_design"',
+ params: {
+ startkey: '"_design"',
endkey: '"_design1"',
--- End diff --
Correct this is just to get all our design docs for the sidebar. This isn't new code, I just improved the formatting.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36538145
Another moment: when paginates views, Fauxton adds `limit=N` argument to the URL. It's awesome! But if I set `N` as 11, 15, 42, 100500, Fauxton accepts the specified value, but doesn't reflect it in `Per page` select box.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb/pull/162#issuecomment-36537234
Bug: Page sizes 50 and 100 for browsing views doesn't works. Actually, it applies last selected page size or 20.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb pull request: New pagination
Posted by deathbearbrown <gi...@git.apache.org>.
Github user deathbearbrown commented on a diff in the pull request:
https://github.com/apache/couchdb/pull/162#discussion_r10220481
--- Diff: src/fauxton/app/addons/documents/templates/advanced_options_menu.html ---
@@ -0,0 +1,46 @@
+<!--
+Licensed under the Apache License, Version 2.0 (the "License"); you may not
+use this file except in compliance with the License. You may obtain a copy of
+the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+License for the specific language governing permissions and limitations under
+the License.
+-->
+<div class="row-fluid custom-inputs">
+ <div class="controls controls-row">
--- End diff --
Want to start prefixing classes and ids with js- ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---