diff --git a/src/webui/static/css/style.css b/src/webui/static/css/style.css index 6fdbe6f5..37e24315 100644 --- a/src/webui/static/css/style.css +++ b/src/webui/static/css/style.css @@ -3020,6 +3020,14 @@ details.cfg-fold[open] > summary::before { transform: rotate(90deg); } background: var(--border-subtle); color: var(--primary); } +/* Currently-selected node: set on click and when arriving via a status-page + "Configure →" deep link, so the left tree shows where the right pane is. */ +.yt-label.yt-active { + background: var(--border-subtle); + color: var(--primary); + font-weight: 600; + box-shadow: inset 2px 0 0 var(--primary); +} /* Chevron rotates on open */ .yt-chevron { diff --git a/src/webui/static/js/app.js b/src/webui/static/js/app.js index 19d9425e..9b5a946a 100644 --- a/src/webui/static/js/app.js +++ b/src/webui/static/js/app.js @@ -1878,6 +1878,89 @@ function openModal(message, onConfirm) { }, true); })(); +// ─── YANG tree: selected-node highlight + deep-link reveal ────────────────── +// Two related orientation fixes for the tree editor: +// 1. Clicking a node loads it in the right pane but left no cue of where you +// are — mark the clicked summary .yt-active. +// 2. A status-page "Configure →" deep link (/configure/tree?path=…) only +// filled the right pane, leaving the left tree collapsed and the user +// disoriented. Walk the ancestor chain, opening each
in turn — +// children load lazily over htmx on toggle, so wait for each level's swap +// before descending — then highlight and scroll the target into view. +(function() { + function setActive(summary) { + document.querySelectorAll('.yt-label.yt-active').forEach(function (s) { + if (s !== summary) s.classList.remove('yt-active'); + }); + if (summary) summary.classList.add('yt-active'); + } + + document.addEventListener('click', function (e) { + var summary = e.target.closest && e.target.closest('summary[data-yang-path]'); + if (summary) setActive(summary); + }); + + // Load a node's children into its .yt-children with a direct htmx.ajax + // request, resolving with the children