Update security.tsx

This commit is contained in:
MacRimi
2026-02-14 18:34:36 +01:00
parent 9f11238d43
commit f75e30afd0

View File

@@ -221,19 +221,17 @@ export function Security() {
const loadNetworkInterfaces = async () => { const loadNetworkInterfaces = async () => {
try { try {
console.log("[v0] Loading network interfaces...")
const data = await fetchApi("/api/network") const data = await fetchApi("/api/network")
console.log("[v0] Network API response:", JSON.stringify(data?.interfaces?.length), "interfaces found") // The API returns interfaces in separate arrays: physical_interfaces, bridge_interfaces, etc.
if (data.interfaces) { // The generic "interfaces" array only holds uncategorized types and is usually empty.
console.log("[v0] Interface types:", data.interfaces.map((i: any) => `${i.name}(${i.type})`).join(", ")) const all = [
const relevant = data.interfaces ...(data.physical_interfaces || []),
.filter((i: any) => ["physical", "bridge", "bond", "vlan"].includes(i.type)) ...(data.bridge_interfaces || []),
.sort((a: any, b: any) => a.name.localeCompare(b.name)) ...(data.interfaces || []),
console.log("[v0] Filtered interfaces:", relevant.map((i: any) => i.name).join(", ")) ].sort((a: any, b: any) => a.name.localeCompare(b.name))
setNetworkInterfaces(relevant) setNetworkInterfaces(all)
} } catch {
} catch (err) { // Silently fail - select will just show "Any interface"
console.log("[v0] Error loading network interfaces:", err)
} }
} }