feat: add device connection status and owner username to device listings with handshake-based connectivity detection
Add connection_status and owner_username fields to Device model. Join users table in ListByUser and ListAll queries to populate owner_username from username column. Parse latest_handshake_at from gateway runtime snapshots and aggregate across peers. Add isPeerConnected helper with 3-minute handshake timeout threshold. Set connection_status to "connected" or "disconnected" based on handsh
This commit is contained in:
@@ -14,8 +14,10 @@ export type Device = {
|
||||
id: string;
|
||||
name: string;
|
||||
user_id?: string;
|
||||
owner_username?: string;
|
||||
platform: string;
|
||||
status: string;
|
||||
connection_status: string;
|
||||
assigned_ip?: string;
|
||||
rx_bytes: number;
|
||||
tx_bytes: number;
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Table } from "../../components/Table";
|
||||
const columns = [
|
||||
{ key: "name", label: "Device" },
|
||||
{ key: "owner", label: "Owner" },
|
||||
{ key: "connection", label: "Connection" },
|
||||
{ key: "platform", label: "Platform" },
|
||||
{ key: "ip", label: "VPN IP" },
|
||||
{ key: "received", label: "Received" },
|
||||
@@ -54,7 +55,8 @@ export function DevicesPage() {
|
||||
const rows = query.data?.map((device) => ({
|
||||
id: device.id,
|
||||
name: device.name,
|
||||
owner: device.user_id ?? "assigned user",
|
||||
owner: device.owner_username || device.user_id || "unassigned",
|
||||
connection: device.connection_status === "connected" ? "Connected" : "Disconnected",
|
||||
platform: device.platform,
|
||||
ip: device.assigned_ip ?? "-",
|
||||
received: formatDataSize(device.rx_bytes ?? 0),
|
||||
|
||||
Reference in New Issue
Block a user