module.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { PanelPlugin } from '@grafana/data';
  2. import { LiveChannelEditor } from './LiveChannelEditor';
  3. import { LivePanel } from './LivePanel';
  4. import { LivePanelOptions, MessageDisplayMode } from './types';
  5. export const plugin = new PanelPlugin<LivePanelOptions>(LivePanel).setPanelOptions((builder) => {
  6. builder.addCustomEditor({
  7. category: ['Channel'],
  8. id: 'channel',
  9. path: 'channel',
  10. name: 'Channel',
  11. editor: LiveChannelEditor,
  12. defaultValue: {},
  13. });
  14. builder
  15. .addRadio({
  16. path: 'message',
  17. name: 'Show Message',
  18. description: 'Display the last message received on this channel',
  19. settings: {
  20. options: [
  21. { value: MessageDisplayMode.Raw, label: 'Raw Text' },
  22. { value: MessageDisplayMode.JSON, label: 'JSON' },
  23. { value: MessageDisplayMode.Auto, label: 'Auto' },
  24. { value: MessageDisplayMode.None, label: 'None' },
  25. ],
  26. },
  27. defaultValue: MessageDisplayMode.JSON,
  28. })
  29. .addBooleanSwitch({
  30. path: 'publish',
  31. name: 'Show Publish',
  32. description: 'Display a form to publish values',
  33. defaultValue: false,
  34. });
  35. });