Repository navigation
feat(canvas): real containment hierarchy for the map view - #26
Merged
Merged
Conversation
Mirrors SaaS PR #20. Kubernetes (big node, helm logo) |- Cluster |- CronJobs |- Deployments |- Namespaces | |- cert-manager | | |- cert-manager | | |- cert-manager-webhook | |- cs | |- manager-*, az-* Three earlier attempts each got half of it wrong: grouping by type alone destroyed parentage, a free radial layout destroyed grouping (identical discs, undifferentiable), labelled blocks kept grouping but had no hierarchy inside them. - `hierarchyMap.ts` — synthesises platform roots, resource-type nodes and containment edges; layout centres each node over its children and grid-wraps wide fan-outs - `MapHierarchyNodes.tsx` — root node with the Kubernetes helm / Docker marks, and type nodes (`Pods 44`) Namespaced resources are drawn under their namespace so the parentage is real; the type node still links to them so "Pods" reaches its pods. Two layout bugs fixed: `cy` was computed once and never advanced per row so wrapped grids stacked on one line (91 overlapping pairs), and column count came from child count alone which made the tree 6000px wide (aspect 4.21 -> 1.17).
| const MAX_COLS = 8 | ||
| /** Roughly how wide a level of the tree should be. */ | ||
| const TARGET_BLOCK_W = 1500 | ||
| const CELL_W = Math.max(ENT_W, TYPE_W) + GAP_X |
| /** Roughly how wide a level of the tree should be. */ | ||
| const TARGET_BLOCK_W = 1500 | ||
| const CELL_W = Math.max(ENT_W, TYPE_W) + GAP_X | ||
| const CELL_H = ENT_H + GAP_Y |
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.
Mirrors SaaS PR #20.
What the map is now
Why the previous attempts were wrong
Each got one half of it:
Pods ×9ownedby nothing.
where a Pod, a Service and a PVC were indistinguishable.
namespace's resources were a flat shelf belonging to nothing.
What this does
buildHierarchy()synthesises platform roots (Kubernetes/Docker/Host), resource-type nodes beneath them, and the containment edgesbetween parent and child
applyHierarchyLayout()centres each node over its children, grid-wrappingwide fan-outs so a 50-pod namespace stays a readable rectangle
is real. The type node still links to them (dashed) so
Podsreaches itspods
containment solid, type→member dashed because it spans levels, original
snapshot edges faint in the background
Two layout bugs caught by local tests
cywas computed once and never advanced per row, so every row of awrapped grid stacked on the same line — 91 overlapping pairs.
Column count came from child count alone, which put four ~1200px
namespace blocks side by side and made the tree 6000px wide. It is now
derived from how wide the children actually are, targeting a 1500px level:
aspect 4.21 → 1.17.
Verified
On the SaaS side against the real kind cluster: 187 resources + 14 hierarchy
nodes, 368 edges, 0 overlapping pairs, deterministic, no console errors.
Locally at 117 nodes: all placed, no lost nodes, no duplicate ids.