Add interface error counts to port bubble hover
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -137,6 +137,23 @@
|
|||||||
color: #f99;
|
color: #f99;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.node .switch-port .error-info,
|
||||||
|
.node .uplink .error-info {
|
||||||
|
display: none;
|
||||||
|
font-size: 8px;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node .switch-port:hover .error-info,
|
||||||
|
.node .uplink:hover .error-info {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node .switch-port:hover,
|
||||||
|
.node .uplink:hover {
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
.node .uplink {
|
.node .uplink {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -8px;
|
top: -8px;
|
||||||
@@ -678,6 +695,16 @@
|
|||||||
return iface.stats?.speed || 0;
|
return iface.stats?.speed || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getInterfaceErrors(node) {
|
||||||
|
if (!node.interfaces || node.interfaces.length === 0) return null;
|
||||||
|
const iface = node.interfaces[0];
|
||||||
|
if (!iface.stats) return null;
|
||||||
|
const inErr = iface.stats.in_errors || 0;
|
||||||
|
const outErr = iface.stats.out_errors || 0;
|
||||||
|
if (inErr === 0 && outErr === 0) return null;
|
||||||
|
return { in: inErr, out: outErr };
|
||||||
|
}
|
||||||
|
|
||||||
let anonCounter = 0;
|
let anonCounter = 0;
|
||||||
|
|
||||||
function buildLocationTree(locations, parent) {
|
function buildLocationTree(locations, parent) {
|
||||||
@@ -773,6 +800,12 @@
|
|||||||
}
|
}
|
||||||
const speedClass = getSpeedClass(switchConnection.speed);
|
const speedClass = getSpeedClass(switchConnection.speed);
|
||||||
if (speedClass) portEl.classList.add(speedClass);
|
if (speedClass) portEl.classList.add(speedClass);
|
||||||
|
const errIn = switchConnection.errors?.in || 0;
|
||||||
|
const errOut = switchConnection.errors?.out || 0;
|
||||||
|
const errInfo = document.createElement('div');
|
||||||
|
errInfo.className = 'error-info';
|
||||||
|
errInfo.textContent = 'err: ' + errIn + '/' + errOut;
|
||||||
|
portEl.appendChild(errInfo);
|
||||||
div.appendChild(portEl);
|
div.appendChild(portEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -791,6 +824,12 @@
|
|||||||
uplinkEl.textContent = uplinkInfo.localPort + ' → ' + uplinkInfo.parentName + ':' + uplinkInfo.remotePort;
|
uplinkEl.textContent = uplinkInfo.localPort + ' → ' + uplinkInfo.parentName + ':' + uplinkInfo.remotePort;
|
||||||
const speedClass = getSpeedClass(uplinkInfo.speed);
|
const speedClass = getSpeedClass(uplinkInfo.speed);
|
||||||
if (speedClass) uplinkEl.classList.add(speedClass);
|
if (speedClass) uplinkEl.classList.add(speedClass);
|
||||||
|
const errIn = uplinkInfo.errors?.in || 0;
|
||||||
|
const errOut = uplinkInfo.errors?.out || 0;
|
||||||
|
const errInfo = document.createElement('div');
|
||||||
|
errInfo.className = 'error-info';
|
||||||
|
errInfo.textContent = 'err: ' + errIn + '/' + errOut;
|
||||||
|
uplinkEl.appendChild(errInfo);
|
||||||
div.appendChild(uplinkEl);
|
div.appendChild(uplinkEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,7 +1089,9 @@
|
|||||||
portA: link.interface_a || '?',
|
portA: link.interface_a || '?',
|
||||||
portB: link.interface_b || '?',
|
portB: link.interface_b || '?',
|
||||||
speedA: getInterfaceSpeed(link.node_a),
|
speedA: getInterfaceSpeed(link.node_a),
|
||||||
speedB: getInterfaceSpeed(link.node_b)
|
speedB: getInterfaceSpeed(link.node_b),
|
||||||
|
errorsA: getInterfaceErrors(link.node_a),
|
||||||
|
errorsB: getInterfaceErrors(link.node_b)
|
||||||
});
|
});
|
||||||
} else if (aIsSwitch && !bIsSwitch) {
|
} else if (aIsSwitch && !bIsSwitch) {
|
||||||
const nodeLoc = nodeLocations.get(nodeB.typeid);
|
const nodeLoc = nodeLocations.get(nodeB.typeid);
|
||||||
@@ -1059,7 +1100,8 @@
|
|||||||
port: link.interface_a || '?',
|
port: link.interface_a || '?',
|
||||||
switchName: getLabel(nodeA),
|
switchName: getLabel(nodeA),
|
||||||
external: !effectiveSwitch || effectiveSwitch.typeid !== nodeA.typeid,
|
external: !effectiveSwitch || effectiveSwitch.typeid !== nodeA.typeid,
|
||||||
speed: getInterfaceSpeed(link.node_a)
|
speed: getInterfaceSpeed(link.node_a),
|
||||||
|
errors: getInterfaceErrors(link.node_a)
|
||||||
});
|
});
|
||||||
} else if (bIsSwitch && !aIsSwitch) {
|
} else if (bIsSwitch && !aIsSwitch) {
|
||||||
const nodeLoc = nodeLocations.get(nodeA.typeid);
|
const nodeLoc = nodeLocations.get(nodeA.typeid);
|
||||||
@@ -1068,7 +1110,8 @@
|
|||||||
port: link.interface_b || '?',
|
port: link.interface_b || '?',
|
||||||
switchName: getLabel(nodeB),
|
switchName: getLabel(nodeB),
|
||||||
external: !effectiveSwitch || effectiveSwitch.typeid !== nodeB.typeid,
|
external: !effectiveSwitch || effectiveSwitch.typeid !== nodeB.typeid,
|
||||||
speed: getInterfaceSpeed(link.node_b)
|
speed: getInterfaceSpeed(link.node_b),
|
||||||
|
errors: getInterfaceErrors(link.node_b)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1123,13 +1166,15 @@
|
|||||||
neighbor: link.switchB,
|
neighbor: link.switchB,
|
||||||
localPort: link.portA,
|
localPort: link.portA,
|
||||||
remotePort: link.portB,
|
remotePort: link.portB,
|
||||||
localSpeed: link.speedA
|
localSpeed: link.speedA,
|
||||||
|
localErrors: link.errorsA
|
||||||
});
|
});
|
||||||
adjacency.get(link.switchB.typeid).push({
|
adjacency.get(link.switchB.typeid).push({
|
||||||
neighbor: link.switchA,
|
neighbor: link.switchA,
|
||||||
localPort: link.portB,
|
localPort: link.portB,
|
||||||
remotePort: link.portA,
|
remotePort: link.portA,
|
||||||
localSpeed: link.speedB
|
localSpeed: link.speedB,
|
||||||
|
localErrors: link.errorsB
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1183,7 +1228,8 @@
|
|||||||
localPort: edge.localPort,
|
localPort: edge.localPort,
|
||||||
remotePort: edge.remotePort,
|
remotePort: edge.remotePort,
|
||||||
parentName: getLabel(current),
|
parentName: getLabel(current),
|
||||||
speed: edge.localSpeed
|
speed: edge.localSpeed,
|
||||||
|
errors: edge.localErrors
|
||||||
});
|
});
|
||||||
queue.push(edge.neighbor);
|
queue.push(edge.neighbor);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user