60 lines
1.8 KiB
TypeScript
60 lines
1.8 KiB
TypeScript
import { FieldConfigProperty, PanelPlugin } from '@grafana/data';
|
|
|
|
import { NodeGraphPanel } from './NodeGraphPanel';
|
|
import { ArcOptionsEditor } from './editor/ArcOptionsEditor';
|
|
import { NodeGraphSuggestionsSupplier } from './suggestions';
|
|
import { NodeGraphOptions } from './types';
|
|
|
|
export const plugin = new PanelPlugin<NodeGraphOptions>(NodeGraphPanel)
|
|
.useFieldConfig({
|
|
disableStandardOptions: Object.values(FieldConfigProperty).filter((v) => v !== FieldConfigProperty.Links),
|
|
})
|
|
.setPanelOptions((builder, context) => {
|
|
builder.addSelect({
|
|
name: 'Zoom mode',
|
|
path: 'zoomMode',
|
|
defaultValue: 'cooperative',
|
|
settings: {
|
|
options: [
|
|
{ value: 'cooperative', label: 'Cooperative', description: 'Lets you scroll the page normally' },
|
|
{ value: 'greedy', label: 'Greedy', description: 'Reacts to all zoom gestures' },
|
|
],
|
|
},
|
|
});
|
|
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());
|