Skip to content

feat(ui): add ChartCardComponent and DashboardGridComponent for comparative visualization - #488

Merged
AntonTyb merged 16 commits into
mainfrom
feat/metrics-dash-grid
Aug 21, 2026
Merged

AntonTyb merged 16 commits into
mainfrom
feat/metrics-dash-grid

Conversation

@AntonTyb

Copy link
Copy Markdown
Collaborator

Summary

This PR implements the second layer of the Performance Dashboards UI visualization pipeline by introducing the ChartCardComponent and DashboardGridComponent. These components organize metrics into structured experiment run cards and render responsive comparative chart columns.

Motivation & Context

Following the core service and models layer (#449) and plot card visualization components (#461), dashboards require container components to group related KPI summary boxes and metric visualization plots together per experiment run, and a grid canvas to display multiple comparative runs side by side.

Key Changes

  • ChartCardComponent (cmd/ui/app/common/components/dashboard/chart_card/):
    • Encapsulates a single experiment Chart entity and manages its data lifecycle (DashboardService.getChartData).
    • Separates KPI summary boxes and metric visualization plots into distinct rows/sections.
    • Implements header actions including retry/refresh and removal from the active comparison.
  • DashboardGridComponent (cmd/ui/app/common/components/dashboard/dashboard_grid/):
    • Provides a responsive flexbox/grid layout for rendering multiple comparative ChartCardComponents.
    • Passes baseline status indicators and propagates chart removal events upward to the parent dashboard page.
  • Test Harnesses & Unit Tests:
    • Adds ChartCardHarness and DashboardGridHarness for component testing.
    • Includes unit tests covering component rendering, observable subscription lifecycle and unsubscription, and event propagation.

Verification & Testing

  • Local Unit Tests:
    • bazel test //cmd/ui:ui_unit_tests (All 331 tests passed, including ChartCardComponent and DashboardGridComponent suites).
  • Pre-commit Hooks:
    • Passed Buildifier, ESLint, Prettier, and license header verification.

TAG=agy
CONV=9ad586d8-14f0-4515-b966-fe385ce46c94

- Implement PlotCardComponent rendering scatter, step-line, and bar charts
- Support ResizeObserver with requestAnimationFrame debouncing
- Add empty state and loading indicators
- Add PlotCardHarness and comprehensive Jasmine test suite

TAG=agy
CONV=9ad586d8-14f0-4515-b966-fe385ce46c94

Change-Id: I90f0b3aaa1e42dee98862c9282bc59ae8f72ab35
…lotCardComponent

- Add SummaryBoxComponent for KPI metric cards with delta vs baseline
- Update PlotCardComponent chart lifecycle to be fully reactive using Angular Signals and effect()
- Remove unused AfterViewInit lifecycle and magic numbers in isSummaryBox
- Simplify isScatterType and isBarType in echarts_options_builder
- Add unit test verifying reactive switching between canvas plot and summary box

TAG=agy
CONV=9ad586d8-14f0-4515-b966-fe385ce46c94

Change-Id: Ibac22b78e9425599db8f191e48625bc9c787f0bc
…ums from main

- Rebase feat/metrics-dash-plot-card onto latest origin/main containing PR 449
- Restore numeric integer tag checks (1, 2, 3, 4) in isSummaryBox, isScatterType, and isBarType type guards
- Ensure seamless interoperability between string enum names ('SCATTER') and numeric proto tags (2)

TAG=agy
CONV=9ad586d8-14f0-4515-b966-fe385ce46c94

Change-Id: I6dc50a9a4d1b2a13a21b305125e7aea3b8ec4ddb
…rative visualization

- Add ChartCardComponent to group KPI summary boxes and metric visualization plots per experiment run
- Add DashboardGridComponent to render comparative chart columns matching layout specs
- Include component test harnesses and full unit test coverage

TAG=agy
CONV=9ad586d8-14f0-4515-b966-fe385ce46c94

Change-Id: I48e9855beec0575e4432a93b660219d971ea7680
@github-actions
github-actions Bot requested a review from pachopepe August 19, 2026 20:01

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the ChartCardComponent and DashboardGridComponent to render comparative experiment chart columns in a grid layout. Feedback on these changes highlights opportunities to improve robustness and performance: specifically, using a composite key for tracking and removal to prevent duplicate key collisions, optimizing template lookups in ChartCardComponent with a computed signal map to avoid O(N) searches during change detection, and replacing hardcoded color hex codes in the SCSS with theme-appropriate CSS custom properties.

…ridComponent

- Extract getChartKey helper for robust composite tracking keys (xid, wid, title) in grid template and onRemove emission
- Add computed signal plotDataMap for O(1) plot lookup performance
- Replace hardcoded hex colors with Material design tokens in chart_card.scss
- Add comprehensive unit tests covering getChartKey, plot data caching, and remove event keys

TAG=agy
CONV=9ad586d8-14f0-4515-b966-fe385ce46c94

Change-Id: Ib7217ff8c76b6313b622629d2833043b6a22c751
@AntonTyb
AntonTyb changed the base branch from feat/metrics-dash-plot-card to main August 19, 2026 20:38
@AntonTyb AntonTyb added the priority::2-high top of mind. should not wait. label Aug 20, 2026
Change-Id: If53989f5570187b487d1af82f1805fe30c23d04b
… text color

Replace --mat-sys-primary-container with --mat-sys-on-primary-container for chart-header-link hover state in chart_card.scss. In Material 3 design tokens, container tokens (*-container) represent background fills (light pastel in light theme), while on-primary-container (Tone 10) represents the contrasting foreground text/icon color. Using primary-container for text caused severe color contrast degradation (~1.3:1) against the white surface background on hover. Also replace hardcoded #f1f3f4 border color with var(--mat-sys-outline-variant, #f1f3f4) in plot_card.scss for consistency.

Comment link: #488 (comment)

TAG=agy
CONV=8daea4f9-4bbb-4aa2-8cee-afe271da5785

Change-Id: I6e616e6ab80224ffeea4d923d3072cdd43adc0cc
…ponent

Remove the unused layout input signal (and the unused LayoutSpec import) from DashboardGridComponent as it is currently not referenced in the template or component logic. It can be reintroduced in a future PR when layout customization is consumed.

Comment link: #488
Bug: PR-488

TAG=agy
CONV=83cc8f9c-5c1b-4aa9-98db-746abf49b194

Change-Id: I3e9c2d9d0f92beda87e2cc7953adad38c62c3495
… pattern

Update chart resource name fallbacks and test mock data to include the required workUnits segment (experiments/{xid}/workUnits/{wid}/charts/{chartId}), resolving PR review feedback and aligning with canonical Chart protobuf resource definitions.

TAG=agy
CONV=dd5e8cf1-89a5-4ee4-86df-1b86a2a48156

Change-Id: Ic304fdad827d423a088a6626565b58987c8f06f5
…nent

Replaces component method calls to getPlotData in the Angular template
with a standalone pure Angular pipe (PlotDataPipe) to take advantage of
pure pipe memoization during change detection cycles.

Comment link: #488

TAG=agy
CONV=d491ed89-a21d-4611-b28f-788954a9c53b

Change-Id: I02d750d5e367234b4e494f0f102101af6a21edcc
…artCardComponent

In proto3, scalar integer fields (`int64 wid`) default to `0` when unset. In XMC, WorkUnit IDs are 1-indexed (`>= 1`), so `wid = 0` indicates an experiment-level chart that is not scoped to a specific work unit. Previously, checking `c.wid !== undefined && c.wid !== null` evaluated to true when `wid` was `0`, resulting in a card header showing `WorkUnitID 0` and an invalid navigation link pointing to `/experiments/{xid}/workUnits/0`.

This change introduces the `hasWorkUnit` helper (`wid > 0`) to correctly distinguish work unit-scoped charts from experiment-level charts in `ChartCardComponent`, and adds comprehensive unit test coverage.

Comment link: #488
Bug: PR-488

TAG=agy
CONV=99187388-335c-4c8a-ae8e-4cf1c6acefb4

Change-Id: I5adedc9c95e49bd18ce9fb7a299ffbcebdd3e541
Address PR review feedback by renaming the `experimentUrl` computed signal in ChartCardComponent to `headerUrl`. The computed signal returns either an experiment route or a work unit route depending on whether the chart belongs to a specific work unit. Naming it `headerUrl` pairs directly with `headerTitle` and avoids implying it only targets experiment URLs.

Comment link: #488

TAG=agy
CONV=83cc0a7b-1817-4207-822b-5e54f2703c2d

Change-Id: Iefaf96174c832eaa7ba133ae29efa54d72cf0605
…ignal

Address PR review comment by refactoring ChartCardComponent to use `toSignal` for fetching and managing chart metrics data instead of manual observable subscription and lifecycle hooks (`OnInit`, `OnDestroy`, `chartDataSub`).

By combining `toObservable(this.chart)` with a `refreshTrigger$` in a reactive RxJS pipeline, `chartData` is automatically derived as a signal, in-flight requests are cancelled on consecutive refresh calls via `switchMap`, and subscription cleanup is handled automatically when the component is destroyed.

Comment link: #488

TAG=agy
CONV=98b68e96-da41-4f92-b5b7-204cbfb458ed

Change-Id: I0734bae75fc29655eee84bd320f9c777e7576197
Avoid calling initChart and cleanupChart repeatedly when reactive signals
(such as isSummaryBox or plotData) are evaluated or updated. Check if
chartInstance is already defined before initializing a new ECharts canvas,
and guard initChart against re-initializing an existing instance. This
prevents redundant canvas disposal and race conditions with renderChart.

Comment link: #488

TAG=agy
CONV=ce97cff8-a4c0-4e7f-93f7-ae6c935e13fc

Change-Id: Id538bd2af3c56c41ebe2f3a49df46d1502f90a6f
Change-Id: Ia89b32fc8e1461c795243bdc2eb8d21d0a7cb3df
Fixes the ESLint '@typescript-eslint/no-unused-vars' error in ChartCardComponent which caused the 'UI Lint & Format (Prettier & ESLint)' CI check to fail on PR #488.

TAG=agy
CONV=49c92d6d-64e6-4274-8610-797821b3083d

Change-Id: I0c9973d3c9301c11e0cc1312035381332f63b501
@AntonTyb
AntonTyb requested a review from pachopepe August 21, 2026 06:51
@AntonTyb
AntonTyb added this pull request to the merge queue Aug 21, 2026
Merged via the queue into main with commit 9f25bc7 Aug 21, 2026
15 checks passed
@AntonTyb
AntonTyb deleted the feat/metrics-dash-grid branch August 21, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

koder::in_review open for review priority::2-high top of mind. should not wait.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants