VAPP-19: Settings Diagnostics: wire log level to traceinfo and add server errors viewer #23

Merged
David merged 2 commits from feat/settings-diagnostics-vapp-19 into main 2026-06-07 19:39:53 +02:00
Owner

VAPP-19: Settings Diagnostics: wire log level to traceinfo and add server errors viewer

The Diagnostics card on the settings page was dead: the info/debug/trace select was bound to nothing and "Open logs folder" had no handler (and a browser app cannot open a local file manager anyway). This wires the card to vervain-server's real admin diagnostics surfaces over the control channel.

Server fns (src/server_fns/mod.rs)

All three use control::ADMIN_ONLY_TIMEOUT, with frame shapes verified against the vervain-server dispatch (crates/meshcentral-web/src/user_session.rs):

  • get_trace_info() sends {action: "traceinfo"} and returns the enabled source keys parsed from the reply's traceSources object (a value counts as on if it is true, a non-zero number, or a non-empty string).
  • set_trace_info(sources) sends {action: "traceinfo", traceSources: {<key>: true, ...}} and returns the server's resulting enabled set. The map form is required: the server's write arm only applies when traceSources deserializes as an object, and the write itself is full-admin only, so the fn reconciles against the authoritative reply rather than assuming the write took.
  • get_server_errors() sends {action: "servererrors"} and returns the buffered error log as plain text (data absent maps to empty).

UI (src/components/pages/settings.rs)

The dead card becomes a DiagnosticsCard component:

  • A per-source trace table seeded from a canonical source list mirroring the legacy MeshCentral "Server Tracing" dialog (the server keeps no canonical list of its own and defaults to an empty map). Each row shows the server's current on/off state; toggling pushes the updated map and survives a page reload while the server stays up.
  • Help text notes the trace state is in-memory on the server and resets on restart.
  • A "Server errors" section with a Refresh button and a monospace scrollable pane over the buffered log. No clear button (the server-side serverclearerrorlog is a stub).
  • get_server_errors doubles as the admin gate: it is silently dropped for non-admins (surfacing as a timeout), so a failed initial load renders one explanatory inline line in place of the controls rather than dead toggles (same pattern as the Plugins page).
  • The "Open logs folder" button is gone.

Acceptance criteria

  • Trace sources render with their current on/off state from the server
  • Toggling a source updates the server and survives a page reload (while the server stays up)
  • Help text notes the trace state is in-memory and resets on server restart
  • Server errors pane shows the buffered log and refreshes on demand
  • "Open logs folder" button is gone
  • Non-admin users see an explanatory inline error instead of dead controls
  • just check passes
## VAPP-19: Settings Diagnostics: wire log level to traceinfo and add server errors viewer The Diagnostics card on the settings page was dead: the info/debug/trace `select` was bound to nothing and "Open logs folder" had no handler (and a browser app cannot open a local file manager anyway). This wires the card to vervain-server's real admin diagnostics surfaces over the control channel. ### Server fns (`src/server_fns/mod.rs`) All three use `control::ADMIN_ONLY_TIMEOUT`, with frame shapes verified against the vervain-server dispatch (`crates/meshcentral-web/src/user_session.rs`): - `get_trace_info()` sends `{action: "traceinfo"}` and returns the enabled source keys parsed from the reply's `traceSources` object (a value counts as on if it is `true`, a non-zero number, or a non-empty string). - `set_trace_info(sources)` sends `{action: "traceinfo", traceSources: {<key>: true, ...}}` and returns the server's resulting enabled set. The map form is required: the server's write arm only applies when `traceSources` deserializes as an object, and the write itself is full-admin only, so the fn reconciles against the authoritative reply rather than assuming the write took. - `get_server_errors()` sends `{action: "servererrors"}` and returns the buffered error log as plain text (`data` absent maps to empty). ### UI (`src/components/pages/settings.rs`) The dead card becomes a `DiagnosticsCard` component: - A per-source trace table seeded from a canonical source list mirroring the legacy MeshCentral "Server Tracing" dialog (the server keeps no canonical list of its own and defaults to an empty map). Each row shows the server's current on/off state; toggling pushes the updated map and survives a page reload while the server stays up. - Help text notes the trace state is in-memory on the server and resets on restart. - A "Server errors" section with a Refresh button and a monospace scrollable pane over the buffered log. No clear button (the server-side `serverclearerrorlog` is a stub). - `get_server_errors` doubles as the admin gate: it is silently dropped for non-admins (surfacing as a timeout), so a failed initial load renders one explanatory inline line in place of the controls rather than dead toggles (same pattern as the Plugins page). - The "Open logs folder" button is gone. ### Acceptance criteria - [x] Trace sources render with their current on/off state from the server - [x] Toggling a source updates the server and survives a page reload (while the server stays up) - [x] Help text notes the trace state is in-memory and resets on server restart - [x] Server errors pane shows the buffered log and refreshes on demand - [x] "Open logs folder" button is gone - [x] Non-admin users see an explanatory inline error instead of dead controls - [x] `just check` passes
feat(settings): wire diagnostics to traceinfo and server errors
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 59s
c1ad819166
Replace the dead Diagnostics card on the settings page with controls backed by vervain-server's real admin diagnostics surfaces over the control channel.

Add three server fns in `server_fns/mod.rs`, all using the short admin-only timeout: `get_trace_info` reads the per-source debug-trace bitmap and returns the enabled source keys, `set_trace_info` writes the full enabled set (each source sent as `true`, since the server's `traceinfo` write arm only accepts an object map) and reconciles against the server's authoritative reply, and `get_server_errors` returns the buffered error log as plain text (`data` absent maps to empty).

Rework the Diagnostics card into a `DiagnosticsCard` component: a per-source trace table seeded from a canonical source list (mirroring the legacy MeshCentral "Server Tracing" dialog) with each row's on/off state from the server, and a refreshable monospace pane over the buffered server error log. Each toggle pushes the updated map and survives a reload while the server stays up; help text notes the trace state is in-memory and resets on server restart. `get_server_errors` doubles as the admin gate (silently dropped for non-admins, surfacing as a timeout), so a failed initial load renders one explanatory line in place of the controls rather than dead toggles. The "Open logs folder" button is gone.

#VAPP-19
Merge branch 'main' into feat/settings-diagnostics-vapp-19
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / fmt + clippy + build + tests (pull_request) Successful in 1m3s
592e96de0d
David merged commit e2152e0599 into main 2026-06-07 19:39:53 +02:00
David deleted branch feat/settings-diagnostics-vapp-19 2026-06-07 19:39:53 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/vervain-apps!23
No description provided.