From 8127122c117d51e5b108f62136fb77f880d01918 Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Sat, 28 Mar 2026 11:58:24 +0000 Subject: [PATCH] Refreshed status display layout for easier reading --- templates/about.html | 2 +- templates/add_spot.html | 4 +-- templates/alerts.html | 4 +-- templates/bands.html | 6 ++-- templates/base.html | 8 ++--- templates/conditions.html | 2 +- templates/map.html | 6 ++-- templates/spots.html | 6 ++-- templates/status.html | 66 +++++++++++++++++++++++++++++++--- webassets/js/status.js | 76 +++++++++++++++++++-------------------- 10 files changed, 118 insertions(+), 62 deletions(-) diff --git a/templates/about.html b/templates/about.html index 6365dbf..12172e8 100644 --- a/templates/about.html +++ b/templates/about.html @@ -67,7 +67,7 @@

This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.

- + {% end %} \ No newline at end of file diff --git a/templates/add_spot.html b/templates/add_spot.html index db4cf5d..06cbf5f 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -69,8 +69,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/alerts.html b/templates/alerts.html index 0008152..8584bf4 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -56,8 +56,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/bands.html b/templates/bands.html index 4803022..d061769 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -62,9 +62,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 9adddb8..329c7e4 100644 --- a/templates/base.html +++ b/templates/base.html @@ -46,10 +46,10 @@ crossorigin="anonymous"> - - - - + + + + diff --git a/templates/conditions.html b/templates/conditions.html index f810bf3..f2cc5ad 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -3,7 +3,7 @@ Coming soon! - + {% end %} \ No newline at end of file diff --git a/templates/map.html b/templates/map.html index 6aba901..dcc0e0f 100644 --- a/templates/map.html +++ b/templates/map.html @@ -70,9 +70,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/spots.html b/templates/spots.html index 32297d7..81244c9 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -87,9 +87,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/status.html b/templates/status.html index 840e0ff..a8da402 100644 --- a/templates/status.html +++ b/templates/status.html @@ -1,10 +1,68 @@ {% extends "base.html" %} {% block content %} -
+
+
+ Spothole +
+
+
+
Metadata
+
Software Version:
+
Owner Callsign:
+
Up since:
+
+
+
Performance
+
Memory Use:
+
Total Spots:
+
Total Alerts:
+
+
+
Web Server
+
Status:
+
Last API call:
+
Last page req:
+
+
+
Cleanup Service
+
Status:
+
Last ran:
+
+
+
- - - +
+
+ Spot Providers +
+
+ +
+
+ +
+
+ Alert Providers +
+
+ +
+
+ +
+
+ Solar/Band Conditions Providers +
+
+ +
+
+ + + + {% end %} \ No newline at end of file diff --git a/webassets/js/status.js b/webassets/js/status.js index 9b10cb5..3b6f0c8 100644 --- a/webassets/js/status.js +++ b/webassets/js/status.js @@ -1,52 +1,50 @@ // Load server status function loadStatus() { $.getJSON('/api/v1/status', function(jsonData) { - $("#status-container").empty(); - $("#status-container").append(generateStatusCard("Server Information", [ - `Software Version: ${jsonData["software-version"]}`, - `Server Owner Callsign: ${jsonData["server-owner-callsign"]}`, - `Server up since: ${moment().subtract(jsonData["uptime"], 'seconds').fromNow()}`, - `Memory Use: ${jsonData["mem_use_mb"]} MB`, - `Total Spots: ${jsonData["num_spots"]}`, - `Total Alerts: ${jsonData["num_alerts"]}` - ])); - $("#status-container").append(generateStatusCard("Web Server", [ - `Status: ${jsonData["webserver"]["status"]}`, - `Last API Access: ${moment.unix(jsonData["webserver"]["last_api_access"]).utc().fromNow()}`, - `Last Page Access: ${moment.unix(jsonData["webserver"]["last_page_access"]).utc().fromNow()}` - ])); - $("#status-container").append(generateStatusCard("Cleanup Service", [ - `Status: ${jsonData["cleanup"]["status"]}`, - `Last Ran: ${moment.unix(jsonData["cleanup"]["last_ran"]).utc().fromNow()}` - ])); + $("#software-version").text(jsonData["software-version"]); + $("#server-owner-callsign").text(jsonData["server-owner-callsign"]); + $("#up-since").text(moment().subtract(jsonData["uptime"], 'seconds').fromNow()); + $("#memory-use").text(jsonData["mem_use_mb"] + " MB"); + $("#total-spots").text(jsonData["num_spots"]); + $("#total-alerts").text(jsonData["num_alerts"]); + + $("#web-server-status").text(jsonData["webserver"]["status"]); + $("#web-server-last-api").text(moment.unix(jsonData["webserver"]["last_api_access"]).utc().fromNow()); + $("#web-server-last-page").text(moment.unix(jsonData["webserver"]["last_page_access"]).utc().fromNow()); + + $("#cleanup-status").text(jsonData["cleanup"]["status"]); + $("#cleanu-last-ran").text(moment.unix(jsonData["cleanup"]["last_ran"]).utc().fromNow()); + jsonData["spot_providers"].forEach(p => { - $("#status-container").append(generateStatusCard("Spot Provider: " + p["name"], [ - `Status: ${p["status"]}`, - `Last Updated: ${(p["enabled"] && p["last_updated"] > 0) ? moment.unix(p["last_updated"]).utc().fromNow() : "N/A"}`, - `Latest Spot: ${(p["enabled"] && p["last_spot"] > 0) ? moment.unix(p["last_spot"]).utc().fromNow() : "N/A"}` - ])); + $("#spot-providers-status-container").append(` +
+
${p["name"]}
+
Status: ${p["status"]}
+
Last updated: ${(p["enabled"] && p["last_updated"] > 0) ? moment.unix(p["last_updated"]).utc().fromNow() : "N/A"}
+
Latest spot: ${(p["enabled"] && p["last_spot"] > 0) ? moment.unix(p["last_spot"]).utc().fromNow() : "N/A"}
+
`); }); + jsonData["alert_providers"].forEach(p => { - $("#status-container").append(generateStatusCard("Alert Provider: " + p["name"], [ - `Status: ${p["status"]}`, - `Last Updated: ${(p["enabled"] && p["last_updated"] > 0) ? moment.unix(p["last_updated"]).utc().fromNow() : "N/A"}` - ])); + $("#alert-providers-status-container").append(` +
+
${p["name"]}
+
Status: ${p["status"]}
+
Last updated: ${(p["enabled"] && p["last_updated"] > 0) ? moment.unix(p["last_updated"]).utc().fromNow() : "N/A"}
+
`); + }); + + jsonData["solar_condition_providers"].forEach(p => { + $("#condition-providers-status-container").append(` +
+
${p["name"]}
+
Status: ${p["status"]}
+
Last updated: ${(p["enabled"] && p["last_updated"] > 0) ? moment.unix(p["last_updated"]).utc().fromNow() : "N/A"}
+
`); }); }); } -// Generate a status card -function generateStatusCard(title, textLines) { - let $col = $("
"); - let $card = $("
"); - let $card_body = $("
"); - $card_body.append(`
${title}
`); - $card_body.append(`

${textLines.join("
")}

`); - $card.append($card_body); - $col.append($card); - return $col; -} - // Startup $(document).ready(function() { loadStatus();