Skip to content

fix: ReportsPage read scans list from results key - #389

Open
rathnakaragn wants to merge 1 commit into
mainfrom
fix/reports-page-scans-list
Open

fix: ReportsPage read scans list from results key#389
rathnakaragn wants to merge 1 commit into
mainfrom
fix/reports-page-scans-list

Conversation

@rathnakaragn

Copy link
Copy Markdown
Contributor

Problem

The Reports page (/reports) always showed "No completed scans to report on" even when completed scans existed. GET /api/scans/ returned them correctly, but the page never rendered any row — so CSV/PDF export was unreachable from the Reports page entirely.

Cause

ReportsPage.jsx read the paginated scans response as data?.scans, but the /api/scans/ envelope keys the list under results ({results, total, page, total_pages, ...}). ScansPage.jsx already reads data?.results — Reports was simply reading the wrong key, so scans was always [].

Fix

- const scans = data?.scans ?? [];
+ const scans = data?.results ?? [];

Verification

Reproduced against a completed scan and verified end-to-end in the browser after the fix:

  • Reports page lists the completed scan (domain · Completed · findings count · date).
  • CSV export → GET /reports/<uuid>/csv/ → HTTP 200 (content verified).
  • PDF export → GET /reports/<uuid>/pdf/ → HTTP 200, valid PDF downloaded.

Notes

  • One-line source fix; the built bundle (frontend/dist/) is gitignored and rebuilt by CI/Docker, so nothing else to commit.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WRGejrw65nttnhupK7A7wv

The Reports page listed nothing for completed scans because it read the
paginated scans response as data.scans, but the /api/scans/ envelope uses
'results' (as ScansPage already does). Read data.results so completed scans
appear and CSV/PDF export is reachable from the Reports page.
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