Fix services panel: correct services, live refresh loop, last-updated timestamp in footer

This commit is contained in:
2026-05-30 06:46:26 +00:00
parent 4ab72e50b9
commit f007786fe4
2 changed files with 12 additions and 4 deletions
+11 -3
View File
@@ -822,7 +822,7 @@ body::after{
</div>
<div style="margin-left:auto;font-size:0.65rem">
JARVIS v2.0 · SECURITY LEVEL ALPHA
JARVIS v2.0 · SECURITY LEVEL ALPHA · UPDATED <span id="last-refresh">--:--:--</span>
</div>
</div>
</div>
@@ -1116,8 +1116,12 @@ function toggleCamera() {
let _refreshTick = 0;
let selectedContext = null;
const _panelCtx = {};
const _svcLabels = {lshttpd:'WEB',mysql:'MYSQL',redis:'REDIS',memcached:'MEMCACHE',postfix:'POSTFIX',dovecot:'DOVECOT','jarvis-agent':'AGENT'};
async function refreshAll() {
_refreshTick++;
const el = document.getElementById('last-refresh');
if (el) el.textContent = new Date().toLocaleTimeString('en-US',{hour12:false});
try {
const s = await api('system');
@@ -1134,11 +1138,15 @@ async function refreshAll() {
renderDO(d);
} catch(e) {}
// Agent status every tick (updates bottom bar badge)
try { await checkAgentStatus(); } catch(e) {}
// Refresh right-panel tabs every 3rd tick (~30s)
if (_refreshTick % 3 === 0) {
try { await loadHA(); } catch(e) {}
try { await loadAlerts(); } catch(e) {}
try { await loadAgents(); } catch(e) {}
try { await loadProxmox(); } catch(e) {}
}
// Refresh weather + news every 18th tick (~3 min — cache updates every 30 min)
if (_refreshTick % 18 === 0) {
@@ -1175,8 +1183,8 @@ function renderSystem(s) {
const svcEl = document.getElementById('services-list');
svcEl.innerHTML = Object.entries(s.services).map(([k,v]) =>
`<div class="service-row">
<span class="svc-name">${k.toUpperCase()}</span>
<div class="svc-dot ${v?'on':'off'}" title="${v?'ACTIVE':'INACTIVE'}"></div>
<span class="svc-name">${_svcLabels[k]||k.toUpperCase()}</span>
<div class="svc-dot ${v?'on':'off'}" title="${k}: ${v?'ACTIVE':'INACTIVE'}"></div>
</div>`
).join('');
}