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

fix: show pagination warning on all pages (fixes #11968) #11973

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

Sebast1aan
Copy link
Contributor

When limiting the number of visible records in the workflow page, the pagination warning is now shown on all pages (not depending on the number of records on that page).

Fixes #11968

Signed-off-by: Sebast1aan <sebastiaan.lamproye@gmail.com>
@Sebast1aan Sebast1aan marked this pull request as ready for review October 10, 2023 06:59
@terrytangyuan terrytangyuan merged commit 7576abc into argoproj:master Oct 10, 2023
25 checks passed
Copy link
Contributor

@agilgur5 agilgur5 left a comment

Choose a reason for hiding this comment

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

there's a flaw in this logic -- see below. @Sebast1aan can you raise a follow-up PR for an additional fix? EDIT: I fixed this myself in #11979

@@ -19,7 +19,7 @@ export function PaginationPanel(props: {pagination: Pagination; onChange: (pagin
}>
Next page <i className='fa fa-chevron-right' />
</button>
{props.pagination.limit > 0 && props.pagination.limit <= props.numRecords ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm so there's a reason this logic was here -- if you're on the first page and you only have 10 total workflows while paginating 50 workflows, this warning shouldn't show. You're already listing all of them.

This new logic is actually causing a bug now, see this screenshot where I have only 10 total workflows and paginate on 50 -- it shows the warning, but it shouldn't:
Screenshot 2023-10-10 at 2 01 08 PM

Previously it didn't show this warning.

Here's the PaginationPanel's props from the React debugger:
Screenshot 2023-10-10 at 2 05 21 PM

this actually needs some more nuanced logic to show up on a page that isn't first but not on the first page when there's enough records:

Suggested change
{props.pagination.limit > 0 && props.pagination.limit <= props.numRecords ? (
{/* if pagination is used, and we're either not on the first page, or are on the first page and have more records than the page limit */}
{props.pagination.limit > 0 && (props.pagination.offset || (!props.pagination.offset && props.numRecords >= props.pagination.limit)) ? (

This works correctly on the previous example and should handle your scenario of the last page as well:
Screenshot 2023-10-10 at 2 28 04 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed in #11979

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, missed that specific case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG UI: pagination warning is not always shown on last page of workflows
3 participants