hongbo-miao/hongbomiao.com

View on GitHub
data-visualization/grafana/hm-panel-plugin/src/module.ts

Summary

Maintainability
A
1 hr
Test Coverage
import { PanelPlugin } from '@grafana/data';
import { SimpleOptions } from './types';
import HMPanel from './components/HMPanel';

export const plugin = new PanelPlugin<SimpleOptions>(HMPanel).setPanelOptions((builder) => {
  return builder
    .addTextInput({
      path: 'text',
      name: 'Simple text option',
      description: 'Description of panel option',
      defaultValue: 'Default value of text input option',
    })
    .addBooleanSwitch({
      path: 'showSeriesCount',
      name: 'Show series counter',
      defaultValue: false,
    })
    .addRadio({
      path: 'seriesCountSize',
      defaultValue: 'sm',
      name: 'Series counter size',
      settings: {
        options: [
          {
            value: 'sm',
            label: 'Small',
          },
          {
            value: 'md',
            label: 'Medium',
          },
          {
            value: 'lg',
            label: 'Large',
          },
        ],
      },
      showIf: (config) => config.showSeriesCount,
    });
});