MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / toggleThreatMonitor

Function toggleThreatMonitor

web/scripts/ragnar_modern.js:4481–4518  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4479 if (_wifiHm.drag.kind === 'ap') _wifiHmPersistAp();
4480 else if (_wifiHm.drag.kind === 'column' || _wifiHm.drag.kind === 'column-resize') _wifiHmPersistColumns();
4481 else if (_wifiHm.drag.kind === 'fp-move' || _wifiHm.drag.kind === 'fp-resize') _wifiHmPersistFp();
4482 else _wifiHmPersistWalls();
4483 }
4484 _wifiHm.suppressClick = true; // swallow the click that follows this press
4485 _wifiHm.drag = null; cv.style.cursor = '';
4486 try { cv.releasePointerCapture(e.pointerId); } catch (_) {}
4487 wifiHeatmapRender();
4488 };
4489 cv.addEventListener('pointerup', endDrag);
4490 cv.addEventListener('pointercancel', endDrag);
4491 }
4492}
4493
4494function wifiThroughputTest() {
4495 const st = document.getElementById('wifi-hm-tp-status');
4496 const iperf = (document.getElementById('wifi-hm-iperf').value || '').trim();
4497 const secs = parseInt(document.getElementById('wifi-hm-tp-secs').value) || 5;
4498 st.textContent = 'Testing (~' + (iperf ? secs * 2 + 5 : secs + 3) + 's)…';
4499 fetch('/api/net/wifi/heatmap', { method: 'POST', headers: { 'Content-Type': 'application/json' },
4500 body: JSON.stringify({ action: 'throughput', iperf_server: iperf, seconds: secs }) })
4501 .then(r => r.json()).then(d => {
4502 const dn = d.down_mbps != null ? d.down_mbps + '↓' : '—';
4503 const up = d.up_mbps != null ? ' ' + d.up_mbps + '↑' : '';
4504 const lat = d.latency_ms != null ? ` · ${d.latency_ms}ms` : '';
4505 const loss = d.loss_pct ? ` · ${d.loss_pct}% loss` : '';
4506 st.innerHTML = `<b>${dn}${up}</b> Mbps${lat}${loss} <span class="text-gray-600">(${d.method})</span>`
4507 + (d.error ? ` <span class="text-amber-400">⚠ ${d.error}</span>` : '');
4508 }).catch(() => { st.textContent = 'test failed'; });
4509}
4510
4511// ---- Design / predictive coverage ------------------------------------------
4512function wifiHmSetMode(m) {
4513 _wifiHm.mode = m;
4514 const survey = m === 'survey';
4515 document.getElementById('wifi-hm-mode-survey').className =
4516 'wifi-hm-seg-btn ' + (survey ? 'wifi-hm-seg-on' : 'wifi-hm-seg-off');
4517 document.getElementById('wifi-hm-mode-design').className =
4518 'wifi-hm-seg-btn ' + (!survey ? 'wifi-hm-seg-on' : 'wifi-hm-seg-off');
4519 document.getElementById('wifi-hm-design-tools').classList.toggle('hidden', survey);
4520 _wifiHm.wallStart = null;
4521 wifiHeatmapRender();

Callers

nothing calls this directly

Calls 4

addMethod · 0.80
errorMethod · 0.80
_startThreatMonitorPollFunction · 0.70
_stopThreatMonitorPollFunction · 0.70

Tested by

no test coverage detected