it is techincally a ui

This commit is contained in:
bel
2026-06-28 00:27:14 -06:00
parent 2e339cff36
commit 84a8897bf0
2 changed files with 43 additions and 1 deletions
+42
View File
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<header>
<script>
function onload() {
const results = [
{{ range $v := query
`
SELECT
start AS start
, CASE
WHEN ms < 750 OR ok THEN
'okay'
ELSE
'errored'
END AS ok
FROM
"pinger_pings"
ORDER BY start DESC
LIMIT 1000
`
-}}
[
{{.ok}}==="okay"
? "🟢"
: "🔴",
`${Math.round((new Date() - 1000*{{.start}})/1000.0)}s ago`,
new Date(1000*{{.start}}),
],
{{ end }}
]
document.getElementById("draw").innerHTML = results.map((r) => `<br>${JSON.stringify(r)}`).join("\n");
}
</script>
</header>
<body onload="onload()">
<div id="draw">
</div>
</body>
<footer>
</footer>
</html>
+1 -1
View File
@@ -187,7 +187,7 @@ func (s S) pingAndRecord(ctx context.Context) error {
(start, ms, ok, to_id) (start, ms, ok, to_id)
VALUES VALUES
($1, $2, $3, $4) ($1, $2, $3, $4)
`, record.start, record.ms.Milliseconds(), record.ok, toId); err != nil { `, record.start.Unix(), record.ms.Milliseconds(), record.ok, toId); err != nil {
log.Println("!", err) log.Println("!", err)
} }
} }