mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
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 './models.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({});
|
|
}
|
|
}
|
|
}
|