()
| 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 | |
| 4494 | function 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 ------------------------------------------ |
| 4512 | function 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(); |
nothing calls this directly
no test coverage detected