2024-09-02 23:06:56 +08:00
|
|
|
import { FieldConfigProperty, PanelPlugin } from '@grafana/data';
|
2022-04-22 21:33:13 +08:00
|
|
|
|
2021-01-19 23:34:43 +08:00
|
|
|
import { NodeGraphPanel } from './NodeGraphPanel';
|
2022-06-23 21:20:56 +08:00
|
|
|
import { ArcOptionsEditor } from './editor/ArcOptionsEditor';
|
2024-02-27 20:28:17 +08:00
|
|
|
import { NodeGraphSuggestionsSupplier } from './suggestions';
|
2022-06-23 21:20:56 +08:00
|
|
|
import { NodeGraphOptions } from './types';
|
2021-01-19 23:34:43 +08:00
|
|
|
|
2024-02-27 20:28:17 +08:00
|
|
|
export const plugin = new PanelPlugin<NodeGraphOptions>(NodeGraphPanel)
|
2024-09-02 23:06:56 +08:00
|
|
|
.useFieldConfig({
|
|
|
|
disableStandardOptions: Object.values(FieldConfigProperty).filter((v) => v !== FieldConfigProperty.Links),
|
|
|
|
})
|
2024-02-27 20:28:17 +08:00
|
|
|
.setPanelOptions((builder, context) => {
|
|
|
|
builder.addNestedOptions({
|
|
|
|
category: ['Nodes'],
|
|
|
|
path: 'nodes',
|
|
|
|
build: (builder) => {
|
|
|
|
builder.addUnitPicker({
|
|
|
|
name: 'Main stat unit',
|
|
|
|
path: 'mainStatUnit',
|
|
|
|
});
|
|
|
|
builder.addUnitPicker({
|
|
|
|
name: 'Secondary stat unit',
|
|
|
|
path: 'secondaryStatUnit',
|
|
|
|
});
|
|
|
|
builder.addCustomEditor({
|
|
|
|
name: 'Arc sections',
|
|
|
|
path: 'arcs',
|
|
|
|
id: 'arcs',
|
|
|
|
editor: ArcOptionsEditor,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
builder.addNestedOptions({
|
|
|
|
category: ['Edges'],
|
|
|
|
path: 'edges',
|
|
|
|
build: (builder) => {
|
|
|
|
builder.addUnitPicker({
|
|
|
|
name: 'Main stat unit',
|
|
|
|
path: 'mainStatUnit',
|
|
|
|
});
|
|
|
|
builder.addUnitPicker({
|
|
|
|
name: 'Secondary stat unit',
|
|
|
|
path: 'secondaryStatUnit',
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.setSuggestionsSupplier(new NodeGraphSuggestionsSupplier());
|