Commit d01afe8
Add pagination to admin source list pages (#103)
* Add pagination to admin source list pages
- Add pagination controls (Prev/Next) to all admin source list pages
- Show 20 sources per page with "Showing X-Y of Z sources" info
- Pagination appears at both top and bottom of long lists
- Controls only appear when there's more than one page
- Works for Active, Disabled, Needs Configuration, and Robots Blocked pages
- Uses HTMX for seamless page navigation without full page reload
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix pagination in mutation endpoints and template page size
Code review fixes:
- Create _get_paginated_sources() helper to share pagination logic
- Update mutation endpoints (delete, toggle, mark-disabled, recheck-robots,
create) to return paginated results instead of unpaginated lists
- Replace hard-coded page size (20) in template with page_size variable
- Add page_size to all GET list endpoint responses
This ensures pagination controls persist after actions like delete/toggle,
and the template will automatically reflect any changes to SOURCES_PER_PAGE.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix pagination edge cases and consolidate GET list endpoints
Address code review feedback on PR #103:
- Thread current page from HX-Current-URL header through mutation
endpoints (delete, toggle, mark-disabled, recheck-robots) so users
don't lose their place after actions
- Refactor all four GET list endpoints to use _get_paginated_sources
helper, ensuring consistent page clamping to prevent invalid ranges
like "Showing 21-10 of 10"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix pagination: pass current page via hx-vals instead of HX-Current-URL
The HX-Current-URL header contains the browser URL (e.g., /admin) which
never has a page param since pagination doesn't push to browser URL.
Fix by:
- Adding hx-vals='{"page": "{{ page }}"}' to all mutation buttons
(recheck-robots, delete, mark-disabled, toggle)
- Update _get_current_page_from_request to read from query params
(DELETE) or form data (POST) where htmx sends hx-vals
- Make mutation endpoints async to await form parsing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Docs: Add admin source list pagination to status
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 0c33989 commit d01afe8
File tree
3 files changed
+198
-99
lines changed- backend/app
- routers
- templates/admin/partials
3 files changed
+198
-99
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
924 | 924 | | |
925 | 925 | | |
926 | 926 | | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
927 | 944 | | |
928 | 945 | | |
929 | 946 | | |
| |||
0 commit comments