mirror of
https://github.com/myronblair/jarvis
synced 2026-06-30 17:50:23 -05:00
Fix services panel: correct services, live refresh loop, last-updated timestamp in footer
This commit is contained in:
@@ -89,7 +89,7 @@ function getNetworkIO(): array {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getServices(): array {
|
function getServices(): array {
|
||||||
$services = ['apache2', 'mysql'];
|
$services = ["lshttpd","mysql","redis","memcached","postfix","dovecot","jarvis-agent"];
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($services as $svc) {
|
foreach ($services as $svc) {
|
||||||
$out = shell_exec('systemctl is-active ' . escapeshellarg($svc) . ' 2>/dev/null');
|
$out = shell_exec('systemctl is-active ' . escapeshellarg($svc) . ' 2>/dev/null');
|
||||||
|
|||||||
+11
-3
@@ -822,7 +822,7 @@ body::after{
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-left:auto;font-size:0.65rem">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1116,8 +1116,12 @@ function toggleCamera() {
|
|||||||
let _refreshTick = 0;
|
let _refreshTick = 0;
|
||||||
let selectedContext = null;
|
let selectedContext = null;
|
||||||
const _panelCtx = {};
|
const _panelCtx = {};
|
||||||
|
const _svcLabels = {lshttpd:'WEB',mysql:'MYSQL',redis:'REDIS',memcached:'MEMCACHE',postfix:'POSTFIX',dovecot:'DOVECOT','jarvis-agent':'AGENT'};
|
||||||
|
|
||||||
async function refreshAll() {
|
async function refreshAll() {
|
||||||
_refreshTick++;
|
_refreshTick++;
|
||||||
|
const el = document.getElementById('last-refresh');
|
||||||
|
if (el) el.textContent = new Date().toLocaleTimeString('en-US',{hour12:false});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const s = await api('system');
|
const s = await api('system');
|
||||||
@@ -1134,11 +1138,15 @@ async function refreshAll() {
|
|||||||
renderDO(d);
|
renderDO(d);
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
||||||
|
// Agent status every tick (updates bottom bar badge)
|
||||||
|
try { await checkAgentStatus(); } catch(e) {}
|
||||||
|
|
||||||
// Refresh right-panel tabs every 3rd tick (~30s)
|
// Refresh right-panel tabs every 3rd tick (~30s)
|
||||||
if (_refreshTick % 3 === 0) {
|
if (_refreshTick % 3 === 0) {
|
||||||
try { await loadHA(); } catch(e) {}
|
try { await loadHA(); } catch(e) {}
|
||||||
try { await loadAlerts(); } catch(e) {}
|
try { await loadAlerts(); } catch(e) {}
|
||||||
try { await loadAgents(); } 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)
|
// Refresh weather + news every 18th tick (~3 min — cache updates every 30 min)
|
||||||
if (_refreshTick % 18 === 0) {
|
if (_refreshTick % 18 === 0) {
|
||||||
@@ -1175,8 +1183,8 @@ function renderSystem(s) {
|
|||||||
const svcEl = document.getElementById('services-list');
|
const svcEl = document.getElementById('services-list');
|
||||||
svcEl.innerHTML = Object.entries(s.services).map(([k,v]) =>
|
svcEl.innerHTML = Object.entries(s.services).map(([k,v]) =>
|
||||||
`<div class="service-row">
|
`<div class="service-row">
|
||||||
<span class="svc-name">${k.toUpperCase()}</span>
|
<span class="svc-name">${_svcLabels[k]||k.toUpperCase()}</span>
|
||||||
<div class="svc-dot ${v?'on':'off'}" title="${v?'ACTIVE':'INACTIVE'}"></div>
|
<div class="svc-dot ${v?'on':'off'}" title="${k}: ${v?'ACTIVE':'INACTIVE'}"></div>
|
||||||
</div>`
|
</div>`
|
||||||
).join('');
|
).join('');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user