Skip to content

Paginate admin gallery (12/page, configurable) - #14

Merged
LeeOtts merged 1 commit into
mainfrom
claude/admiring-matsumoto-9fdadb
May 18, 2026
Merged

LeeOtts merged 1 commit into
mainfrom
claude/admiring-matsumoto-9fdadb

Conversation

@LeeOtts

@LeeOtts LeeOtts commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • /gallery was hard-coded to 6 clips; the rest of the on-disk archive was unreachable from the admin UI.
  • The page and /api/clips/list now accept ?page= and ?per_page= (default 12, capped at 60) and return total / total_pages metadata.
  • The template adds a Showing N–M of T counter 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 — clean
  • Jinja2 template loads (get_template('gallery.html')) — clean
  • Flask test client: /gallery, /gallery?page=2, /gallery?per_page=24 all return 200
  • /api/clips/list returns {clips, page, per_page, total, total_pages}
  • per_page=10000 clamps to 60; per_page=-5 clamps to 1; per_page=abc falls back to 12; page=-1 clamps to 1
  • Smoke-run on the Pi with real clips: verify Prev/Next, counter text, and polling-on-page-2 stays on page 2

🤖 Generated with Claude Code

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).
@LeeOtts
LeeOtts merged commit b233995 into main May 18, 2026
6 checks passed
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.

1 participant