module.tsx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { PanelPlugin, LogsSortOrder, LogsDedupStrategy, LogsDedupDescription } from '@grafana/data';
  2. import { LogsPanel } from './LogsPanel';
  3. import { LogsPanelSuggestionsSupplier } from './suggestions';
  4. import { Options } from './types';
  5. export const plugin = new PanelPlugin<Options>(LogsPanel)
  6. .setPanelOptions((builder) => {
  7. builder
  8. .addBooleanSwitch({
  9. path: 'showTime',
  10. name: 'Time',
  11. description: '',
  12. defaultValue: false,
  13. })
  14. .addBooleanSwitch({
  15. path: 'showLabels',
  16. name: 'Unique labels',
  17. description: '',
  18. defaultValue: false,
  19. })
  20. .addBooleanSwitch({
  21. path: 'showCommonLabels',
  22. name: 'Common labels',
  23. description: '',
  24. defaultValue: false,
  25. })
  26. .addBooleanSwitch({
  27. path: 'wrapLogMessage',
  28. name: 'Wrap lines',
  29. description: '',
  30. defaultValue: false,
  31. })
  32. .addBooleanSwitch({
  33. path: 'prettifyLogMessage',
  34. name: 'Prettify JSON',
  35. description: '',
  36. defaultValue: false,
  37. })
  38. .addBooleanSwitch({
  39. path: 'enableLogDetails',
  40. name: 'Enable log details',
  41. description: '',
  42. defaultValue: true,
  43. })
  44. .addRadio({
  45. path: 'dedupStrategy',
  46. name: 'Deduplication',
  47. description: '',
  48. settings: {
  49. options: [
  50. { value: LogsDedupStrategy.none, label: 'None', description: LogsDedupDescription[LogsDedupStrategy.none] },
  51. {
  52. value: LogsDedupStrategy.exact,
  53. label: 'Exact',
  54. description: LogsDedupDescription[LogsDedupStrategy.exact],
  55. },
  56. {
  57. value: LogsDedupStrategy.numbers,
  58. label: 'Numbers',
  59. description: LogsDedupDescription[LogsDedupStrategy.numbers],
  60. },
  61. {
  62. value: LogsDedupStrategy.signature,
  63. label: 'Signature',
  64. description: LogsDedupDescription[LogsDedupStrategy.signature],
  65. },
  66. ],
  67. },
  68. defaultValue: LogsDedupStrategy.none,
  69. })
  70. .addRadio({
  71. path: 'sortOrder',
  72. name: 'Order',
  73. description: '',
  74. settings: {
  75. options: [
  76. { value: LogsSortOrder.Descending, label: 'Newest first' },
  77. { value: LogsSortOrder.Ascending, label: 'Oldest first' },
  78. ],
  79. },
  80. defaultValue: LogsSortOrder.Descending,
  81. });
  82. })
  83. .setSuggestionsSupplier(new LogsPanelSuggestionsSupplier());