From 7a2a7a49350fc10783989ccfc55b681727555a10 Mon Sep 17 00:00:00 2001 From: Daniel Arroyo Date: Fri, 10 Jul 2026 10:51:10 -0400 Subject: [PATCH] Add Last Seen column and color-coded status badges in Machines table - New Last Seen column showing last_seen_at timestamp per machine - Status badges: online=green (success), offline=red (error), waking/pending=amber - Update Machine interface with last_seen_at and created_at fields --- Makefile | 2 +- cmd/server/main.go | 2 +- web/src/api/client.ts | 2 ++ web/src/lib/status.ts | 4 +++- web/src/pages/Machines.tsx | 15 ++++++++------- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 6d4dc01..1b6a603 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ BINARY=syncserver -VERSION?=1.0.40 +VERSION?=1.0.41 GO?=go LDFLAGS=-s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) BUILD_FLAGS=CGO_ENABLED=0 diff --git a/cmd/server/main.go b/cmd/server/main.go index 08cd45e..e08edd8 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -20,7 +20,7 @@ import ( "github.com/syncserver/internal/syncengine" ) -var version = "1.0.40" +var version = "1.0.41" func main() { cfgPath := flag.String("config", "", "Path to config.yaml") diff --git a/web/src/api/client.ts b/web/src/api/client.ts index 90d2ae7..8ad49ce 100644 --- a/web/src/api/client.ts +++ b/web/src/api/client.ts @@ -53,6 +53,8 @@ export interface Machine { fingerprint_confirmed: boolean; host_key_fingerprint: string | null; status: string; + last_seen_at: string | null; + created_at: string; } export interface TestConnectionResponse { diff --git a/web/src/lib/status.ts b/web/src/lib/status.ts index e70d26e..dea8fcc 100644 --- a/web/src/lib/status.ts +++ b/web/src/lib/status.ts @@ -25,7 +25,7 @@ export type BadgeVariant = VariantProps['variant'] const STATUS_TO_VARIANT: Record = { running: 'running', pending: 'pending', - waking: 'waking', + waking: 'pending', success: 'success', error: 'error', failed: 'error', @@ -33,6 +33,8 @@ const STATUS_TO_VARIANT: Record = { cancelled: 'neutral', info: 'info', unknown: 'neutral', + online: 'success', + offline: 'error', } export function statusVariant(status: string): BadgeVariant { diff --git a/web/src/pages/Machines.tsx b/web/src/pages/Machines.tsx index 0784f75..515e7c1 100644 --- a/web/src/pages/Machines.tsx +++ b/web/src/pages/Machines.tsx @@ -5,6 +5,7 @@ import { Input } from '@/components/ui/Input'; import { Label } from '@/components/ui/Label'; import { Select, SelectValue, SelectTrigger, SelectContent, SelectItem } from '@/components/ui/Select'; import { Badge } from '@/components/ui/Badge'; +import { statusVariant } from '@/lib/status'; import { Modal, ModalContent, @@ -278,6 +279,7 @@ export default function Machines() { WoL WoL Timeout Status + Last Seen Actions @@ -312,6 +314,11 @@ export default function Machines() { + + + {m.last_seen_at ? new Date(m.last_seen_at).toLocaleString() : } + +