Add Alerts webapp UI (ticket 020)

New Alerts panel: lists rules with condition summaries and an enabled
toggle, and a condition-type-specific editor (Immediate/Threshold/NewValue/
Ratio) with client-side validation before save, reusing FilterBar's query
input styling for query-based conditions. Adds a test-notification endpoint
(POST /api/settings/alerts/test) so an ntfy topic/server can be verified
without saving a rule first, plus a docs section and help icons matching
ticket 021's pattern.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
This commit is contained in:
Hugh Kaznowski
2026-09-05 16:34:14 +01:00
co-authored by Claude Sonnet 5
parent dd3320812c
commit 7bf323dd50
8 changed files with 644 additions and 44 deletions
-41
View File
@@ -1,41 +0,0 @@
# 020 — Alerts webapp UI
## Summary
A webapp page for managing `AlertRule`s ([017](017-ntfy-alerts.md)) end to
end: create/edit/enable/delete rules and configure their ntfy sink, without
touching `settings.json` by hand.
## Scope
- A new route/panel (matching how `Dashboards`/`Metrics` are already surfaced
in `App.tsx`) listing existing alert rules: name, condition summary,
enabled state.
- A rule editor:
- Condition type picker (Immediate / Threshold / New value / Ratio, see
[018](018-alert-trigger-evaluation.md)) with type-specific fields, reusing
`FilterBar`'s query input for the query-based conditions rather than a
separate text field.
- Ntfy sink fields: topic and optional server override.
- Enabled toggle.
- "Send test notification" button wired to the sink delivery endpoint from
[019](019-ntfy-sink-delivery.md), so a topic/server can be verified without
waiting for a real trigger.
- Contextual "?" help icons on the condition-type picker and sink fields,
matching [021](021-docs-contextual-help.md)'s pattern.
## Acceptance criteria
- Rules created/edited/deleted in the UI persist across a page reload (i.e.
round-trip through the CRUD endpoints from 017).
- Each condition type's fields validate before save (e.g. Ratio requires two
queries and a threshold).
- "Send test notification" delivers to the currently-entered topic/server
without requiring the rule to be saved first.
## Depends on
- [017 — Alert definitions & settings persistence](017-ntfy-alerts.md)
- [018 — Alert trigger evaluation](018-alert-trigger-evaluation.md)
- [019 — Ntfy sink delivery](019-ntfy-sink-delivery.md)
- [021 — Docs contextual help](021-docs-contextual-help.md)