Skip to content

ref(metrics): Refactor AggregateDropdown to use CompositeSelect#111296

Merged
nsdeschenes merged 3 commits intomasterfrom
nd/LOGS-628/ref-tracemetrics-refactor-compact-select-to-composite-select
Mar 24, 2026
Merged

ref(metrics): Refactor AggregateDropdown to use CompositeSelect#111296
nsdeschenes merged 3 commits intomasterfrom
nd/LOGS-628/ref-tracemetrics-refactor-compact-select-to-composite-select

Conversation

@nsdeschenes
Copy link
Contributor

@nsdeschenes nsdeschenes commented Mar 23, 2026

Replaces the CompactSelect in AggregateDropdown with CompositeSelect, where each option group gets its own Region. This removes the manual findGroupKey helper and the hand-rolled cross-group filtering logic that lived in the onChange handler.

Group modes:

  • percentiles and stats → multi-select regions (users commonly compare e.g. p50 + p75 + p90)
  • rate and math → single-select regions

Cross-group enforcement is now automatic: handleChange always replaces the full visualizes array, so selecting from a new group clears the previous group's selections on re-render without any explicit filtering.

The trigger label is manually constructed to match CompactSelect's built-in behaviour — first selected name in a TriggerLabel span, with a muted +N badge when more than one aggregate is active (CompositeSelect does not inject a trigger label the way CompactSelect does).

Ticket: LOGS-628

Example:
Screenshot 2026-03-23 at 11 14 33

@linear-code
Copy link

linear-code bot commented Mar 23, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 23, 2026
@nsdeschenes nsdeschenes marked this pull request as ready for review March 23, 2026 15:35
@nsdeschenes nsdeschenes requested a review from a team as a code owner March 23, 2026 15:35
nsdeschenes and others added 3 commits March 23, 2026 13:56
…iteSelect

Replace the flat multi-select CompactSelect (with manual group-filtering
logic) with CompositeSelect, where each option group becomes its own
Region. Groups with key 'percentiles' or 'stats' are multi-select;
'rate' and 'math' groups are single-select. Cross-group enforcement is
automatic: handleChange always replaces the full visualizes array, so
selecting from a new group clears the previous group's selections on
re-render.

The findGroupKey helper is removed as it is no longer needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ropdown trigger

CompositeSelect does not inject a trigger label the way CompactSelect
does, so replicate the same pattern manually: show the first selected
name in a TriggerLabel span and append a muted Badge with the overflow
count (+N) when more than one aggregate is active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…etric selected

AggregateDropdown had no disabled state, so it stayed enabled while other toolbar
controls were disabled. GroupBySelector was disabled until API attribute keys loaded,
causing it to enable later than the aggregate dropdown.

Disable AggregateDropdown when no metric type is available (groups.length === 0).
Disable GroupBySelector based on whether a metric is selected (!traceMetricFilter)
rather than waiting for attribute options to load — the loading spinner already
communicates that data is pending.

Co-Authored-By: Claude Sonnet 4 <noreply@example.com>
@nsdeschenes nsdeschenes force-pushed the nd/LOGS-628/ref-tracemetrics-refactor-compact-select-to-composite-select branch from 6120b38 to 0661102 Compare March 23, 2026 17:57
@nsdeschenes nsdeschenes merged commit 778f26f into master Mar 24, 2026
70 checks passed
@nsdeschenes nsdeschenes deleted the nd/LOGS-628/ref-tracemetrics-refactor-compact-select-to-composite-select branch March 24, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants