From 0b46f5c582682f79cc09571c62f46300ce0eb8c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Tejero=20Cantero?= Date: Thu, 16 Jul 2026 17:31:21 +0200 Subject: [PATCH] :sparkles: Style Component nodes and IsInstanceOf edges in graph console MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Slice-3 export sends edges with a rel field. Derive tree ranking, combo derivation and fold-ability from IsChildOf only; draw other rels as overlay edges with per-rel styles (EDGE_STYLES: IsInstanceOf violet dashed, matching the new Component diamond in NODE_STYLES). Legend now lists only displayed node tables and rels, re-rendered per redraw; help text trimmed to essentials. Signed-off-by: Álvaro Tejero Cantero --- .../app/templates/graph-console.tmpl | 76 ++++++++++++++----- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/backend/resources/app/templates/graph-console.tmpl b/backend/resources/app/templates/graph-console.tmpl index b6e387eec3..837006f277 100644 --- a/backend/resources/app/templates/graph-console.tmpl +++ b/backend/resources/app/templates/graph-console.tmpl @@ -166,13 +166,9 @@ Graph Console - Renders the in-memory Ladybug graph with AntV G6 (CDN). Node color - and glyph encode the node table; edges are IsChildOf - (arrow points to parent). With "fold containers" on, anything with - children (except the root) renders as a foldable box: double-click - to collapse or expand. Redraws automatically after live changes - (fold state survives redraws). Very large graphs need an explicit - "Render anyway". + Live view of the in-memory Ladybug graph (AntV G6); the legend + shows what is displayed. Double-click folds containers when + folding is on.
' + '' + (GLYPH_CHARS[s.glyph] || "●") + ' ' + escapeHtml(table) + ""; - // join with a space: the spans are nowrap, so the separator is the - // only soft-wrap opportunity in the legend row - }).join(" "); + } + const items = Object.keys(NODE_STYLES) + .filter(function (t) { return tables[t]; }) + .map(function (t) { return nodeItem(t, NODE_STYLES[t]); }); + Object.keys(tables).sort().forEach(function (t) { + if (!NODE_STYLES[t]) items.push(nodeItem(t, FALLBACK_STYLE)); + }); + Object.keys(rels).sort().forEach(function (rel) { + const s = edgeStyle(rel); + items.push('' + + '' + + (s.lineDash ? "⇢" : "→") + ' ' + + escapeHtml(rel) + ""); + }); + // join with a space: the spans are nowrap, so the separator is the + // only soft-wrap opportunity in the legend row + el.innerHTML = items.join(" "); } function graphStatusText(data) { @@ -634,6 +676,7 @@ Graph Console function renderCurrent() { if (!lastGraphData) return; const data = filteredGraphData(); + renderGraphLegend(data); const anywayBtn = document.getElementById("graph-render-anyway"); const filterBtn = document.getElementById("graph-filter-reset"); if (filterBtn) filterBtn.style.display = graphFilterIds ? "inline" : "none"; @@ -1072,7 +1115,6 @@ Graph Console connect(); refreshSyncStatus(); - renderGraphLegend(); refetchGraph(); window.addEventListener("beforeunload", function () {