From ced0a6e59980b9256c57b3dc7b48e556e5986871 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Mon, 2 Feb 2026 22:17:50 -0800 Subject: [PATCH] Fix AP location and table root consistency - Only include APs in getSwitchesInLocation for AP sub-locations - Update table.js to include APs in switch graph like render.js Co-Authored-By: Claude Opus 4.5 --- static/js/table.js | 8 ++++---- static/js/topology.js | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/static/js/table.js b/static/js/table.js index 269e001..7687b9e 100644 --- a/static/js/table.js +++ b/static/js/table.js @@ -1,4 +1,4 @@ -import { getLabel, getFirstName, isSwitch, getInterfaceSpeed, getInterfaceErrors, getInterfaceRates, getInterfaceUptime, getInterfaceLastError } from './nodes.js'; +import { getLabel, getFirstName, isSwitch, isAP, getInterfaceSpeed, getInterfaceErrors, getInterfaceRates, getInterfaceUptime, getInterfaceLastError } from './nodes.js'; import { buildSwitchUplinks } from './topology.js'; import { escapeHtml, formatUniverse } from './format.js'; import { tableData, tableSortKeys, setTableSortKeys } from './state.js'; @@ -96,7 +96,7 @@ export function renderNetworkTable() { nodes.forEach(node => nodesByTypeId.set(node.id, node)); const upstreamConnections = new Map(); - const allSwitches = nodes.filter(n => isSwitch(n)); + const allSwitches = nodes.filter(n => isSwitch(n) || isAP(n)); const switchLinks = []; links.forEach(link => { @@ -104,8 +104,8 @@ export function renderNetworkTable() { const nodeB = nodesByTypeId.get(link.node_b_id); if (!nodeA || !nodeB) return; - const aIsSwitch = isSwitch(nodeA); - const bIsSwitch = isSwitch(nodeB); + const aIsSwitch = isSwitch(nodeA) || isAP(nodeA); + const bIsSwitch = isSwitch(nodeB) || isAP(nodeB); if (aIsSwitch && !bIsSwitch) { upstreamConnections.set(nodeB.id, { diff --git a/static/js/topology.js b/static/js/topology.js index b46f5c1..3b3ca3d 100644 --- a/static/js/topology.js +++ b/static/js/topology.js @@ -130,7 +130,8 @@ export function getSwitchesInLocation(loc, assignedNodes) { const switches = []; const nodes = assignedNodes.get(loc) || []; nodes.forEach(n => { - if (isSwitch(n) || isAP(n)) switches.push(n); + if (isSwitch(n)) switches.push(n); + if (isAP(n) && loc.isAPLocation) switches.push(n); }); loc.children.forEach(child => { if (child.anonymous || child.isAPLocation) {