* Load the list of saved credentials
()
| 20759 | return; |
| 20760 | } |
| 20761 | |
| 20762 | // Determine which interface is selected for dashboard display |
| 20763 | const activeInterface = getActiveWifiInterface(); |
| 20764 | let selectedEntry = null; |
| 20765 | if (activeInterface) { |
| 20766 | selectedEntry = state.interfaces.find(entry => entry.name === activeInterface); |
| 20767 | } |
| 20768 | // Fallback: show first connected, else first |
| 20769 | if (!selectedEntry) { |
| 20770 | selectedEntry = state.interfaces.find(entry => entry.connected && entry.connected_ssid) || state.interfaces[0]; |
| 20771 | } |
| 20772 | |
| 20773 | // Show only the selected interface's data |
| 20774 | let markup = ''; |
| 20775 | if (selectedEntry) { |
| 20776 | const roleClass = selectedEntry.role === 'external' |
| 20777 | ? 'bg-indigo-900 text-indigo-100' |
| 20778 | : 'bg-slate-800 text-slate-100'; |
| 20779 | const scanActive = Boolean(selectedEntry.scan_enabled && selectedEntry.connected && selectedEntry.connected_ssid); |
| 20780 | const scanLabel = scanActive ? 'Scanning' : 'Paused'; |
| 20781 | const scanClass = scanActive ? 'text-green-300' : 'text-gray-400'; |
| 20782 | const reason = selectedEntry.reason ? ` • ${formatInterfaceReason(selectedEntry.reason)}` : ''; |
| 20783 | const ssidLabel = selectedEntry.connected_ssid ? escapeHtml(selectedEntry.connected_ssid) : 'No SSID'; |
| 20784 | markup = ` |
| 20785 | <div class="flex items-center justify-between gap-2"> |
| 20786 | <div class="flex items-center gap-2 text-gray-100"> |
| 20787 | <span class="font-semibold text-xs">${escapeHtml(selectedEntry.name || 'iface')}</span> |
| 20788 | <span class="text-[10px] px-2 py-0.5 rounded ${roleClass}">${formatInterfaceRole(selectedEntry.role)}</span> |
| 20789 | </div> |
| 20790 | <div class="text-right leading-tight text-[11px] ${scanClass}"> |
| 20791 | <div>${ssidLabel}</div> |
| 20792 | <div class="text-[10px] text-gray-400">${scanLabel}${reason}</div> |
| 20793 | </div> |
| 20794 | </div> |
| 20795 | `; |
| 20796 | } |
| 20797 | container.innerHTML = markup; |
| 20798 | |
| 20799 | // Update connectivity indicator for selected interface |
| 20800 | const anyConnected = !!selectedEntry && selectedEntry.connected; |
| 20801 | const fallbackSsid = selectedEntry ? selectedEntry.connected_ssid : (statusData && statusData.current_ssid); |
| 20802 | const apMode = Boolean(statusData && statusData.ap_mode_active); |
| 20803 | updateConnectivityIndicator('wifi-status', anyConnected || Boolean(statusData && statusData.wifi_connected), fallbackSsid, apMode); |
| 20804 | renderDashboardInterfaceSwitch(state); |
| 20805 | } |
| 20806 | |
| 20807 | function renderConnectTabMultiInterface(state) { |
| 20808 | const summaryEl = document.getElementById('wifi-multi-status-summary'); |
| 20809 | const listEl = document.getElementById('wifi-multi-interface-list'); |
| 20810 | const pillEl = document.getElementById('wifi-multi-global-pill'); |
| 20811 | const noteEl = document.getElementById('wifi-multi-limit-note'); |
| 20812 | if (!summaryEl || !listEl || !pillEl) { |
| 20813 | return; |
| 20814 | } |
| 20815 | |
| 20816 | if (!state) { |
| 20817 | pillEl.textContent = 'Unavailable'; |
| 20818 | pillEl.className = 'text-xs px-2 py-1 rounded bg-red-700 text-red-200'; |
no test coverage detected