module.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { PanelPlugin } from '@grafana/data';
  2. import { commonOptionsBuilder } from '@grafana/ui';
  3. import { addOrientationOption, addStandardDataReduceOptions } from '../stat/types';
  4. import { gaugePanelMigrationHandler, gaugePanelChangedHandler } from './GaugeMigrations';
  5. import { GaugePanel } from './GaugePanel';
  6. import { GaugeSuggestionsSupplier } from './suggestions';
  7. import { GaugeOptions } from './types';
  8. export const plugin = new PanelPlugin<GaugeOptions>(GaugePanel)
  9. .useFieldConfig()
  10. .setPanelOptions((builder) => {
  11. addStandardDataReduceOptions(builder);
  12. addOrientationOption(builder);
  13. builder
  14. .addBooleanSwitch({
  15. path: 'showThresholdLabels',
  16. name: 'Show threshold labels',
  17. description: 'Render the threshold values around the gauge bar',
  18. defaultValue: false,
  19. })
  20. .addBooleanSwitch({
  21. path: 'showThresholdMarkers',
  22. name: 'Show threshold markers',
  23. description: 'Renders the thresholds as an outer bar',
  24. defaultValue: true,
  25. });
  26. commonOptionsBuilder.addTextSizeOptions(builder);
  27. })
  28. .setPanelChangeHandler(gaugePanelChangedHandler)
  29. .setSuggestionsSupplier(new GaugeSuggestionsSupplier())
  30. .setMigrationHandler(gaugePanelMigrationHandler);