Inconsistent node rectangle sizing on the weathermap panel #54
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #53 (layout work). Reported after visual review: node rectangle size varies inconsistently, including between two nodes of the identical role (e.g.
campus-leaf1vscampus-leaf2).Observation from live dashboard data
No node has an explicit size field (
width/height) — every node shares identicalpadding: {horizontal:12, vertical:6}. Rendered size is therefore computed by the plugin, not stored. Working hypothesis: it scales withanchors[<side>].numLinks(link count per side) combined withuseConstantSpacing: false/compactVerticalLinks: false, both currentlyfalseon every generated node.Supporting evidence:
campus-leaf1(3 total links) andcampus-leaf2(4 total links) render at different sizes despite being the same device role — link count, not role, appears to drive size.Task: confirm root cause against real plugin source, don't assume
Same caution as #48 (where the documented schema turned out to differ from the actually-installed
tamirsuliman-weathermap-panelfork —anchorshandling was a real surprise, not theoretical). Before changing anything:module.js(or source, if buildable) from the installed plugin and confirm what actually drives node width/height at render time —useConstantSpacing,compactVerticalLinks,anchors[*].numLinks, or something else entirelyFix — consistent sizing per role tier
Once confirmed, make node size deterministic and consistent by role (all leafs same size, all spines same size, etc.), decoupled from link count:
useConstantSpacing: trueachieves this cleanly, set it uniformly on generationValidation
campus-leaf1vscampus-leaf2specifically, since that's the reported case)positionDocument
Implemented in
9b53ab0(branchfeat/telemetry).Root cause (confirmed against the real plugin, not the #48 doc)
Pulled the actual bundle from the installed plugin (
$GRAFANA_URL/public/plugins/tamirsuliman-weathermap-panel/module.js, ~177KB minified) rather than trusting the #48 schema research, per the issue's own caution. Found the two functions that compute the rendered rectangle dimensions directly (z()= width,L()= height, both fed straight into the SVG rect viauseMemo):Width (
z()):label_width + 2*padding.horizontalwhenuseConstantSpacingis false (our current/unchanged setting) —label_widthitself is always recomputed fresh from the actual label text viacanvas.measureText()at render time (i.labelWidth = I(i.label, fontSize).widthinside the node-normalization function). There is no explicit width override field anywhere in the schema — nothing we set in JSON for width would ever be read.useConstantSpacing: truewould only pull in a term based onTop/Bottomanchor link count, which this generator never populates (links always attachRight/Left, per the existinganchor_countscomment) — so it's a dead lever for our topology either way, width is purely a function of label string length + font. This confirms width was never actually the bug:campus-leaf1/campus-leaf2have identical-length labels, so their widths were already identical.Height (
L()) — the actual bug:max(anchors[Left].numLinks, anchors[Right].numLinks)directly scales a link-stack height term, andreturn !compactVerticalLinks && c > s ? c : smeans that term wins over the constant font-based heightswhenevercompactVerticalLinksisfalse(the value every node had, generated by #48/#52/#53) and the link-count term is larger.campus-leaf1(3 links) vscampus-leaf2(4 links) is exactlymax(anchors[Left], anchors[Right])differing → differentc→ different rendered height. Confirmed by reading thenumLinks/numFilledLinksaccounting in the bundle, not by inference.So the issue's own hypothesis named the wrong flag (
useConstantSpacing) for the actual defect —compactVerticalLinksis the real lever, and it fully explains the reported symptom.Fix
compactVerticalLinks: Trueon every node (wasFalse). Per the confirmed formula this makes height an unconditional constant —fontSize + 2*padding.vertical— for every node, sincepaddingandfontSizeare already uniform fabric-wide (no per-node override exists in the generator). This isn't just "consistent per role tier" as asked, it's consistent across every node regardless of role, which satisfies the requirement without needing per-role values (there's nothing to differentiate by, since the plugin gives us no size field to key off role in the first place — only this one boolean).useConstantSpacingleftfalse(unchanged) — confirmed it has no bearing on this bug given our anchor usage pattern, so touching it would be a no-op dressed up as a fix.Validation
{'position', 'compactVerticalLinks'}. No other field (statusQuery,anchors,colors,padding,label, etc.) touched.position: unrelated drift, not from this change — the live Grafana dashboard had already moved between the #53 and #54 sessions (x roughly preserved per node, y snapped into a few discrete bands — looks like the plugin's own auto-arrange, likely from the manual UI pass requested at the end of #53). This is exactly #53's live-position-preservation mechanism doing its job correctly: whatever was live got carried over untouched by this run, regardless of source. Confirms size and position stayed fully independent, as required.campus-leaf1/campus-leaf2spot-check: both now havecompactVerticalLinks: true, identicalpadding, nofontSizeoverride → guaranteed identical rendered height by the confirmed formula, regardless of their differing per-side link counts (max(1,3)=3vsmax(2,2)=2).Outstanding
Still no image-renderer plugin / browser access on my end — I can't screenshot the result. Please do a visual pass to confirm the rectangles actually look uniform now; the source-level analysis is solid but a render-level confirmation from a human is still the right final check here, same caveat as #49/#52/#53.