Add remove button for unreachable nodes not in config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ian Gulliver
2026-02-02 11:18:06 -08:00
parent d4e7a8a9b7
commit eff2635725
7 changed files with 164 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
import { getLabel, getShortLabel, getFirstName, isSwitch, getSpeedClass } from './nodes.js';
import { addClickableValue, buildLinkStats, buildDanteDetail, buildClickableList } from './ui.js';
import { addClickableValue, buildLinkStats, buildDanteDetail, buildClickableList, removeNode } from './ui.js';
import { nodeElements, locationElements, usedNodeIds, usedLocationIds } from './state.js';
export function createNodeElement(node, switchConnection, nodeLocation, uplinkInfo, danteInfo, artnetInfo, sacnInfo, hasError, isUnreachable) {
@@ -307,6 +307,24 @@ export function createNodeElement(node, switchConnection, nodeLocation, uplinkIn
if (container) container.remove();
}
if (node.unreachable && !node.in_config) {
let removeBtn = div.querySelector(':scope > .remove-node-btn');
if (!removeBtn) {
removeBtn = document.createElement('button');
removeBtn.className = 'remove-node-btn';
removeBtn.textContent = '×';
removeBtn.title = 'Remove node';
removeBtn.addEventListener('click', (e) => {
e.stopPropagation();
removeNode(node.id);
});
div.appendChild(removeBtn);
}
} else {
const removeBtn = div.querySelector(':scope > .remove-node-btn');
if (removeBtn) removeBtn.remove();
}
return div;
}