feat(dashboard): add file/class dual-view toggle to reduce graph clutter#132
Merged
Merged
Conversation
Add detailLevel state ("file" | "class") to separate architecture-level
file dependencies from code-structure class views. File view shows only
file nodes and file→file edges (imports/depends_on), eliminating ~85%
of nodes/edges that previously caused severe zoom/pan lag. Class view
adds class nodes via contains edges with an optional function toggle.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8482412 to
c1bc4bf
Compare
Owner
Code reviewFound 2 issues:
Understand-Anything/understand-anything-plugin/packages/dashboard/src/App.tsx Lines 449 to 497 in c1bc4bf Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
…n domain view - Issue 1: setDetailLevel now resets showFunctionsInClassView so the fn toggle doesn't resurrect when re-entering class view after a file-view round-trip. - Issue 2: detail-level toolbar (Files/+Classes/fn) now gated on viewMode !== "domain" so it doesn't render in domain view where it has no effect.
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
detailLevelstate ("file"|"class") to the dashboard[fn]function toggle[Files] [+Classes] [fn]Use Case
在分析 Hermes Agent(一个大型 Python 项目,3,732 个节点、3,186 条边)的知识图谱时,dashboard 的图视图变得极其卡顿——缩放/拖拽几乎不可用,而且连线密密麻麻什么也看不清楚。
排查后发现根因是单个 layer 视图展开 function 节点的
contains边后,仅 Core Agent System 层就从 164 个文件节点膨胀到 854 个节点、1,651 条边(其中 1,268 条是 function 的 contains/exports 边)。绝大多数场景下用户不需要看到 function 级别的细节,只需要文件级的架构依赖概览。Proposed Solution
添加
detailLevel双视图切换:[fn]开关让用户手动选择是否展开 function 节点——故意保留性能代价,由用户自主决定。切换视图时自动清除容器布局缓存,保证 React Flow 重新计算布局。
Review fixes (e29f461)
setDetailLevel("file")now resetsshowFunctionsInClassView: falseso the fn toggle doesn't resurrect when switching back to +Classes after a file-view round-trip.viewMode !== "domain"so it doesn't render in domain view where it has no effect.Alternatives Considered
Classes 视图只展示类节点(不含文件):试过在 class 模式下过滤掉所有文件节点,只保留 class 节点和 class↔class 边。但知识图谱中 class↔class 边极少(Hermes Agent 仅 14 条 inherits,没有 depends_on/calls 等),大部分类节点变成孤岛,没有实用价值。最终改为 file+class 叠加模式。
始终默认隐藏 function 节点:最初考虑过直接在所有视图隐藏 function 来减少节点数。但 function 展开在某些场景有价值(如分析单个文件的代码结构),一刀切不合适。最终用可选的
[fn]开关让用户自主控制。Files changed
packages/dashboard/src/:store.ts— new state + actionscomponents/GraphView.tsx— conditional contains-edge expansionApp.tsx— view toggle UI in headerAdditional Context
Tested
Contribution Checklist
Per CONTRIBUTING.md:
pnpm test) — 670 tests passedfeat(dashboard): ...🤖 Generated with Claude Code