diff --git a/README.md b/README.md
index 535c957..a4b68a0 100644
--- a/README.md
+++ b/README.md
@@ -278,7 +278,9 @@ interface and port names, and LLDP neighbors.
- **Hardware drawing** (hosts, modem, AP): a server shows the same front the rack page draws, from its
cutsheet item's *Front drawing* (a ZimaBoard's NIC lights follow its interfaces), with where it sits
("U5-U8, full depth", "Rear shelf (U22-U23), slot 1") linking to the rack page; Overview lists the
- location too. A host with no cutsheet item, or one with no Front drawing, shows no picture. The
+ location too. On drawings that show NICs (the ZimaBoards' RJ45 jacks and ConnectX-3 SFP+ cage),
+ hovering a port highlights its interface row and hovering a row rings its port; clicking a port
+ (or Enter on it) opens that row. A host with no cutsheet item, or one with no Front drawing, shows no picture. The
modem and AP use the drawings from the topology page.
- **Interfaces / Ports**: one row each with state, speed, RX/TX rate, and neighbor, filterable.
Expanding a host's row shows duplex, auto-negotiation, carrier changes, error and drop rates,
diff --git a/static/device.js b/static/device.js
index cb33683..0e9e0b8 100644
--- a/static/device.js
+++ b/static/device.js
@@ -11,6 +11,7 @@ const _openRows = new Set(); // survives auto-refresh
let _filter = 'all';
let _query = '';
let _device = null;
+let _hotIface = null; // the interface hovered in the drawing or the table
// ── Formatting ───────────────────────────────────────────────────────
function fmtSpeed(mbps) {
@@ -190,7 +191,7 @@ function renderTable(rows) {
? (r.neighbor.name ? `${esc(r.neighbor.name)} ` : esc(r.neighbor.chassis || r.neighbor.port || ''))
: '-';
return `
-
+
${open ? '▾' : '▸'}
${r.num !== undefined ? `#${esc(r.num)} ` : ''}${esc(r.label)}${esc(r.sub)}
@@ -401,6 +402,59 @@ function hardwareHtml(d, art) {
`;
}
+// ── Drawing <-> table: a NIC drawn in the picture and its row light up together ──
+function setHotIface(name) {
+ if (name === _hotIface) return;
+ _hotIface = name;
+ document.querySelectorAll('#device-chassis .hw-port').forEach(el => el.classList.toggle('is-hot', el.dataset.iface === name));
+ document.querySelectorAll('tr.device-row[data-iface]').forEach(el => el.classList.toggle('is-linked', el.dataset.iface === name));
+}
+
+// Clicking a drawn port opens its row and brings it into view
+function openIfaceRow(name) {
+ const row = () => [...document.querySelectorAll('tr.device-row[data-iface]')].find(el => el.dataset.iface === name);
+ if (!row()) {
+ lt.toast.info(`${name} is not in the interface list`);
+ return;
+ }
+ if (_filter !== 'all' || _query) {
+ // A filter that hides the row would make the click look like it did nothing
+ _filter = 'all';
+ _query = '';
+ document.getElementById('device-table-search').value = '';
+ document.querySelectorAll('[data-device-filter]').forEach(p => {
+ const on = p.dataset.deviceFilter === 'all';
+ p.classList.toggle('active', on);
+ p.setAttribute('aria-pressed', String(on));
+ });
+ }
+ _openRows.add(name);
+ renderInterfaces();
+ const el = row();
+ if (el) {
+ el.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
+ el.querySelector('.device-row-toggle').focus({ preventScroll: true });
+ }
+}
+
+function hotFrom(e) {
+ const port = e.target.closest('#device-chassis .hw-port');
+ if (port) return port.dataset.iface;
+ const row = e.target.closest('tr.device-row[data-iface], tr.device-row-detail');
+ if (!row) return null;
+ return row.dataset.iface || (row.previousElementSibling && row.previousElementSibling.dataset.iface) || null;
+}
+
+document.addEventListener('mouseover', e => setHotIface(hotFrom(e)));
+document.addEventListener('focusin', e => setHotIface(hotFrom(e)));
+document.addEventListener('keydown', e => {
+ const port = e.target.closest && e.target.closest('#device-chassis .hw-port');
+ if (port && (e.key === 'Enter' || e.key === ' ')) {
+ e.preventDefault();
+ openIfaceRow(port.dataset.iface);
+ }
+});
+
// ── Inventory (HomeBox) link ────────────────────────────────────────────
function inventoryActions(d) {
const inv = d.inventory || {};
@@ -489,7 +543,15 @@ function render(d) {
document.getElementById('device-inspector').classList.toggle('has-chassis', hasChassis);
updateInterfaceSection(currentRows(), d.ports ? 'Ports' : 'Interfaces', hasChassis);
if (hasFaceplate) renderPortInspector(d);
- else if (art) document.getElementById('device-chassis').innerHTML = hardwareHtml(d, art);
+ else if (art) {
+ document.getElementById('device-chassis').innerHTML = hardwareHtml(d, art);
+ document.querySelectorAll('#device-chassis .hw-port').forEach(el => {
+ el.setAttribute('tabindex', '0');
+ el.setAttribute('role', 'button');
+ el.setAttribute('aria-label', `${el.querySelector('title').textContent}: show in the interface list`);
+ el.classList.toggle('is-hot', el.dataset.iface === _hotIface);
+ });
+ }
// A drawing has no ports to open, so the port panel takes no room beside it
document.getElementById('inspector-panel').style.display = hasFaceplate ? '' : 'none';
renderInterfaces();
@@ -516,6 +578,11 @@ async function loadDevice() {
}
document.addEventListener('click', e => {
+ const drawn = e.target.closest('#device-chassis .hw-port');
+ if (drawn) {
+ openIfaceRow(drawn.dataset.iface);
+ return;
+ }
// Switch and router rows open the shared port panel, except when following a link
const portRow = e.target.closest('tr.device-row[data-port-idx]');
if (portRow && !e.target.closest('a')) {
diff --git a/static/fronts.js b/static/fronts.js
index 1321c6f..2740faa 100644
--- a/static/fronts.js
+++ b/static/fronts.js
@@ -265,6 +265,16 @@ function zimaRj45(x, y, link) {
`;
}
+// A NIC's socket as one hoverable part: the device page ties it to that interface's table row.
+// box is [x, y, w, h] for the highlight ring drawn around it.
+function nicPort(ctx, name, box, inner) {
+ const n = (ctx.interfaces || []).find(i => i.name === name);
+ const state = n ? (n.unused ? 'marked unused' : (n.up ? 'link up' : 'no link')) : 'not reported';
+ const [x, y, w, h] = box;
+ return `${lt.escHtml(`${name} · ${state}`)}
+ ${inner} `;
+}
+
function zimaUsb(x, y) {
return `
@@ -298,7 +308,8 @@ function zimaFront(ctx) {
- ${zimaRj45(213, 47, link(0))}${zimaRj45(443, 47, link(1))}
+ ${nicPort(ctx, ZIMA_NICS.rj45[0], [213, 47, 207, 143], zimaRj45(213, 47, link(0)))}
+ ${nicPort(ctx, ZIMA_NICS.rj45[1], [443, 47, 207, 143], zimaRj45(443, 47, link(1)))}
${zimaUsb(216, 205)}${zimaUsb(443, 205)}
@@ -314,7 +325,7 @@ function zimaFront(ctx) {
// The round dot on the cage is Gandalf's link mark (like the cutsheet marks), not an LED on the card.
const CX3_PX = 572;
-function cx3Card(up) {
+function cx3Card(up, port) {
return `
@@ -323,17 +334,19 @@ function cx3Card(up) {
${Array.from({ length: 9 }, (_, i) => ` `).join('')}
-
+ ${port(`
- Gandalf: SFP+ link ${up ? 'up' : 'down'} `;
+ `)}`;
}
function zimaCx3Front(ctx) {
- return `${cx3Card(zimaNic(ctx, (ctx.interfaces || []).map(i => i.name).find(n => ZIMA_NICS.slot.test(n)) || 'enp1s0'))}
+ const name = (ctx.interfaces || []).map(i => i.name).find(n => ZIMA_NICS.slot.test(n)) || 'enp1s0';
+ const port = inner => nicPort(ctx, name, [380, 190, 150, 214], inner);
+ return `${cx3Card(zimaNic(ctx, name), port)}
${zimaFront(ctx)} `;
}
diff --git a/static/style.css b/static/style.css
index afd162a..ca4e354 100644
--- a/static/style.css
+++ b/static/style.css
@@ -947,6 +947,12 @@ tr.device-row.is-selected { background: var(--bg-tertiary); box-shadow: inset 3p
.hw-art { margin: 0 auto; padding: 16px; box-sizing: content-box; }
.hw-box { width: 100%; }
.hw-box svg { display: block; width: 100%; height: 100%; }
+/* A NIC in a drawing: its ring lights with the matching table row (device.js setHotIface) */
+.hw-port-ring { fill: none; stroke: transparent; stroke-width: 6; pointer-events: none; }
+.device-chassis .hw-port { cursor: pointer; outline: none; }
+.device-chassis .hw-port.is-hot .hw-port-ring { stroke: var(--terminal-cyan, #0ff); filter: drop-shadow(0 0 6px var(--terminal-cyan, #0ff)); }
+.device-chassis .hw-port:focus-visible .hw-port-ring { stroke: var(--amber); }
+tr.device-row.is-linked { background: var(--bg-tertiary); box-shadow: inset 3px 0 0 var(--terminal-cyan, #0ff); }
.hw-specs { margin: 0; padding: 0 16px 12px; font-size: .72em; color: var(--text-muted); text-align: center; }
.chassis-meta .device-link { font-size: inherit; }