Skip to main content

Reports

Generate and download water-data reports. Pick a report, configure the date / interval / units / format, then download (PDF or Excel) or preview it. The report itself is rendered by the server — the frontend only builds a URL.

  • Route: /reportsReportsV2Page + subpages (libs/reportsV2/)
  • Sidebar gate: DISABLE_REPORTS permission (individual report types are gated per-service — see Access)
  • Library: libs/reportsV2/ (current) — the route has no wrapper guard

Which reports library is which

LibraryStatusWhere it runsWhat it is
reportsV2Currentproduction + demo, /reportsRouted multi-page generator (this page)
reportsStandalone appsrwi, uwms, lakepulse, /reportsOlder single-page tabbed generator (same backend)
legacyReportsDeadNowhereEmpty scaffolding — referenced by nothing

Both live libraries hit the same backend GET {baseUrl}/report; reportsV2 is a routed-UI rewrite of the standalone reports page.


Three ways in

Summary: The landing chooser offers frequent presets, executive reports, or a wizard. All three end by building a /report URL that the server renders as PDF/Excel (download) or HTML (iframe preview).

PathSubpageWhat it doesOn click
/reportsReportMainSelectionPageThe chooser (frequent cards, executive cards, "Create new")A card prefills params and routes to its page
/reports/frequent_reports/:reportIdFrequentReportsA preset report with 5 inline-editable fieldsEdit a field inline; Download
/reports/summary_reportSummaryReportPageDaily / Weekly / Monthly summary (PDF only)Pick range; Download
/reports/water_balanceWaterBalanceReportPageDaily / Monthly water-balance reportPick range + format; Download
/reports/new_reportNewReportPageThe 4-step wizard (below)Continue through steps; Download

The new-report wizard

Four steps (NewReportPage), with a breadcrumb of chosen values:

  1. Report Type — Flowmeter / Stock / GW Level / Quality / Rain Water / Energy (filtered by your services).
  2. Time & Date — interval (5 min / hour / day / month) + single or multiple date(s).
  3. Categories & Units — searchable unit picker (Rain Water auto-selects all and skips this step).
  4. Format & Export — Excel / PDF, with a live preview.

Each Continue validates that step's fields before advancing.


The one endpoint

Everything funnels into a single URL built client-side and opened in the browser (there is no apiClient call):

GET {baseUrl}/report?useShift=true&reportType=…&reportFormat=…&service=…
&jwt=<token>&startDate=…&format=v2[&endDate&unitIds&startTime&endTime]
  • reportFormat drives the behaviour, same endpoint: pdf / xlsxdownload (window.open); htmlpreview (loaded in an <iframe>).
  • Units come from your loginResponse in local storage (services → subCategories → units), not an API.
JWT in the URL

Because the report is fetched by window.open / an iframe (not apiClient), the token is passed as a jwt query parameter — it lands in browser history. Flag if you touch this.


Access & gating

LayerRule
/reports routeUnguarded (no PermissionWrapper)
Sidebar entryGated by the DISABLE_REPORTS permission
Report typesShown only if your services include that category
Rain WaterRequires RWI; Summary requires DAILY_SUMMARY; Water Balance card requires WATER_BALANCE

The standalone reports lib (rwi/uwms/lakepulse) instead gates on NOT_GENERAL_REPORT / EXECUTIVE_SUMMARY_REPORT — keys reportsV2 doesn't use.


Edge cases & guards

CaseHandling
ValidationMissing fields block the download ("Please fill in: …")
Rain WaterAuto-selects all units and skips the Units step
Unit soft-limit> 5 units shows a "will take longer" warning (non-blocking)
Preview stalenessChanging params after a preview shows a "Refresh Preview" button
Date limitsInterval-specific maxDateRange (5 min → 6 days, daily → 30, monthly → 12)
Server errorsSurface inside the downloaded file / iframe (no client-side error UI)

Underlying libraries

reportsV2 pulls in no client-side charting, PDF, or Excel library — rendering is entirely server-side.

PurposeLibrary
Date pickerAppDatePickerSelection
Datesmoment
UI@mui/material (MUI 7), @iconify/react
Exportthe browser (window.open / <iframe>)

Code reference

FileRole
ReportsV2Page.jsxLayout shell + <Outlet /> + provider
store/reportStore.jsxParams + buildReportUrl
helper/reportHelper.jsReport types, intervals, validation, gating
subpages/ReportMainSelectionPage.jsxThe chooser
subpages/NewReportPage.jsx · NewReportStepContents.jsxThe 4-step wizard
subpages/{WaterBalance,Summary,Frequent}*.jsxThe dedicated report pages
components/Report*Selector.jsx · ReportPreviewComponent.jsxField selectors + iframe preview