Paginate admin gallery (12/page, configurable) - #14
Merged
Merged
Conversation
The /gallery page hard-coded a 6-clip view, so most stored clips were unreachable from the admin UI. The gallery and /api/clips/list endpoint now accept ?page= and ?per_page= and return total/total_pages metadata. The template renders a Showing N-M of T counter and Prev/Next controls; polling preserves the current page and jumps back to page 1 only if the current page empties out (e.g. after deleting the last clip on it).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/gallerywas hard-coded to 6 clips; the rest of the on-disk archive was unreachable from the admin UI./api/clips/listnow accept?page=and?per_page=(default 12, capped at 60) and returntotal/total_pagesmetadata.Showing N–M of Tcounter and Prev/Next controls; polling keeps the user on their current page and only redirects to page 1 if the page empties out (e.g. last clip on it was deleted).Test plan
python -m py_compile web/dashboard.py— cleanget_template('gallery.html')) — clean/gallery,/gallery?page=2,/gallery?per_page=24all return 200/api/clips/listreturns{clips, page, per_page, total, total_pages}per_page=10000clamps to 60;per_page=-5clamps to 1;per_page=abcfalls back to 12;page=-1clamps to 1🤖 Generated with Claude Code