Support readable node labels in interactive graph viewer#78
Merged
Conversation
Node display labels (e.g. readable voltage-level names like "Saucats 400kV") are now usable in the interactive HTML viewer beyond just the rendered text: - Search matches both the stable id (data-name) and the readable label (data-attr-label), so a node can be found by either spelling. - Hover tooltip and selection panel show the readable name as the header, with the raw id underneath only when it differs. - fmtAttrs gains an optional skip list to avoid duplicating the label in the node attribute list. Node identity (SVG <title> / data-name) is unchanged, so selection, adjacency highlight and double-click SLD resolution keep using the id. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SxDmpV5a1RZBgPd8gAuSvy
- Fix: label-less nodes carry the Graphviz "\N" placeholder in their label attribute; nodeDisplayName now ignores any backslash escape and falls back to the stable id, so tooltips/search never surface a literal "\N". Search uses the resolved display name. - More tests: search consults id + resolved display name; tooltip/ selection skip the duplicated label attribute; label-less nodes fall back to the id (no \N leak); readable label surfaces without losing id. - Bump version to 0.3.2.post4 (setup.py + download_url). - CHANGELOG: document the readable-node-name viewer feature, the \N fix and the tests under [0.3.2.post4]. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SxDmpV5a1RZBgPd8gAuSvy
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.
Summary
Enhance the interactive HTML graph viewer to display readable node labels (e.g., voltage-level names like "Saucats 400kV") while preserving the stable node identity for selection, adjacency, and resolution logic. This improves operator experience by showing human-friendly names without breaking the underlying graph mechanics.
Key Changes
nodeDisplayName(el): Returns the readable label if present, otherwise falls back to the stable node idnodeHeaderHtml(el): Generates a formatted header showing the readable name in bold, with the raw id shown underneath only when it differsdata-name(stable id) anddata-attr-label(readable label), allowing operators to find nodes by either spellinglabelattribute from the attribute list display (since it's now shown in the header)test_readable_node_label_surfaces_without_losing_id: Verifies that readable labels are exposed and rendered while node identity is preservedtest_search_matches_readable_label_and_id: Confirms search functionality works with both label and id attributesImplementation Details
fmtAttrs()function now accepts an optionalskipparameter to exclude specific attributes from the formatted output (used to hidelabelfrom the attribute list since it's displayed in the header)data-name) remains the canonical identifier for all graph operations;data-attr-labelis purely for displayhttps://claude.ai/code/session_01SxDmpV5a1RZBgPd8gAuSvy