11import { FieldOverrideContext , getFieldDisplayName , PanelPlugin , FieldConfigProperty } from '@grafana/data' ;
2- import { standardOptionsCompat } from 'grafana-plugin-support' ;
2+ // import { standardOptionsCompat } from 'grafana-plugin-support';
33import { MatrixOptions } from './types' ;
44import { EsnetMatrix } from './EsnetMatrix' ;
5+ // import { FieldConfig } from './panelcfg.gen';
56
67/**
78 * Grafana panel plugin main module
@@ -20,15 +21,28 @@ const urlBool = (addUrl: boolean) => (config: MatrixOptions) => config.addUrl ==
2021const staticBool = ( inputList : boolean ) => ( config : MatrixOptions ) => config . inputList === inputList ;
2122const legendBool = ( showLegend : boolean ) => ( config : MatrixOptions ) => config . showLegend === showLegend ;
2223
23- const buildStandardOptions = ( ) : any => {
24- const options = [ FieldConfigProperty . Unit , FieldConfigProperty . Color , FieldConfigProperty . Thresholds ] ;
25- return standardOptionsCompat ( options ) ;
26- } ;
24+ // const buildStandardOptions = (): any => {
25+ // const options = [FieldConfigProperty.Unit, FieldConfigProperty.Color, FieldConfigProperty.Thresholds];
26+ // return standardOptionsCompat(options);
27+ // };
2728
2829export const plugin = new PanelPlugin < MatrixOptions > ( EsnetMatrix ) ;
30+
2931plugin . useFieldConfig ( {
30- standardOptions : buildStandardOptions ( ) ,
32+ standardOptions : {
33+ [ FieldConfigProperty . Thresholds ] : { } ,
34+ [ FieldConfigProperty . Color ] : {
35+ settings : {
36+ preferThresholdMode : true ,
37+ }
38+ }
39+ } ,
40+ disableStandardOptions : [
41+ FieldConfigProperty . NoValue ,
42+ FieldConfigProperty . Links ,
43+ ]
3144} ) ;
45+
3246plugin . setPanelOptions ( ( builder ) => {
3347 /////////--------- Row and Column options ---------////////////////
3448 builder . addBooleanSwitch ( {
@@ -283,5 +297,3 @@ plugin.setPanelOptions((builder) => {
283297 // showIf: urlOtherBool(true),
284298 // });
285299} ) ;
286-
287- // .useFieldConfig({});
0 commit comments