fix(export): colour and filter graph.html edges by relation - #2237
Open
SyedFahad7 wants to merge 2 commits into
Open
fix(export): colour and filter graph.html edges by relation#2237SyedFahad7 wants to merge 2 commits into
SyedFahad7 wants to merge 2 commits into
Conversation
Every edge was drawn the same, so calls drowned in contains/imports. Add a Connection Types sidebar (off-by-default colouring, per-relation checkboxes, localStorage + GRAPHIFY_EDGE_TYPES / edge_types=). Also scope toggleAllCommunities to #legend so a second panel cannot steal its state. Fixes Graphify-Labs#2088
There was a problem hiding this comment.
Pull request overview
This PR updates the HTML exporter (graph.html) to make edge relations visually distinguishable and filterable, addressing #2088 by adding a “Connection Types” sidebar panel and per-relation coloring (opt-in by default).
Changes:
- Add a Connection Types panel to color edges by relation and toggle relation visibility; initial coloring state is controlled via
localStorageandGRAPHIFY_EDGE_TYPES/to_html(edge_types=...). - Scope
toggleAllCommunitiesDOM queries to#legendto prevent unintended checkbox manipulation in other panels. - Sanitize edge relation labels on export and propagate them into the embedded JSON for safe client-side use.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
483
to
+487
| community_labels: dict[int, str] | None = None, | ||
| member_counts: dict[int, int] | None = None, | ||
| node_limit: int | None = None, | ||
| learning_overlay: dict | None = None, | ||
| edge_types: bool | None = None, |
Contributor
Author
There was a problem hiding this comment.
fair — pushed a small follow-up covering panel present/absent + edge_types / GRAPHIFY_EDGE_TYPES defaults.
Assert the panel ships on normal graphs, stays off for aggregated views, and that edge_types= / GRAPHIFY_EDGE_TYPES set EDGE_TYPES_COLOR_DEFAULT.
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
Fixes #2088.
graph.htmldrew every edge the same, so you had to hover to tellcallsfromcontains/imports. Adds a Connection Types panel next to the community legend: colour swatch, count, checkbox per relation. Colouring is off by default (localStorage+GRAPHIFY_EDGE_TYPES/edge_types=to start on). Untick everything butcallsand you get the call graph.Also scopes
toggleAllCommunitiesto#legendso a second panel cannot get its checkboxes rewritten. Skipped on the aggregated >node-limit view.Test plan
graph.html— Connection Types panel present, edges look like before until you enable colouringcontains/imports— call graph readablelocalStorageuv run pytest tests/test_export.py -q -k to_html