Style improvements and fixes #3

This commit is contained in:
Ian Renton
2025-12-22 16:35:28 +00:00
parent 70a7bd4814
commit 1f66da062b
13 changed files with 235 additions and 184 deletions

View File

@@ -1,5 +1,5 @@
// How often to query the server?
const REFRESH_INTERVAL_SEC = 60 * 30;
const REFRESH_INTERVAL_SEC = 60 * 10;
// Storage for the alert data that the server gives us.
var alerts = []
@@ -51,7 +51,8 @@ function updateTable() {
var showRef = $("#tableShowRef")[0].checked;
// Populate table with headers
let table = $('<table class="table">').append('<thead><tr class="table-primary"></tr></thead><tbody></tbody>');
let table = $("#table");
table.find('thead tr').empty();
if (showStartTime) {
table.find('thead tr').append(`<th>${useLocalTime ? "Start&nbsp;(Local)" : "Start&nbsp;UTC"}</th>`);
}
@@ -74,6 +75,8 @@ function updateTable() {
table.find('thead tr').append(`<th class='hideonmobile'>Ref.</th>`);
}
table.find('tbody').empty();
// Split alerts into three types, each of which will get its own table header: On now, next 24h, and later. "On now"
// is considered to be events with an end_time where start<now<end, or events with no end time that started in the
// last hour.
@@ -100,9 +103,6 @@ function updateTable() {
if (onNow.length == 0 && next24h.length == 0 && later.length == 0) {
table.find('tbody').append('<tr class="table-danger"><td colspan="100" style="text-align:center;">No alerts match your filters.</td></tr>');
}
// Update DOM
$('#table-container').html(table);
}
// Add a row to tbody for each alert in the provided list