mirror of
https://github.com/myronblair/jarvis
synced 2026-06-30 17:50:23 -05:00
Fix RUN NETWORK SCAN button: queue PVE1 probe, return real DB data, no fake scan from DO
This commit is contained in:
+12
-19
@@ -1296,30 +1296,23 @@ function renderNetworkStatus(n) {
|
||||
// ── NETWORK SCAN ──────────────────────────────────────────────────────
|
||||
async function scanNetwork() {
|
||||
const btn = document.getElementById('scanBtn');
|
||||
btn.textContent = 'SCANNING...';
|
||||
btn.textContent = 'QUEUING...';
|
||||
btn.disabled = true;
|
||||
addMessage('jarvis', 'Initiating subnet scan on 10.48.200.0/24, Sir. This will take approximately 10 seconds.');
|
||||
speak('Initiating network scan.');
|
||||
|
||||
try {
|
||||
const data = await api('network/scan');
|
||||
if (data.devices) {
|
||||
const el = document.getElementById('network-list');
|
||||
el.innerHTML = data.devices.map(d =>
|
||||
`<div class="device-item">
|
||||
<div class="device-status on"></div>
|
||||
<div class="device-info">
|
||||
<div class="device-name">${d.alias||d.hostname||d.ip}</div>
|
||||
<div class="device-ip">${d.ip}${d.mac?' · '+d.mac:''}</div>
|
||||
</div>
|
||||
</div>`
|
||||
).join('');
|
||||
const msg = `Network scan complete. Found ${data.count} active device${data.count!==1?'s':''} on the 10.48.200.0/24 subnet.`;
|
||||
addMessage('jarvis', msg);
|
||||
speak(msg);
|
||||
}
|
||||
const count = data.count ?? 0;
|
||||
const msg = data.queued
|
||||
? `Network scan dispatched to PVE1 probe, ${userAddr}. Currently showing ${count} active device${count!==1?'s':''} — panel will refresh with live results in approximately 40 seconds.`
|
||||
: `Showing last known network data: ${count} active device${count!==1?'s':''} on 10.48.200.0/24. PVE1 probe scans automatically every 3 minutes.`;
|
||||
addMessage('jarvis', msg);
|
||||
speak(count + ' devices online.');
|
||||
// Refresh the network panel with current data
|
||||
loadNetwork();
|
||||
// Auto-refresh again after 45s to catch PVE1 scan results
|
||||
if (data.queued) setTimeout(loadNetwork, 45000);
|
||||
} catch(e) {
|
||||
addMessage('jarvis', 'Network scan encountered an error, Sir.');
|
||||
addMessage('jarvis', 'Network scan request failed, Sir.');
|
||||
}
|
||||
|
||||
btn.textContent = 'RUN NETWORK SCAN';
|
||||
|
||||
Reference in New Issue
Block a user