Skip to content

feat(ui): add CreateDashboardDialogComponent and AddExperimentDialogComponent - #489

Merged
AntonTyb merged 26 commits into
mainfrom
feat/metrics-dash-dialogs
Aug 21, 2026
Merged

AntonTyb merged 26 commits into
mainfrom
feat/metrics-dash-dialogs

Conversation

@AntonTyb

@AntonTyb AntonTyb commented Aug 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR implements the interactive modal dialogs for the Performance Dashboards UI: CreateDashboardDialogComponent and AddExperimentDialogComponent. These dialogs enable users to configure new dashboards and add comparison experiment runs to active dashboards.

Motivation & Context

With the core visualization container components in place (#488), users require intuitive configuration modals to:

  1. Initialize a dashboard by specifying title, description, base Experiment ID (XID), WorkUnit ID (WID), and customizable plot specifications.
  2. Dynamically add comparison experiment runs to an existing dashboard view.

Key Changes

  • CreateDashboardDialogComponent (cmd/ui/app/common/components/dashboard/create_dashboard_dialog/):
    • Implements reactive form validation for dashboard metadata, base experiment IDs, and metric plots.
    • Allows adding, removing, and resetting KPI summary boxes and metric visualization plots with default loss/accuracy curves.
    • Supports adding initial comparison experiment runs during dashboard creation.
    • Outputs a fully structured Dashboard entity on submit.
  • AddExperimentDialogComponent (cmd/ui/app/common/components/dashboard/add_experiment_dialog/):
    • Implements a modal dialog for entering an Experiment ID (XID), optional WorkUnit ID (WID), and custom run title to append to an active comparison dashboard.
  • Design Tokens & Accessibility:
    • Uses Angular Material design tokens (--mat-sys-primary, etc.) for consistent theming and dark mode compatibility.
  • Unit Tests:
    • Adds comprehensive unit test suites covering form validation, adding/removing plots and comparisons, and dialog submission results.

Verification & Testing

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

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

create dashboard dialog:

image image

add experiment dialog:

image

- 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
…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
@github-actions
github-actions Bot requested a review from janzak-dev August 19, 2026 20:57

@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 two new Angular dialog components, AddExperimentDialogComponent and CreateDashboardDialogComponent, along with their templates, styles, and unit tests, to enable researchers to add experiments and create performance dashboards. The code review feedback highlights a few key improvement opportunities in CreateDashboardDialogComponent: ensuring the comparison form is validated before adding a run, disabling the 'Add Run' button when the form is invalid, and replacing Date.now() with a random suffix for plotId generation to prevent potential ID collisions.

Change-Id: If53989f5570187b487d1af82f1805fe30c23d04b
@AntonTyb
AntonTyb requested a review from janzak-dev August 20, 2026 14:26
… 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
…omponent

- Add CreateDashboardDialogComponent for configuring dashboard title, base experiment run, and customizable KPI/curve plots
- Add AddExperimentDialogComponent for adding new comparison runs to an active dashboard
- Include Angular reactive form validation and comprehensive unit test coverage

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

Change-Id: I0b196197cd4337025833d901bbb01bc9a0a73317
- Check newComparisonForm.invalid before adding comparison runs
- Use loose inequality (!= null) to guard wid against both null and undefined
- Disable Add Run button when newComparisonForm is invalid
- Generate plotId with random alphanumeric suffix instead of Date.now() to avoid collision

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

Change-Id: I4033596a556f4762e4921921e17c483a07a8fcc1
…cs in dashboard dialogs

- Update baseWid in CreateDashboardDialogComponent.onSubmit() and wid in AddExperimentDialogComponent.onSubmit() to use loose inequality (!= null) to guard against both null and undefined, maintaining consistency with the comparison run wid check.

- Use optional chaining (plot.data?.metrics?.[0]) in create_dashboard_dialog.ng.html to prevent TS2532: Object is possibly 'undefined' template compilation errors.

TAG=agy

CONV=d04e5dff-bccf-41ff-b65b-234361e4c202

Change-Id: I40aca2cf99c289257de1d8ae49e3bfcf3083264f
…ation

Verify that adding custom plots in CreateDashboardDialogComponent generates
plotIds with a random base-36 alphanumeric suffix, avoiding time-dependent
Date.now() collisions when multiple plots are added in rapid succession.

Comment link: #489 (comment)

TAG=agy
CONV=7c725a9b-46af-46a6-9925-8ac0c6c83f62

Change-Id: I8b57b1bd70efd53bea67bd03c731af2a3a5e34bd
- Update AddExperimentDialogComponent and CreateDashboardDialogComponent to require Work Unit ID (WID) for both baseline and comparison runs, defaulting WID to 1.
- Align dialog form validation and templates with UX designs and the Protobuf Chart schema where WID is a required field.
- Remove "optional Work Unit ID" phrasing in AddExperimentDialogComponent description and update component unit test suites.

Comment link: #489

TAG=agy
CONV=af865fa7-e648-4183-a209-f59fb8bcb14a

Change-Id: I6bf097fbab1909312966a2af2408ed2f7d67db6b
…mparison'

Address PR review feedback on AddExperimentDialogComponent by changing the primary action button label from 'Add to Compare' to 'Add to comparison' for improved grammatical clarity. Add a DOM interaction unit test asserting the rendered button text and dialog submission on click.

Comment link: #489

TAG=agy

CONV=cecf9a0c-1391-4de2-9bd3-570bb6f1f7a6

Change-Id: I69c31e24f8a8d6451de7d72f833fb21c3cc81aec
… dashboard dialog

Remove the redundant `|| plot.type === 1` and `|| plot.type === 2` checks when rendering plot type chips in CreateDashboardDialogComponent. The component manages PlotSpec items where `type` is always set to PlotType string enum constants (`'SUMMARY_BOX'` or `'SCATTER'`). Comparing against numeric literals was unnecessary and mixed types. Added a unit test to verify chip rendering for both plot types.

TAG=agy

CONV=d6b527a5-199a-4111-98fe-fc644e573dbc

Change-Id: Ia6b1cb149df94c86ff055f28c8a1159394d75974
… Experiment'

Address PR review feedback on CreateDashboardDialogComponent by updating the confirmation button label in the comparison experiments sub-form from 'Add Run' to 'Add Experiment'. This aligns the action button with the step title ('Add comparison experiments') and the dialog's experiment-based terminology. Also add a DOM interaction unit test verifying the rendered button label and click behavior.

Comment link: #489

TAG=agy
CONV=e8e70f65-09a1-4aca-be51-14d87ae693ff

Change-Id: Ieb09c3473b1518fd958116d9a39aaa7dd2813968
…shboardResourceName

Refactor buildDashboardResourceName to replace the terse 'slug' variable name with a more descriptive 'sanitizedTitleId' identifier and document the three normalization steps (converting to lowercase, replacing non-alphanumeric character sequences with underscores, and stripping leading/trailing underscores). Also add comprehensive unit tests for buildDashboardResourceName in create_dashboard_dialog_test.ts.

Comment link: #489

Bug: PR-489

TAG=agy

CONV=9813a86a-efaa-4528-846e-e146ba135b82

Change-Id: I1ea00a225f63d61c8bc6225a6b9c931e2c809e7b
…erimentDialog

Add Angular CDK ComponentHarness classes (CreateDashboardDialogHarness, PlotItemHarness, ComparisonItemHarness, and AddExperimentDialogHarness) to encapsulate DOM interactions and element locators for dashboard dialog components.

Refactor create_dashboard_dialog_test.ts and add_experiment_dialog_test.ts to use TestbedHarnessEnvironment.harnessForFixture, replacing raw CSS query selectors and direct DOM querying with typed, maintainable component test harnesses.

Comment link: #489

Bug: PR-489

TAG=agy

CONV=51b7710d-e801-444e-8f7d-8d5e4aa4849f

Change-Id: I5558778229d5cbb0a7fccb96afe87a0b6d9e1321
@AntonTyb
AntonTyb force-pushed the feat/metrics-dash-dialogs branch from 85a4c5c to ca184a7 Compare August 21, 2026 08:07
@AntonTyb
AntonTyb added this pull request to the merge queue Aug 21, 2026
Base automatically changed from feat/metrics-dash-grid to main August 21, 2026 08:20
Merged via the queue into main with commit 6f2728d Aug 21, 2026
15 checks passed
@AntonTyb
AntonTyb deleted the feat/metrics-dash-dialogs branch August 21, 2026 08:21
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