Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(ui): rank path targets by name and name the active step

Bernhard Jackiewicz4cb8d6dd5047
diff --git a/graph-ui/src/galaxy/PathLayer.tsx b/graph-ui/src/galaxy/PathLayer.tsx
index 1c514cbdd..4a463bb83 100644
--- a/graph-ui/src/galaxy/PathLayer.tsx
+++ b/graph-ui/src/galaxy/PathLayer.tsx
@@ -5,8 +5,8 @@
* Farbe ihrer Art und ohne Tiefentest, damit sie im abgedunkelten Rest nicht
* verschwinden. Ihre Art steht als Beschriftung daneben, und nur an ihnen:
* eine Beschriftung an jeder Kante waere bei hundert Kanten kein Text mehr.
- * Der Schritt, auf dem der Leser steht, ist heller und traegt einen Ring an
- * seinem Ziel. Gezeichnet wird an den Positionen, die die Szene wirklich
+ * Der Schritt, auf dem der Leser steht, ist heller und traegt einen Ring samt
+ * Namen an seinem Ziel. Gezeichnet wird an den Positionen, die die Szene wirklich
* zeichnet, also nach der Trennung auf dem Schirm.
*/
import { useEffect, useMemo } from 'react';
@@ -60,6 +60,7 @@ export function PathLayer({ nodes, path }: { nodes: readonly GraphNode[]; path:
<Html position={[goal.to.x, goal.to.y, goal.to.z]} zIndexRange={[10, 0]} style={{ pointerEvents: 'none' }}>
<span className="atlas-galaxy-path-step" data-testid="atlas-galaxy-path-step" data-node={goal.to.id}>
<i aria-hidden="true" />
+ <b>{goal.to.name}</b>
</span>
</Html>
)}
diff --git a/graph-ui/src/galaxy/ScopePathControls.test.tsx b/graph-ui/src/galaxy/ScopePathControls.test.tsx
index c4a41db53..471836490 100644
--- a/graph-ui/src/galaxy/ScopePathControls.test.tsx
+++ b/graph-ui/src/galaxy/ScopePathControls.test.tsx
@@ -26,7 +26,8 @@ it('searches only the loaded scope, sorted by name, and closes after a pick', as
const names = () => [...host.querySelectorAll('li strong')].map(entry => entry.textContent);
expect(names()).toEqual(['as_sql', 'resolve', 'save']);
await type(host.querySelector<HTMLInputElement>('input[aria-label="Find a path target"]')!, 'save');
- expect(names()).toEqual(['resolve', 'save']);
+ // A name match ranks above a match in the file path.
+ expect(names()).toEqual(['save', 'resolve']);
await type(host.querySelector<HTMLInputElement>('input')!, 'nothing');
expect(host.textContent).toContain('No matching node in the loaded scope.');
await type(host.querySelector<HTMLInputElement>('input')!, 'sql');
diff --git a/graph-ui/src/galaxy/ScopePathControls.tsx b/graph-ui/src/galaxy/ScopePathControls.tsx
index caf5539fc..2cf4e251a 100644
--- a/graph-ui/src/galaxy/ScopePathControls.tsx
+++ b/graph-ui/src/galaxy/ScopePathControls.tsx
@@ -18,9 +18,14 @@ export function PathPicker({ nodes, onPick }: { nodes: readonly GraphNode[]; onP
const details = useRef<HTMLDetailsElement>(null);
const matches = useMemo(() => {
const needle = query.trim().toLocaleLowerCase();
+ // Name matches first, as in the node search: exact, prefix, anywhere, then path or qualified name.
+ const rank = (node: GraphNode) => {
+ const name = node.name.toLocaleLowerCase();
+ return name === needle ? 0 : name.startsWith(needle) ? 1 : name.includes(needle) ? 2 : 3;
+ };
return nodes.filter(node => !needle || [node.name, node.qualified_name, node.file_path]
.some(value => value?.toLocaleLowerCase().includes(needle)))
- .sort((a, b) => a.name.localeCompare(b.name) || a.id - b.id);
+ .sort((a, b) => rank(a) - rank(b) || a.name.localeCompare(b.name) || a.id - b.id);
}, [nodes, query]);
return <details ref={details} className="atlas-graph-path-picker" onKeyDown={closeOnEscape}>
<summary title={text.pathToTitle}>{text.pathTo}</summary>
diff --git a/graph-ui/src/galaxy/graph-exploration.css b/graph-ui/src/galaxy/graph-exploration.css
index 17fc8826a..cbec96aa6 100644
--- a/graph-ui/src/galaxy/graph-exploration.css
+++ b/graph-ui/src/galaxy/graph-exploration.css
@@ -73,3 +73,4 @@
.atlas-galaxy-root-marker { position:relative; display:block; width:0; height:0; pointer-events:none; }
.atlas-galaxy-root-marker > i { position:absolute; left:-15px; top:-15px; width:30px; height:30px; box-sizing:border-box; border:2px solid #f0cf73; border-radius:50%; box-shadow:0 0 0 4px rgba(240, 207, 115, .16), 0 0 16px rgba(240, 207, 115, .5); }
.atlas-galaxy-root-marker > b { position:absolute; top:19px; left:0; transform:translateX(-50%); padding:1px 6px; border-radius:4px; background:rgba(13, 15, 18, .84); color:#f5e2a6; font:600 12px/1.4 var(--atlas-ui-font, system-ui, sans-serif); white-space:nowrap; }
+.atlas-galaxy-path-step > b { position:absolute; bottom:15px; left:0; transform:translateX(-50%); padding:1px 6px; border-radius:4px; background:rgba(13, 15, 18, .84); color:#cfeedd; font:600 12px/1.4 var(--atlas-ui-font, system-ui, sans-serif); white-space:nowrap; }