feat(admin): paginate /projects; dashboard loads recent, not the whole fleet - #34
Open
sanketsahu wants to merge 1 commit into
Open
feat(admin): paginate /projects; dashboard loads recent, not the whole fleet#34sanketsahu wants to merge 1 commit into
sanketsahu wants to merge 1 commit into
Conversation
… 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>
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.
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 myGET /v1/projectspolls were timing out). This scopes each page to what it actually shows.API —
GET /v1/projectsq(id/name substring),sort=recent,offset,limit. Pre-pagination total returned inX-Total-Count(exposed via CORS).listProjects) is unchanged.sort=recentreuses the LRU clock (last_active_at, falling back tocreated_at).Admin
/v1/metricssnapshot; 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
TestListProjectsPaginationSortFiltercovers no-params (all + total),sort=recent+limit/offsetordering, andqfiltering with the total header. Admintsc+ lint clean.🤖 Generated with Claude Code