mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { FieldConfigProperty, PanelPlugin } from '@grafana/data';
|
|
import { CanvasElementOptions } from 'app/features/canvas';
|
|
import { IconConfig, iconItem } from 'app/features/canvas/elements/icon';
|
|
|
|
import { optionBuilder } from '../canvas/editor/options';
|
|
|
|
import { IconPanel } from './IconPanel';
|
|
import { defaultPanelOptions, PanelOptions } from './models.gen';
|
|
|
|
export const plugin = new PanelPlugin<PanelOptions>(IconPanel)
|
|
.setNoPadding() // extend to panel edges
|
|
.useFieldConfig({
|
|
standardOptions: {
|
|
[FieldConfigProperty.Mappings]: {
|
|
settings: {
|
|
icon: true,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
.setPanelOptions((builder) => {
|
|
builder.addNestedOptions<CanvasElementOptions<IconConfig>>({
|
|
category: ['Icon'],
|
|
path: 'root',
|
|
|
|
// Dynamically fill the selected element
|
|
build: (builder, ctx) => {
|
|
iconItem.registerOptionsUI!(builder, ctx);
|
|
|
|
optionBuilder.addBackground(builder, ctx);
|
|
optionBuilder.addBorder(builder, ctx);
|
|
},
|
|
|
|
defaultValue: defaultPanelOptions.root as any,
|
|
});
|
|
});
|