()
| 15859 | return selectedWifiInterface; |
| 15860 | } |
| 15861 | return null; |
| 15862 | } |
| 15863 | |
| 15864 | function getNetworkSlugForInterface(interfaceName) { |
| 15865 | if (!interfaceName) { |
| 15866 | return null; |
| 15867 | } |
| 15868 | const meta = Array.isArray(wifiInterfaceMetadata) |
| 15869 | ? wifiInterfaceMetadata.find(entry => entry && entry.name === interfaceName) |
| 15870 | : null; |
| 15871 | if (!meta) { |
| 15872 | return null; |
| 15873 | } |
| 15874 | if (meta.network_slug) { |
| 15875 | return meta.network_slug; |
| 15876 | } |
| 15877 | if (meta.connected_ssid) { |
| 15878 | return slugifyNetworkIdentifier(meta.connected_ssid); |
| 15879 | } |
| 15880 | return null; |
| 15881 | } |
| 15882 | |
| 15883 | function getSelectedDashboardNetworkKey() { |
| 15884 | const iface = getActiveWifiInterface(); |
| 15885 | const slug = getNetworkSlugForInterface(iface); |
| 15886 | if (slug) { |
| 15887 | return { interface: iface, network: slug }; |
| 15888 | } |
| 15889 | return { interface: iface, network: null }; |
| 15890 | } |
| 15891 | |
| 15892 | function updateWifiInterfaceSwitchActiveState(activeInterface) { |
| 15893 | const buttonsContainer = document.getElementById('wifi-interface-switch-buttons'); |
| 15894 | if (!buttonsContainer) return; |
| 15895 | const buttons = buttonsContainer.querySelectorAll('button[data-interface]'); |
| 15896 | buttons.forEach(button => { |
| 15897 | const isActive = button.dataset.interface === activeInterface; |
| 15898 | button.classList.remove('bg-Ragnar-600', 'border-Ragnar-400', 'text-white', 'shadow-lg', 'bg-slate-800', 'border-slate-600', 'text-gray-300'); |
| 15899 | if (isActive) { |
| 15900 | button.classList.add('bg-Ragnar-600', 'border-Ragnar-400', 'text-white', 'shadow-lg'); |
| 15901 | } else { |
| 15902 | button.classList.add('bg-slate-800', 'border-slate-600', 'text-gray-300'); |
no test coverage detected