feat(device-detail): wire tabs to live per-device data #9

Merged
David merged 1 commit from feat/device-detail-tabs into main 2026-06-06 18:21:06 +02:00
Owner

Wires the device-detail tabs to live per-device data over the control channel, completing the static placeholders left by #8.

What changed

  • Overview: agent's cached getsysinfo inventory: OS, kernel, arch, CPU, memory, uptime, load, drives table, non-loopback network interfaces, plus the node's five most recent events. A cache miss (noinfo) renders "no inventory yet"; the server primes the cache from the agent on first miss, so the snapshot appears on the next visit.
  • Sessions: logged-in users live from the agent via msg/userSessions. Two-phase flow: the server acks routing first, so "device is offline" and "agent-console rights required" surface as immediate friendly errors instead of timeouts; the agent's reply is matched by type + nodeid.
  • Events: nodeid-filtered event log (limit 100), same severity/source mapping as the global page.
  • Power: 7-day powertimeline decoded from the compact [state, start_secs, state, dur_secs, ...] wire shape into on/off segments, newest first, the open segment labelled "now".
  • Files / Policies: visible but disabled with a "Not yet supported by vervain-server" tooltip (per scope decision).
  • control.rs grows send() + await_where(predicate, verbatim timeout message); request_with_timeout now layers on those. Relayed agent msg frames all share action: "msg" and need predicate matching.

Routing bug fixed along the way

Real node ids are node/<domain>/<short>; the slashes dropped /devices/:device_id into the catch-all 404 (the canned fixture ids had no slashes, so this never showed). Device links now carry the bare short id and get_device matches full id or short-id suffix.

Verification

  • just check clean (fmt, clippy -D warnings, server + wasm cargo check, tests).
  • End to end with a REAL agent: local vervain-server (dev mode, setup enabled), first user registered, device group created via meshctrl, /meshsettings config sealed into a dev-insecure build of vervain-agent, agent connected and registered as a node. Then, against the built app with a session cookie: device list shows the live node (Online, platform, address), detail page renders via short id, and all four tab server fns returned live data over HTTP: real hardware inventory (after cache priming), actual utmp sessions from the agent, the nodeconnect event, and one power-on segment since connect. Verification servers, agent, and temp data torn down afterwards.

Notes

  • The agent's userSessions reply splits login time oddly (login_time: "Jun 5", remote_host: "19:30"): that is vervain-agent's utmp parsing, shown verbatim here; worth a separate agent-side issue.
  • Header action buttons (Wake / Reboot / Remote desktop) remain inert; they need the relay/power-action wiring and were not in this PR's scope.
Wires the device-detail tabs to live per-device data over the control channel, completing the static placeholders left by #8. ## What changed - **Overview**: agent's cached `getsysinfo` inventory: OS, kernel, arch, CPU, memory, uptime, load, drives table, non-loopback network interfaces, plus the node's five most recent events. A cache miss (`noinfo`) renders "no inventory yet"; the server primes the cache from the agent on first miss, so the snapshot appears on the next visit. - **Sessions**: logged-in users live from the agent via `msg`/`userSessions`. Two-phase flow: the server acks routing first, so "device is offline" and "agent-console rights required" surface as immediate friendly errors instead of timeouts; the agent's reply is matched by `type` + `nodeid`. - **Events**: nodeid-filtered event log (limit 100), same severity/source mapping as the global page. - **Power**: 7-day `powertimeline` decoded from the compact `[state, start_secs, state, dur_secs, ...]` wire shape into on/off segments, newest first, the open segment labelled "now". - **Files / Policies**: visible but disabled with a "Not yet supported by vervain-server" tooltip (per scope decision). - `control.rs` grows `send()` + `await_where(predicate, verbatim timeout message)`; `request_with_timeout` now layers on those. Relayed agent `msg` frames all share `action: "msg"` and need predicate matching. ## Routing bug fixed along the way Real node ids are `node/<domain>/<short>`; the slashes dropped `/devices/:device_id` into the catch-all 404 (the canned fixture ids had no slashes, so this never showed). Device links now carry the bare short id and `get_device` matches full id or short-id suffix. ## Verification - `just check` clean (fmt, clippy -D warnings, server + wasm cargo check, tests). - End to end with a REAL agent: local vervain-server (dev mode, setup enabled), first user registered, device group created via `meshctrl`, `/meshsettings` config sealed into a `dev-insecure` build of vervain-agent, agent connected and registered as a node. Then, against the built app with a session cookie: device list shows the live node (Online, platform, address), detail page renders via short id, and all four tab server fns returned live data over HTTP: real hardware inventory (after cache priming), actual utmp sessions from the agent, the nodeconnect event, and one power-on segment since connect. Verification servers, agent, and temp data torn down afterwards. ## Notes - The agent's `userSessions` reply splits login time oddly (`login_time: "Jun 5"`, `remote_host: "19:30"`): that is vervain-agent's utmp parsing, shown verbatim here; worth a separate agent-side issue. - Header action buttons (Wake / Reboot / Remote desktop) remain inert; they need the relay/power-action wiring and were not in this PR's scope.
feat(device-detail): wire tabs to live per-device data
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 1m4s
Create release / Create release from merged PR (pull_request) Has been skipped
6f5d034205
Replace the static device-detail placeholders with live tabs backed by the control channel. Overview shows the agent's cached sysinfo (OS, kernel, CPU, memory, uptime, load, drives, network interfaces) via getsysinfo plus the node's recent events; Sessions queries logged-in users live from the agent (msg/userSessions, two-phase: routing ack first, so offline and missing agent-console rights surface as friendly errors); Events is the nodeid-filtered log; Power decodes the compact 7-day powertimeline into on/off segments. Files and Policies stay visible but disabled with a "not yet supported by vervain-server" tooltip, since they have no server API today.

- control.rs grows send() + await_where(frame predicate, verbatim timeout message) so relayed agent msg frames, which all share action "msg", can be matched by type and nodeid; request_with_timeout now layers on those.
- New models: DeviceSysinfo (+DriveInfo, NetInterface), DeviceSession, PowerSegment. New server fns: get_device_sysinfo (noinfo maps to None and the page explains the snapshot appears after the agent reports; the server primes the cache on first miss), list_device_events, list_device_sessions, get_power_timeline.
- Fixes a routing bug the canned data had been hiding: real node ids are node/<domain>/<short> and the slashes dropped /devices/:device_id into the catch-all 404. Device links now carry the short id and get_device suffix-matches it.

Verified end to end against a local vervain-server with a real enrolled vervain-agent (dev-insecure build): device list shows the live node, the detail page renders by short id, and all four tab server fns returned live data over HTTP (real hardware inventory after cache priming, actual utmp sessions from the agent, the nodeconnect event, one power-on segment since connect).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
David merged commit 8f71481876 into main 2026-06-06 18:21:06 +02:00
David deleted branch feat/device-detail-tabs 2026-06-06 18:21:06 +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!9
No description provided.