mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* WIP table cue model * WIP table types migration * refactor * WIP table cue * docs * veneer fix, docs * docs
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
import { VisualizationSuggestionsBuilder } from '@grafana/data';
|
|
import { TableFieldOptions } from '@grafana/schema';
|
|
import { SuggestionName } from 'app/types/suggestions';
|
|
|
|
import { PanelOptions } from './panelcfg.gen';
|
|
|
|
export class TableSuggestionsSupplier {
|
|
getSuggestionsForData(builder: VisualizationSuggestionsBuilder) {
|
|
const list = builder.getListAppender<PanelOptions, TableFieldOptions>({
|
|
name: SuggestionName.Table,
|
|
pluginId: 'table',
|
|
options: {},
|
|
fieldConfig: {
|
|
defaults: {
|
|
custom: {},
|
|
},
|
|
overrides: [],
|
|
},
|
|
cardOptions: {
|
|
previewModifier: (s) => {
|
|
s.fieldConfig!.defaults.custom!.minWidth = 50;
|
|
},
|
|
},
|
|
});
|
|
|
|
// If there are not data suggest table anyway but use icon instead of real preview
|
|
if (builder.dataSummary.fieldCount === 0) {
|
|
list.append({
|
|
cardOptions: {
|
|
imgSrc: 'public/app/plugins/panel/table/img/icn-table-panel.svg',
|
|
},
|
|
});
|
|
} else {
|
|
list.append({});
|
|
}
|
|
}
|
|
}
|