Skip to content

feat(webserver): admin accounts with all-provider map and archive overrview - #65

Merged
cchwala merged 9 commits into
mainfrom
feat/admin-view
Oct 21, 2026
Merged

cchwala merged 9 commits into
mainfrom
feat/admin-view

Conversation

@cchwala

@cchwala cchwala commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Admin view: all-providers map, archive overview and Grafana panel

Adds an optional admins: list to users.yml for web-login accounts that see data from all providers.

What's new

  • /admin/realtime: Leaflet map of every CML across providers, with a Grafana RSL time series below it. Clicking a link selects that provider and CML in the panel.
    • "Color by" dropdown: RSL Std Dev (1h, default), Last RSL, Completeness (6h) or Provider. These use the same scales as the tenant real-time page. CMLs without data are grey, and stats refresh every 30 s.
    • Per-provider toggles in a scrollable legend, with a draggable chart height.
  • /admin/archive: per-provider summary and daily record-count / mean-RSL plots.
  • API (admin-only): /api/admin/cml-map, /api/admin/cml-stats, /api/admin/archive-timeseries. They are guarded by @admin_required and use a read-only webserver_role connection; tenants get 403.
  • Grafana: admins share one extra org with a webserver_role datasource and the dashboard in grafana/admin_dashboards/ (cml-admin-realtime). init_grafana.py creates it only when admins: is set; scripts/generate_config.py writes the admin org and users.
  • CI: the e2e workflow shares the NetCDF env across steps and runs the tests with --no-deps, so services are no longer recreated and the DB is no longer empty.

Notes

  • No DB migration is needed.
  • Don't use admin as an admin id. Auth-proxy logins map to Grafana users by name, so it would hit Grafana's built-in admin account (documented in the README).
  • The webserver_role dev password is hardcoded in init_grafana.py, like the tenant passwords there.
  • To try it: uncomment admins: in users.yml, run python scripts/generate_config.py, run python scripts/set_password.py <id>, then rebuild webserver and re-run init_grafana.

Tests

  • Added unit tests for the admin routes and APIs, and for the generator's admin Grafana org handling.
  • Tested locally against the Docker stack, including a query through the admin datasource that returned data from both providers.

…rview

Add an optional 'admins:' list to users.yml. Admin accounts are written to
users.json with is_admin=true (no DB role, parser or SFTP account) and get
/admin/realtime (all CMLs, coloured per provider) and /admin/archive
(per-provider summary and daily time series). Cross-tenant queries run as
webserver_role in a read-only session behind @admin_required.
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.10345% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.78%. Comparing base (6a41596) to head (099032b).

Files with missing lines Patch % Lines
webserver/main.py 86.72% 15 Missing ⚠️
scripts/generate_config.py 98.27% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #65      +/-   ##
==========================================
+ Coverage   85.37%   85.78%   +0.40%     
==========================================
  Files          41       41              
  Lines        3692     3911     +219     
==========================================
+ Hits         3152     3355     +203     
- Misses        540      556      +16     
Flag Coverage Δ
mno_simulator 86.12% <ø> (ø)
parser 90.14% <ø> (ø)
scripts 79.67% <99.15%> (+5.46%) ⬆️
webserver 77.13% <86.72%> (+1.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cchwala
cchwala merged commit ae41b24 into main Oct 21, 2026
8 checks passed
@cchwala
cchwala deleted the feat/admin-view branch October 21, 2026 17:41
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