Add clickable links for node types and edge types in schema explorer details panel#1731
Open
Add clickable links for node types and edge types in schema explorer details panel#1731
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1542.
Summary
Makes the vertex types and edge type rendered in
EdgeConnectionRowclickable. Clicking a vertex type or edge type updates the schema graph selection to that item, keeping both the sidebar details and the graph view highlight in sync.Changes
Details.tsxVertexTypeTextandEdgeTypeTextaccept an optionalonClickprop. When provided, they render as<button type="button">withfocus-visiblestyles for keyboard support; otherwise they remain<span>s with no behavior change.EdgeConnectionRowaccepts an optionalonSelectionChange: (item: SchemaGraphSelectionItem) => void. When provided, it builds click handlers for the source vertex, edge type, and target vertex that invokeonSelectionChangewith the appropriate selection item (usingcreateEdgeConnectionIdfor the edge case).NodeLabelDetails.tsx,EdgeConnectionDetails.tsxonSelectionChangetoEdgeConnectionRow.SchemaDetailsContent.tsx,SchemaExplorerSidebar.tsxonSelectionChangedown the tree.SchemaGraph.tsxhandleSidebarSelectionChangethat updates bothselection(SchemaGraphSelection) andgraphSelection(SelectedElements), keeping the graph view highlight in sync as required by the issue.Behavior notes
onSelectionChangeis optional everywhere it is threaded. Components rendered without it behave exactly as before (no buttons, no behavior change).<button>elements withfocus-visible:ring, working with keyboard (Tab/Enter/Space) and screen readers.hover:text-text-primary) and focus rings are added on top of the existing underline/italic styles.onSelectionChange(matching the example in the issue's implementation notes) instead ofonSelectto avoid clashing with the ReactonSelectevent handler that components extendingComponentPropsWithRef<typeof Panel>already inherit.Tests
Added five behavior tests in
Details.test.tsx:EdgeConnectionRowwithoutonSelectionChangerenders no buttons (back-compat).onSelectionChange, renders three buttons (source vertex / edge type / target vertex).onSelectionChangewith{ type: "vertex-type", id: <source> }.onSelectionChangewith{ type: "vertex-type", id: <target> }.onSelectionChangewith{ type: "edge-connection", id: <edgeConnectionId> }.Verification
pnpm exec vitest run packages/graph-explorer/src/modules/SchemaGraph/Sidebar/Details.test.tsx— 8/8 passing.pnpm exec tsc --noEmit(inpackages/graph-explorer) — clean.pnpm exec eslint packages/graph-explorer/src/modules/SchemaGraph/— clean.pnpm exec prettier --checkon the seven changed files — clean.