Skip to content

feat(dashboards): Disable non-distribution metrics for heat map widgets#118779

Merged
gggritso merged 4 commits into
masterfrom
georgegritsouk/dain-1756-disable-selection-of-non-distribution-metrics-in-dashboards
Jul 6, 2026
Merged

feat(dashboards): Disable non-distribution metrics for heat map widgets#118779
gggritso merged 4 commits into
masterfrom
georgegritsouk/dain-1756-disable-selection-of-non-distribution-metrics-in-dashboards

Conversation

@gggritso

@gggritso gggritso commented Jun 30, 2026

Copy link
Copy Markdown
Member

Dashboards-side partner of #118661. In Explore, users select the metric then the visualization. So, if they choose a non-distribution metric, we disable the Heat Map visualization. In Dashboards, it's reversed. Users select the visualization and then the metric. So here, if they choose "Heat Map" we disable any non-distributions.

e.g.,

Screenshot 2026-07-06 at 11 36 04 AM

Closes DAIN-1756

Heat maps plot the distribution of a measurement's values over time, so they
only make sense for distribution metrics — counters (always 1) and gauges have
no meaningful value distribution to visualize.

Dashboards is visualization-first (you pick the chart type, then the metric), so
the constraint points from the visualization to the metric:
- When Heat Map is the selected display type, the metric picker disables counter
  and gauge metrics (greyed out with a tooltip) and won't auto-select one.
- Switching the display type to Heat Map drops any already-selected
  non-distribution metric and falls back to a distribution metric, matching the
  widget builder's coerce-on-transition behavior for every other display type.
- As a safety net, saved or otherwise invalid heat map widgets surface a config
  error instead of failing to render.

Reuses the doesMetricSupportHeatMapVisualization helper from Explore (#118661)
via the shared MetricSelector's new optional disabledMetricReason prop; Explore
doesn't pass it, so its behavior is unchanged.

Refs DAIN-1756
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 30, 2026

Copy link
Copy Markdown

DAIN-1756

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 30, 2026
@gggritso

Copy link
Copy Markdown
Member Author

@cursor review

Comment thread static/app/views/explore/metrics/metricToolbar/metricSelector/metricSelector.tsx Outdated
When every loaded metric option is disabled (e.g. a heat map in a project with
only counter/gauge metrics), the auto-select effect fell back to the first
option and selected it anyway — a metric the caller explicitly marked invalid.

Leave the slot empty in that case so the widget's config error surfaces instead.

Caught by Cursor Bugbot on #118779.

Refs DAIN-1756
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-1756-disable-selection-of-non-distribution-metrics-in-dashboards
Rename the shared MetricSelector prop disabledMetricReason to
getDisabledOptionReason (and the internal disabledMetricKeys to
disabledOptionKeys). The new name reads as "compute the disabled reason",
aligning with the boolean-predicate naming used elsewhere (e.g. CompactSelect's
isOptionDisabled) while keeping the single-callback shape that ties an option's
disabled state to its explanatory tooltip. No behavior change.

Refs DAIN-1756
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gggritso

gggritso commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0d1142a. Configure here.

@gggritso gggritso marked this pull request as ready for review July 6, 2026 15:50
@gggritso gggritso requested review from a team as code owners July 6, 2026 15:50

@nikkikapadia nikkikapadia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice! 😎

@gggritso gggritso merged commit 2f78bb0 into master Jul 6, 2026
78 checks passed
@gggritso gggritso deleted the georgegritsouk/dain-1756-disable-selection-of-non-distribution-metrics-in-dashboards branch July 6, 2026 18:49
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