Closed rix0rrr closed 1 month ago
@jpelay @Annelein @hasan-sh I could use some help with rolling this new feature out wherever it makes sense.
Will review and push more support for previous buttons
@hasan-sh I think this one is good to go!
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).
This adds the feature to also go backwards in the result set to DynamoDB queries.
The same way there was a
results.next_page_token
before that you could pass in to get the next page of results, this adds aresults.prev_page_token
. If theprev_page_token
is set, pass the token into the exact same query operation to return the previous page of results.I've added a demonstration to the Admin "all users" page; I don't know where else "previous page" buttons should be added.
In addition, this adds a
get_page()
function which can be used for paginated result pages that need additional filtering. Filtering can be done on the server side (passing aserver_side_filter
) and on the client side (passing aclient_side_filter
). Theget_page()
function will repeatedly do server queries until it has filled up a page of the requestedlimit
items (or until a timeout is hit), and make sure thenext_page_token
andprev_page_token
values are set correctly.get_page
should probably replaceQueryIterator
-based solutions --get_page
is easier to use.@jpelay @Annelein @hasan-sh I could use some help with rolling this new feature out wherever it makes sense.
How to test
Go to the Admin page, click on "User overview", click "Next page". A "Previous page" button appears at the bottom of the screen, clicking it gets you back to the first page.