feat(dashboard): the targets page pages server-side with page size and total #541

Merged
sharang merged 1 commits from feat/targets-pagination into main 2026-10-09 13:18:21 +00:00
Owner

A stage tester asked for paging on the Prüfobjekte page: the list gets long with many targets.

What changes

  • Agent GET /api/v1/targets: already took page/limit (clamped via PaginationParams, max 200) and ?project=, and returned total for the filtered selection. It had no sort, so pages over Mongo's natural order were not stable; it now sorts by _id (creation order, what the list showed before) before skip/limit.
  • Dashboard infra: new fetch_targets_page(project, page, limit). fetch_targets() now reads every page (200 per request, capped at 500 pages). Before this, every "all targets" caller (overview, findings/SBOM target filters, graph, chat, pentest wizard) silently got only the agent's default first 50.
  • Targets page: pager under the table, page size select (20/50/100), target count ("12 Prüfobjekte"). Changing the project filter or page size goes back to page 1. A page past the end (targets deleted) moves to the last page.
  • Pagination component: Previous/Next/"Page x of y" now come from i18n (DE/EN), so the findings, SBOM and issues pages get German too.
  • MCP reads Mongo directly and is unaffected.

Tests

  • api::handlers::onboarding::filter_tests::the_list_pages_in_a_total_order_with_the_filter_beside_it
  • integration (Mongo) integration::api::onboarding::the_list_pages_with_a_total_after_the_project_filter: 3 targets, pages of 2, project filter applied before paging with its own total, page past the end empty with total
  • dashboard: reading_every_target_stops_at_a_short_page_or_the_total, the_pages_cover_every_target_and_there_is_always_one, the_pager_reads_like_the_language, the_target_count_reads_like_the_language
  • clippy (agent, dashboard server + web), fmt

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

A stage tester asked for paging on the Prüfobjekte page: the list gets long with many targets. ## What changes - **Agent** `GET /api/v1/targets`: already took `page`/`limit` (clamped via `PaginationParams`, max 200) and `?project=`, and returned `total` for the filtered selection. It had no sort, so pages over Mongo's natural order were not stable; it now sorts by `_id` (creation order, what the list showed before) before skip/limit. - **Dashboard infra**: new `fetch_targets_page(project, page, limit)`. `fetch_targets()` now reads every page (200 per request, capped at 500 pages). Before this, every "all targets" caller (overview, findings/SBOM target filters, graph, chat, pentest wizard) silently got only the agent's default first 50. - **Targets page**: pager under the table, page size select (20/50/100), target count ("12 Prüfobjekte"). Changing the project filter or page size goes back to page 1. A page past the end (targets deleted) moves to the last page. - **Pagination component**: Previous/Next/"Page x of y" now come from i18n (DE/EN), so the findings, SBOM and issues pages get German too. - MCP reads Mongo directly and is unaffected. ## Tests - `api::handlers::onboarding::filter_tests::the_list_pages_in_a_total_order_with_the_filter_beside_it` - integration (Mongo) `integration::api::onboarding::the_list_pages_with_a_total_after_the_project_filter`: 3 targets, pages of 2, project filter applied before paging with its own total, page past the end empty with total - dashboard: `reading_every_target_stops_at_a_short_page_or_the_total`, `the_pages_cover_every_target_and_there_is_always_one`, `the_pager_reads_like_the_language`, `the_target_count_reads_like_the_language` - clippy (agent, dashboard server + web), fmt 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-09 13:06:39 +00:00
feat(dashboard): the targets page pages server-side with page size and total
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 11m4s
ee22e6789a
The targets list loaded one unpaged request; with many targets it grew
long, and every caller silently saw only the agent's default first 50.

- Agent: GET /api/v1/targets sorts by _id (creation order) before
  skip/limit, so pages are stable; page/limit (clamped by
  PaginationParams) and the project filter were already applied, total
  counts the filtered selection.
- Dashboard: fetch_targets_page(project, page, limit) for the targets
  page; fetch_targets() now reads every page (200 each, capped), so the
  overview, findings, SBOM, graph, chat and pentest-wizard pickers get
  all targets instead of the first 50.
- Targets page: pager, page size (20/50/100), target count; changing
  the project or page size goes back to page 1; a page past the end
  moves to the last one.
- Pagination component reads German/English from i18n (also on the
  findings, SBOM and issues pages).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit 69a4c2084a into main 2026-10-09 13:18:21 +00:00
Sign in to join this conversation.