Add Params declaration UI (ticket 034)

New Params panel (Log viewer / Params / Metrics / Dashboards) declares a
bare param via POST /api/params, mirroring Metrics' declare-then-list
pattern including inline 400 error surfacing. Lifted the params list from
LogPreview's own effect into App.tsx so declaring a param there updates
the Columns picker immediately, without a page reload.

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:43:53 +01:00
co-authored by Claude Sonnet 5
parent 41c9a3660b
commit dd1a0a234d
6 changed files with 147 additions and 68 deletions
-41
View File
@@ -1,41 +0,0 @@
# 034 — Params declaration UI
## Summary
`POST /api/params` (ticket 004) already lets a param be declared — name,
`message_match_regex`, `capture_group`, `kind` — and `GET /api/params`
(`fetchParams`, `webapp/src/lib/api.ts:245`) already feeds LogPreview's
"Columns" picker (`webapp/src/components/LogPreview.tsx:63`) so a declared
param can be shown as a log table column. But nothing in the webapp can
*create* one — the only way to declare a param today is a raw `POST
/api/params` call. Add a UI for it, following the same declare-then-list
pattern `Metrics` already uses for `POST /api/metrics`
(`webapp/src/components/Metrics.tsx`).
## Scope
- A "Params" section in the primary UI (alongside Log viewer / Metrics /
Dashboards in `App.tsx`), listing currently-declared params (name, regex,
capture group, kind) via `fetchParams`.
- A declare form: name, `message_match_regex`, `capture_group`, kind
(string/number/timestamp — mirror `MetricPrimitiveKind`), submitting via a
new `declareParam` call to `POST /api/params`.
- Surface `400` validation errors from the backend (bad regex, unknown
capture group) inline on the form, matching how `Metrics`' declare form
reports its own validation errors.
- After a successful declare, refresh the params list so it (and
LogPreview's Columns picker) immediately reflects the new param without a
page reload.
- Contextual "?" help icon on the section, matching [021](021-docs-contextual-help.md)'s pattern.
## Acceptance criteria
- A param can be declared from the UI and immediately appears in LogPreview's
Columns picker without a page reload.
- An invalid regex or unknown capture group shows the backend's error message
on the form instead of failing silently.
- The declared-params list matches `GET /api/params` after a page reload.
## Depends on
- [021 — Docs contextual help](021-docs-contextual-help.md)