Repository navigation
feat(mcp,web): support above-box span labels and optional duration in render_timelines - #1256
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for customizable span label placements (auto, above, inside) and an option to hide the duration suffix on timeline spans. The changes span both the Go backend, where validation and resolution logic are updated, and the Angular frontend, which implements the rendering and collision avoidance logic for above-box labels. The review feedback correctly identifies a potential layout issue in the collision avoidance logic where using a strict inequality > instead of >= could cause adjacent chips with identical starting coordinates to overlap.
| if ( | ||
| Math.abs(placed.aboveBandTopPx - curr.aboveBandTopPx) < | ||
| SPAN_CHIP_HEIGHT_PX && | ||
| placed.chipStageLeftPx > curr.alignedAboveLeftPx && |
There was a problem hiding this comment.
Using a strict inequality > can cause adjacent chips with the exact same starting coordinate (e.g., due to rounding or identical start times on adjacent very short rows) to not be recognized as neighbors, leading to complete visual overlap. Changing this to >= ensures they are correctly treated as neighbors and shifted to avoid overlapping.
| placed.chipStageLeftPx > curr.alignedAboveLeftPx && | |
| placed.chipStageLeftPx >= curr.alignedAboveLeftPx && |
… render_timelines
Adds SpanLabelPlacement ('auto', 'above', 'inside') and hideDuration options to SpanAnnotation and ResolvedSpan. Compact row-scoped spans (< 44px tall) automatically place their header chips above the span box while avoiding vertical stems and clamping width right-to-left against adjacent same-band above-box chips.
…esolve error paths
fabf972 to
ad0e6d3
Compare
ad0e6d3 to
d431a62
Compare
Code Quality Report — ✅ Cloud Build
|
Summary
Improves readability of row-scoped span annotations in MCP
render_timelinesscenes by supporting above-box header chip placement (labelPlacement: "auto" | "above" | "inside") and optional duration suffix suppression (hideDuration: true).Motivation
layoutSpanHeaderChipalways positioned the opaque.span-label-chipinside the top edge of the span box (vertical.topPx + 1..4px). On single-row or compact two-row spans (< 44pxtall, such as a singleHorizontalPodAutoscaleror container row withincludeSubtree: false), the internal chip covered the exact revision bricks and event dots highlighted by the box.(${durationLabel})unconditionally widened narrow metric comparison labels (e.g.,averageUtilization: 20 ~ 27%vsaverageUtilization: 1 ~ 2%) and caused premature ellipsis truncation.Changes
pkg/server/mcp/scene/):SpanLabelPlacement(auto,above,inside) and optionallabelPlacementandhideDurationfields toSpanAnnotationandResolvedSpan.labelPlacementinresolveSpans(defaulting""to"auto"and returningINVALID_ARGUMENTon unsupported values) and omitteddurationLabelwhenhideDurationistrue.web/src/app/pages/timeline-render/):TimelineSpanLabelPlacementenum and optionallabelPlacement/hideDurationfields onTimelineResolvedSpan.resolveSpanIsLabelAbove,layoutSpanHeaderChip, andbuildSpanViewModels:autoplaces header chips directly above compact row-scoped spans (isRowScoped && heightPx < 44when vertical headroom is available) and keeps chips inside full-height or tall multi-row spans.abovechips align withbox.leftPx, dodge vertical marker/excerpt stems intersecting the external chip band viafindStemFreeSpanIntervals, and expandchipMaxWidthPxinto open space on the right while clamping right-to-left against adjacent same-bandabovechips so side-by-side intervals never overlap.(${durationLabel})whenhideDurationistrue..span-label-chip.aboveintimeline-scene-overlay.componentand added a Storybook story for compact row above-box span labels.Verification
make pre-commitmake build-go && make lint-go && make test-gomake build-web && make lint-web && make test-webmake build-storybook