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

Pages: Sorting and Pagination #96

Merged
merged 17 commits into from
Jan 26, 2024
Merged

Pages: Sorting and Pagination #96

merged 17 commits into from
Jan 26, 2024

Conversation

ChristianTovar
Copy link
Collaborator

@ChristianTovar ChristianTovar commented Dec 7, 2023

Description

  • Sort by title, path
  • Paginate by page, 20 records by page
  • Use query params to preserve state as ?query=FOO&page=INT&sort=NAME
  • Searching should reset pagination to page 1 and preserve sort query param and current state
  • Paginating should preserve search query and sort params and their current state
  • Navigation component

Issue

This PR tackles #87

Screenshots

image

Pagination Component Demo

Screen.Recording.2023-12-07.at.1.20.25.PM.mov

@ChristianTovar ChristianTovar self-assigned this Dec 7, 2023
@AZholtkevych AZholtkevych linked an issue Dec 15, 2023 that may be closed by this pull request
@ChristianTovar ChristianTovar changed the title [WIP] Pages: Sorting and Pagination Pages: Sorting and Pagination Jan 12, 2024
@ChristianTovar ChristianTovar marked this pull request as ready for review January 12, 2024 20:16
@leandrocp
Copy link
Contributor

Hey @ChristianTovar it's looking good. Just found a small bug.

When there are no pages, it displays the following:

Screenshot 2024-01-19 at 1 34 13 PM

Clicking on the 0 crashes with:

%Postgrex.Error{message: nil, postgres: %{code: :invalid_row_count_in_result_offset_clause, line: "374", message: "OFFSET must not be negative", ...}

@ChristianTovar
Copy link
Collaborator Author

@leandrocp I've fixed the error for when there are no pages at all, we won't render the pagination component nor the upper sorting element. We still have some tests that are complaining about some code that is currently on beacon core for counting pages, how do we use the latest up-to-date beacon core stuff in tests for this particular case?

@leandrocp
Copy link
Contributor

leandrocp commented Jan 26, 2024

@leandrocp I've fixed the error for when there are no pages at all, we won't render the pagination component nor the upper sorting element.

👍🏻

We still have some tests that are complaining about some code that is currently on beacon core for counting pages, how do we use the latest up-to-date beacon core stuff in tests for this particular case?

You can just update the dependency: mix deps.update beacon - there's no blockers for doing so, actually beacon_live_admin should keep the beacon dep as fresh as possible

Copy link
Contributor

@leandrocp leandrocp left a comment

Choose a reason for hiding this comment

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


Feel free to merge it thanks!

@ChristianTovar ChristianTovar merged commit e27e5b3 into main Jan 26, 2024
3 checks passed
@ChristianTovar ChristianTovar deleted the ct/pages-pagination branch January 26, 2024 20:00
leandrocp added a commit that referenced this pull request Feb 2, 2024
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.

Pages: Sorting and Pagination
2 participants