1.9 KiB
1.9 KiB
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) viafetchParams. - A declare form: name,
message_match_regex,capture_group, kind (string/number/timestamp — mirrorMetricPrimitiveKind), submitting via a newdeclareParamcall toPOST /api/params. - Surface
400validation errors from the backend (bad regex, unknown capture group) inline on the form, matching howMetrics' 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'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/paramsafter a page reload.