Skip to content

feat(admin): paginate /projects; dashboard loads recent, not the whole fleet - #34

Open
sanketsahu wants to merge 1 commit into
mainfrom
feat/admin-projects-pagination
Open

feat(admin): paginate /projects; dashboard loads recent, not the whole fleet#34
sanketsahu wants to merge 1 commit into
mainfrom
feat/admin-projects-pagination

Conversation

@sanketsahu

Copy link
Copy Markdown
Contributor

Why

With ~2,300 projects, the admin pulled every project (with full workload details) every 5 s — on both the dashboard root and /projects. That's the slowness you saw (and why my GET /v1/projects polls were timing out). This scopes each page to what it actually shows.

API — GET /v1/projects

  • Optional q (id/name substring), sort=recent, offset, limit. Pre-pagination total returned in X-Total-Count (exposed via CORS).
  • No params still returns everything — the website's orphan-scan (listProjects) is unchanged.
  • sort=recent reuses the LRU clock (last_active_at, falling back to created_at).

Admin

  • Dashboard: counts come from the lightweight /v1/metrics snapshot; the "Recent projects" card fetches only the 6 most-recently-active. No more whole-fleet pull on the root page.
  • /projects: route-based pagination + search (?page=&q=) — server-paginated 20/page, most-recent-first. Pages are shareable, the back button works, and search is debounced into the URL.

Test

TestListProjectsPaginationSortFilter covers no-params (all + total), sort=recent + limit/offset ordering, and q filtering with the total header. Admin tsc + lint clean.

🤖 Generated with Claude Code

… fleet

With thousands of projects, the admin pulled every project (with full workload
details) on the dashboard AND /projects, every 5s. This scopes both to what they
show.

API (GET /v1/projects):
- Optional q / sort=recent / offset / limit params; pre-pagination total in the
  X-Total-Count header (exposed via CORS). No params still returns everything, so
  the orphan-scan path is unchanged. "recent" sorts by the LRU clock (last-active,
  falling back to created).

Admin:
- Dashboard counts now come from /v1/metrics (lightweight snapshot); the "Recent
  projects" list fetches only the 6 most-recently-active. No more whole-fleet pull.
- /projects: route-based pagination + search (?page=&q=), server-paginated 20/page,
  sorted most-recent-first. Pages are shareable and the back button works. Search is
  debounced into the URL.

Tests: listProjects pagination/sort/filter/X-Total-Count.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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