Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replication paginate #1075

Closed
wants to merge 6 commits into from
Closed

Replication paginate #1075

wants to merge 6 commits into from

Conversation

garrensmith
Copy link
Member

@garrensmith garrensmith commented Apr 25, 2018

Overview

This adds the ability to paginate through your replications in the replication tab. I've only added pagination to the Replication DB's tab since I can't think of a way of replicating through the _replicate replications. The _replicate replication uses the /jobs endpoint which is a mixture of replication DB and _replicate results.

Testing recommendations

Create a few replications and then paginate.

GitHub issue number

#1022

@@ -343,3 +343,10 @@ td.replication__empty-row {
.replication__activity-caveat {
padding-left: 80px;
}

.replication__paginate-footer {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use BEM here? Styling would be easier to read and class names would be the same.

Copy link
Contributor

@Antonio-Maranhao Antonio-Maranhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get an error after creating a new rep and after deleting one. It seems to be because getReplicationActivity() is not receiving the pagination params when called inside replicate() and deleteDocs(). Lines 83 and 233 of actions.js

return supportNewApi()
.then(newApi => {
const docsPromise = get('/_replicator/_all_docs?include_docs=true&limit=100')
const docsPromise = get(`/_replicator/_all_docs?startkey=%22_designZ%22&${app.utils.queryParams(params)}`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I know what is this suppose to do? When I run locally your branch, I don't have anything in my replicator activity and I suspect this line to the be the cause.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fetches all the docs in the replicator db except the design doc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @popojargo - because of the startkey param, the query won't return any docs whose ID starts with a number or uppercased letter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only viable solution I see is splitting the request in two API calls. One to fetch documents before the _design (?endkey="_design*") and another one to fetch documents after design docs (startkey="_designZ"

@popojargo
Copy link
Member

@garrensmith Do you plan on finishing this or do you want someone else to complete the work?

@garrensmith
Copy link
Member Author

@popojargo I'm happy to close this. I won't be able to work on it further and I know @Antonio-Maranhao had some reservations around it.

@wohali
Copy link
Member

wohali commented May 13, 2020

Hi @garrensmith @popojargo @Antonio-Maranhao ,

Just ran into this one. Any chance this PR can be freshened and merged for a new release of Fauxton?

@popojargo
Copy link
Member

I'll keep that in mine but my schedule is overloaded atm

@Antonio-Maranhao
Copy link
Contributor

Same for me, unfortunately. IIRC, it still requires reworking how the docs are retrieved because /_replicator/_all_docs?startkey=%22_designZ%22 doesn't return any docs that start with lowercase or digits.
@popojargo suggested above using two API calls but that will likely make it harder to paginate correctly.
@garrensmith suggested using a Mango query instead. That's probably the best approach. Something like this would do:

{
   "selector": {
      "$or": [
         {
            "_id": {
               "$lt": "_design"
            }
         },
         {
            "_id": {
               "$gt": "_design0"
            }
         }
      ]
   }
}

@garrensmith
Copy link
Member Author

I don't remember suggesting a mango query but that does sound like the best option. Mango indexes automatically do not include _design docs so you can just do:

_id: {"$gte: null}

@wohali
Copy link
Member

wohali commented Oct 30, 2020

Closing in favour of #1288 . If I have misunderstood, please re-open.

@wohali wohali closed this Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants