-
Notifications
You must be signed in to change notification settings - Fork 7
Add traditional pagination to both admin bridges #61
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
Add traditional pagination to both admin bridges #61
Conversation
- Add server-side pagination to OriginalStorage - Add Config options for per_page and infinite_scroll - Implement infinite scroll with Intersection Observer - Add lazy loading for images - Update MediaAdminController for paginated listings - Add comprehensive test coverage
446bd52 to
7d4bb38
Compare
|
Hi @ahmed-bhs Thanks a lot for this first contribution that relates to #52 👍 While I appreciate it a lot, may I ask for some changes?
Thanks again! |
- Add trailing comma to function parameters - Reorder imports alphabetically - Move private methods to end of class - Remove unused imports
f80dc0a to
479685c
Compare
- Add Media type hints to array properties and parameters - Fix missing iterable value type specifications - Ensures PHPStan level compliance
6e1b23f to
348adcc
Compare
|
Hi @xavierlacot , nice to meet you and thanks for taking the time to review! I originally developed this feature for my own needs and thought it would be nice to share it as a pull request rather than keep it private. Don't worry at all about the code removal. I completely understand your point about maintaining UX consistency with the native admin frameworks. It makes total sense! All requested changes are done. Still unsure about using EasyAdmin and Sonata’s native pagination—this part need to be reviewed. |
f64b084 to
dcd1e91
Compare
| default => 'explore', | ||
| }; | ||
|
|
||
| $page = max(1, (int) $request->query->get('page', '1')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
->getInt() could be used here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @BriceFab tank you
5458f6f to
3520642
Compare
3520642 to
9d92777
Compare
…n Sonata Admin values. Also, do not allow invalid page numbers
|
Thanks for the hard work @ahmed-bhs 🎉 |
Summary
This PR adds traditional pagination to both EasyAdmin and Sonata Admin bridges, addressing performance issues when browsing large media libraries. Previously, all media items
were loaded at once, causing slow page loads and high memory usage with libraries containing hundreds or thousands of files.
This implementation uses native pagination components from each framework to ensure a consistent UX that follows admin interface conventions.
Changes
EasyAdmin Bridge:
MediaPaginatoradapter compatible with EasyAdmin's pagination system@EasyAdmin/crud/paginator.html.twigtemplateSonata Admin Bridge:
MediaPagerimplementing Sonata'sPagerInterfaceCommon:
pagination.per_page(default: 50)Configuration Example