feat(ui): add WiFi/network info to self-test
Add informational network status check at the beginning of self-test: - Shows connection mode (Hotspot, WiFi, or Ethernet) - Displays SSID/connection name - Shows IP address and hostname.local - Add wifi_status endpoint in launcher.php using nmcli Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -375,6 +375,15 @@
|
||||
</div>
|
||||
|
||||
<div class="list-group" id="selftest_results">
|
||||
<!-- Info: WiFi Status -->
|
||||
<div class="list-group-item d-flex justify-content-between align-items-center" id="test_wifi">
|
||||
<div>
|
||||
<strong>WiFi / Network</strong>
|
||||
<div class="small text-muted" id="test_wifi_detail">Waiting...</div>
|
||||
</div>
|
||||
<span id="test_wifi_status" class="badge bg-secondary">Pending</span>
|
||||
</div>
|
||||
|
||||
<!-- Test 1: Modem Connection -->
|
||||
<div class="list-group-item d-flex justify-content-between align-items-center" id="test_modem">
|
||||
<div>
|
||||
@@ -1511,6 +1520,10 @@ function resetSelfTestUI() {
|
||||
</div>`;
|
||||
|
||||
// Reset test items
|
||||
document.getElementById('test_wifi_status').className = 'badge bg-secondary';
|
||||
document.getElementById('test_wifi_status').textContent = 'Pending';
|
||||
document.getElementById('test_wifi_detail').textContent = 'Waiting...';
|
||||
|
||||
document.getElementById('test_modem_status').className = 'badge bg-secondary';
|
||||
document.getElementById('test_modem_status').textContent = 'Pending';
|
||||
document.getElementById('test_modem_detail').textContent = 'Waiting...';
|
||||
@@ -1605,6 +1618,62 @@ async function selfTestSequence() {
|
||||
let testsFailed = 0;
|
||||
|
||||
try {
|
||||
// Step 0: Check WiFi / Network status (informational, no pass/fail)
|
||||
document.getElementById('selftest_status').innerHTML = `
|
||||
<div class="d-flex align-items-center text-primary">
|
||||
<div class="spinner-border spinner-border-sm me-2" role="status"></div>
|
||||
<span>Checking network status...</span>
|
||||
</div>`;
|
||||
|
||||
updateTestStatus('wifi', 'Checking...', 'Getting network info...', 'bg-info');
|
||||
|
||||
try {
|
||||
const wifiResponse = await new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
url: 'launcher.php?type=wifi_status',
|
||||
dataType: 'json',
|
||||
method: 'GET',
|
||||
success: function(data) {
|
||||
addSelfTestLog(`WiFi status: ${JSON.stringify(data)}`);
|
||||
resolve(data);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
addSelfTestLog(`WiFi status error: ${error}`);
|
||||
reject(new Error(error));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (wifiResponse.connected) {
|
||||
let modeIcon = '';
|
||||
let modeLabel = '';
|
||||
let badgeClass = 'bg-info';
|
||||
|
||||
if (wifiResponse.mode === 'hotspot') {
|
||||
modeIcon = '📡';
|
||||
modeLabel = 'Hotspot';
|
||||
badgeClass = 'bg-warning text-dark';
|
||||
} else if (wifiResponse.mode === 'wifi') {
|
||||
modeIcon = '📶';
|
||||
modeLabel = 'WiFi';
|
||||
badgeClass = 'bg-info';
|
||||
} else if (wifiResponse.mode === 'ethernet') {
|
||||
modeIcon = '🔌';
|
||||
modeLabel = 'Ethernet';
|
||||
badgeClass = 'bg-info';
|
||||
}
|
||||
|
||||
const detailText = `${wifiResponse.ssid} | ${wifiResponse.ip} | ${wifiResponse.hostname}.local`;
|
||||
updateTestStatus('wifi', modeLabel, detailText, badgeClass);
|
||||
} else {
|
||||
updateTestStatus('wifi', 'Disconnected', 'No network connection', 'bg-secondary');
|
||||
}
|
||||
} catch (error) {
|
||||
updateTestStatus('wifi', 'Error', error.message, 'bg-secondary');
|
||||
}
|
||||
|
||||
await delay(500);
|
||||
|
||||
// Step 1: Enable config mode
|
||||
document.getElementById('selftest_status').innerHTML = `
|
||||
<div class="d-flex align-items-center text-primary">
|
||||
|
||||
Reference in New Issue
Block a user