From b6a6c28bd8d20acbc9b9cc6bc032ffb633430f63 Mon Sep 17 00:00:00 2001 From: raul Date: Tue, 4 Jun 2024 12:41:09 +0200 Subject: [PATCH] Add OK/Offline field and small improvements --- cmd/httpServer.go | 1 + cmd/templates/index.html | 33 ++++++++++++++++++++------------- cmd/templates/style.css | 8 ++++---- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/cmd/httpServer.go b/cmd/httpServer.go index 84c02a2..63de8e3 100644 --- a/cmd/httpServer.go +++ b/cmd/httpServer.go @@ -24,6 +24,7 @@ func WebServer() { r := gin.Default() LoadHTMLFromEmbedFS(r, templatesFolder, "templates/*.html") r.StaticFileFS("/style.css", "./templates/style.css", http.FS(templatesFolder)) + r.StaticFileFS("/htmx.js", "./templates/htmx.js", http.FS(templatesFolder)) r.GET("/", getRoot) r.Run(":" + WebPort) } diff --git a/cmd/templates/index.html b/cmd/templates/index.html index 883c3c8..a6d4368 100644 --- a/cmd/templates/index.html +++ b/cmd/templates/index.html @@ -2,10 +2,12 @@ - AEMET Client + Tiamat Dashboard + @@ -13,12 +15,12 @@

Hello {{ .UserAgent }}


-

Current clients

+

Current clients

{{ range .Clients }} - + @@ -26,20 +28,25 @@ - - - - + + + + +
StatusStatus IP Username HostnameActions
{{ .PublicIP }}{{ .Username }}{{ .Hostname }}{{ .OperatingSystem }} + {{ if .IsOnline }} + + OK + + {{ else }} + + Offline + + {{ end }} + {{ .ClientBasicInfo.PublicIP }}{{ .ClientBasicInfo.Username }}{{ .ClientBasicInfo.Hostname }}{{ .ClientBasicInfo.OperatingSystem }}

{{ end }} - - - - - -
diff --git a/cmd/templates/style.css b/cmd/templates/style.css index c9e4858..fef579a 100644 --- a/cmd/templates/style.css +++ b/cmd/templates/style.css @@ -37,13 +37,13 @@ td.date { padding-right: 5px; } -cold { - color: darkcyan; +on { + color: green; font-weight: 500; } -hot { - color: darkorange; +off { + color: red; font-weight: 500; }