mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
fix: restrict heatmap data source picker to trace sources only
Heatmap charts require trace data (duration expression) to work properly. Non-trace sources would error out with no guidance. Instead of adding complex error messaging, filter the source dropdown to only show trace sources when heatmap display type is selected.
This commit is contained in:
parent
59b2476956
commit
a587ca25f7
2 changed files with 12 additions and 12 deletions
|
|
@ -99,6 +99,11 @@ export function ChartEditorControls({
|
|||
control={control}
|
||||
name="source"
|
||||
data-testid="source-selector"
|
||||
allowedSourceKinds={
|
||||
displayType === DisplayType.Heatmap
|
||||
? [SourceKind.Trace]
|
||||
: undefined
|
||||
}
|
||||
sourceSchemaPreview={
|
||||
<SourceSchemaPreview source={tableSource} variant="text" />
|
||||
}
|
||||
|
|
|
|||
|
|
@ -417,14 +417,11 @@ export default function EditTimeChartForm({
|
|||
}
|
||||
|
||||
if (displayType === DisplayType.Heatmap && Array.isArray(select)) {
|
||||
const traceSource =
|
||||
const defaultValue =
|
||||
tableSource?.kind === SourceKind.Trace &&
|
||||
tableSource.durationExpression
|
||||
? tableSource
|
||||
: undefined;
|
||||
const defaultValue = traceSource
|
||||
? getDurationMsExpression(traceSource)
|
||||
: (select[0]?.valueExpression ?? '');
|
||||
? getDurationMsExpression(tableSource)
|
||||
: (select[0]?.valueExpression ?? '');
|
||||
const heatmapSeries: SavedChartConfigWithSelectArray['select'] = [
|
||||
{
|
||||
aggFn: 'count',
|
||||
|
|
@ -436,12 +433,10 @@ export default function EditTimeChartForm({
|
|||
setValue('select', heatmapSeries);
|
||||
setValue('series', heatmapSeries);
|
||||
setValue('series.0.countExpression' as any, 'count()');
|
||||
if (traceSource) {
|
||||
setValue('numberFormat', {
|
||||
output: 'duration' as any,
|
||||
factor: 0.001,
|
||||
});
|
||||
}
|
||||
setValue('numberFormat', {
|
||||
output: 'duration' as any,
|
||||
factor: 0.001,
|
||||
});
|
||||
}
|
||||
|
||||
// Don't auto-submit when config type changes, to avoid clearing form state (like source)
|
||||
|
|
|
|||
Loading…
Reference in a new issue