Skip to content

[T-113b] Report export UI: request report job, poll status, open/print; /reports/:id route #183

Closed

Description

@CodewithJha

Task T-113b · Milestone M8 — Dashboard · Size S · Priority P1 · Epic #8

Implements FR-DSH-007

Branch feat/t-113b-report-export-ui-request-report — one task = one branch = one PR (doc 32 §6)

Summary

Implement features/reports/: 'Export report' buttons on console and comparison (POST /reports → poll job → open), and the /reports/:id route embedding the server-rendered HTML in a sandboxed iframe with a print action.

Context / motivation

FR-DSH-007: shareable offline reports.

Scope

In scope

  • sandbox iframe attributes; no script execution from report HTML.

Implementation guidance

  • features/reports/useReportJob.ts: POST /reports {kind, id} → poll GET /reports/{id} with a configurable interval (runtime config, default 1.5 s) and backoff until done|error.
  • ExportReportButton is placed in the console header and the comparison page through a slot prop (one-line change in those features).
  • /reports/:id route: ReportPage with <iframe sandbox="allow-same-origin" src={contentUrl}> (no allow-scripts), a Print button calling iframe.contentWindow.print(), and a Download link.
  • Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff PLR2004); public APIs typed (mypy strict) and documented.

Acceptance criteria

  • Job lifecycle (queued → done/error) handled.
  • Print uses report print CSS.
  • Polling stops on unmount.
  • The iframe has no allow-scripts (test).
  • Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
  • Docs, config reference and CHANGELOG Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • features/reports/*.test.tsx.

Dependencies

Blocked by: #165 (T-085d), #157 (T-084a)

Blocks: #187 (T-118)

Parallelization notes

Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:

  • web/src/features/reports/**

Independent folder.

Definition of Done

Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-113b (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.

References

Design docs: doc 13 §3.9 · doc 12 §2

Requirements: FR-DSH-007 (traceability: doc 28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions