diff --git a/templates/inspector.html b/templates/inspector.html index a7ab94d..ab26b74 100644 --- a/templates/inspector.html +++ b/templates/inspector.html @@ -427,9 +427,10 @@ function renderInspector(data) { const main = document.getElementById('inspector-main'); const switches = data.unifi_switches || {}; - const upd = data.updated ? `Updated: ${data.updated}` : ''; const updEl = document.getElementById('inspector-updated'); - if (updEl) updEl.textContent = upd; + if (updEl && data.updated) { + updEl.textContent = 'Updated: ' + new Date(data.updated + (data.updated.includes('Z') ? '' : 'Z')).toLocaleTimeString(); + } if (!Object.keys(switches).length) { main.innerHTML = '

No switch data available. Monitor may still be initialising.

'; @@ -465,7 +466,13 @@ async function loadInspector() { } loadInspector(); -lt.autoRefresh.start(loadInspector, 60000); +var _inspInterval = (window.gandalfSettings && window.gandalfSettings.refreshInterval) || 60; +if (_inspInterval > 0) lt.autoRefresh.start(loadInspector, Math.max(_inspInterval, 15) * 1000); + +window.onGandalfSettingsChanged = function(s) { + lt.autoRefresh.stop(); + if (s.refreshInterval > 0) lt.autoRefresh.start(loadInspector, Math.max(s.refreshInterval, 15) * 1000); +}; lt.keys.on('Escape', () => { if (document.getElementById('inspector-panel').classList.contains('open')) closePanel(); }); diff --git a/templates/links.html b/templates/links.html index 0dcf13c..701930c 100644 --- a/templates/links.html +++ b/templates/links.html @@ -384,33 +384,51 @@ function buildLinkSummary(hosts, unifiSwitches) { if ((d.tx_errs_rate || 0) > 0 || (d.rx_errs_rate || 0) > 0) errIfaces++; } } + let swTotal = 0, swDown = 0; for (const sw of Object.values(unifiSwitches || {})) { for (const p of Object.values(sw.ports || {})) { totalPoe += p.poe_power || 0; + swTotal++; + if (!p.up) swDown++; } } - const hasAlerts = downIfaces > 0 || errIfaces > 0; - return ` -