mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 23:33:29 +08:00

* kindsys: Adapt to new PanelCfg schema interface * building locally * Remove Panel prefix in cue files * Regenerate * Update imports * fixup! Merge branch 'remove-panel-prefix' into sdboyer/redundant-panelcfg-prefixes * Fix formatting --------- Co-authored-by: Ryan McKinley <ryantxu@gmail.com> Co-authored-by: Tania B <yalyna.ts@gmail.com>
39 lines
956 B
TypeScript
39 lines
956 B
TypeScript
import { VisualizationSuggestionsBuilder } from '@grafana/data';
|
|
import { config } from '@grafana/runtime';
|
|
|
|
import { prepareHeatmapData } from './fields';
|
|
import { Options, defaultOptions } from './types';
|
|
|
|
export class HeatmapSuggestionsSupplier {
|
|
getSuggestionsForData(builder: VisualizationSuggestionsBuilder) {
|
|
const { dataSummary } = builder;
|
|
|
|
if (
|
|
!builder.data?.series ||
|
|
!dataSummary.hasData ||
|
|
dataSummary.timeFieldCount < 1 ||
|
|
dataSummary.numberFieldCount < 2 ||
|
|
dataSummary.numberFieldCount > 10
|
|
) {
|
|
return;
|
|
}
|
|
|
|
const info = prepareHeatmapData(builder.data.series, undefined, defaultOptions, config.theme2);
|
|
if (!info || info.warning) {
|
|
return;
|
|
}
|
|
|
|
builder.getListAppender<Options, {}>({
|
|
name: '',
|
|
pluginId: 'heatmap',
|
|
options: {},
|
|
fieldConfig: {
|
|
defaults: {
|
|
custom: {},
|
|
},
|
|
overrides: [],
|
|
},
|
|
});
|
|
}
|
|
}
|