feat(device-detail): wire device power actions (VAPP-8) #17
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/device-power-actions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves VAPP-8. Wires the previously inert Wake / Reboot buttons on the device detail header to live power actions over the vervain-server control channel.
What changed
power_action(device_id, action_code)insrc/server_fns/mod.rs: sends{action: "poweraction", nodeids, actiontype}with the device's full node id, awaits the{action: "ack", for: "poweraction", result}routing ack, and maps each result string to a clear error (not-connected,not-authorized,bad-actiontype,no-nodes).action_codefollows the legacy agent table from the issue: reboot=4, shutdown=8, sleep=11.wake_device(device_id)using thewakedevicesaction. Wake-on-LAN is deliberately a separate path:poweractiontype 2 relays to the target's own agent, which is unreachable when the machine is off, whereaswakedevicesfans a magic packet out to the connected agents in the same mesh.okandno-peersboth return success so "could not be woken" is not treated as a fault, matching the acceptance criterion.src/components/pages/device_detail.rs): replaced the static buttons with aPowerActionscomponent. Wake is enabled only while the device is offline; Reboot / Shutdown / Sleep sit in a dropdown enabled only while it is online. Every action opens aConfirmDialognaming the device and the verb, and no server call fires until its Confirm button. On ack the page shows a "requested" toast (or a visible error banner) and re-fetches the device row, since the status only flips once the agent reconnects.DeviceStatusgainsCopyso it can pass to the component as a value prop.Acceptance criteria
wakedevices;no-peersis not surfaced as an error)Verification
just checkequivalent passes locally:cargo check --features server,cargo check --target wasm32-unknown-unknown,cargo clippy --all-targets --features server -- -D warnings,cargo fmt --check, andcargo test --features server --bin vervain-appare all clean.🤖 Generated with Claude Code