Add OK/Offline field and small improvements

This commit is contained in:
raul 2024-06-04 12:41:09 +02:00
parent 5fed7f5de2
commit b6a6c28bd8
3 changed files with 25 additions and 17 deletions

View File

@ -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)
}

View File

@ -2,10 +2,12 @@
<html lang="en">
<head>
<title>AEMET Client</title>
<title>Tiamat Dashboard</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="style.css" rel="stylesheet">
<script href="htmx.js" integrity="sha384-qbtR4rS9RrUMECUWDWM2+YGgN3U4V4ZncZ0BvUcg9FGct0jqXz3PUdVpU1p0yrXS"
crossorigin="anonymous"></script>
</head>
<body>
@ -13,12 +15,12 @@
<div id="main">
<p>Hello {{ .UserAgent }}</p>
<hr>
<h2>Current clients</h2>
<h2 align=center>Current clients</h2>
{{ range .Clients }}
<table border=1>
<tr>
<td rowspan=2>Status</td>
<td>Status</td>
<td>IP</td>
<td>Username</td>
<td>Hostname</td>
@ -26,20 +28,25 @@
<td rowspan=2>Actions</td>
</tr>
<tr>
<td>{{ .PublicIP }}</td>
<td>{{ .Username }}</td>
<td>{{ .Hostname }}</td>
<td>{{ .OperatingSystem }}</td>
<td>
{{ if .IsOnline }}
<on>
OK
</on>
{{ else }}
<off>
Offline
</off>
{{ end }}
</td>
<td>{{ .ClientBasicInfo.PublicIP }}</td>
<td>{{ .ClientBasicInfo.Username }}</td>
<td>{{ .ClientBasicInfo.Hostname }}</td>
<td>{{ .ClientBasicInfo.OperatingSystem }}</td>
</tr>
</table>
<hr>
{{ end }}
<!-- <p>{{ .Username }}</p> -->
<!-- <p>{{ .UID }}</p> -->
<!-- <p>{{ .GID }}</p> -->
<!-- <p>{{ .Hostname }}</p> -->
<!-- <p>{{ .OperatingSystem }}</p> -->
</div>
</div>
</body>

View File

@ -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;
}