angular_wrappers.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import { react2AngularDirective } from 'app/core/utils/react2angular';
  2. import { QueryEditor as StackdriverQueryEditor } from 'app/plugins/datasource/stackdriver/components/QueryEditor';
  3. import { AnnotationQueryEditor as StackdriverAnnotationQueryEditor } from 'app/plugins/datasource/stackdriver/components/AnnotationQueryEditor';
  4. import PageHeader from './components/PageHeader/PageHeader';
  5. import EmptyListCTA from './components/EmptyListCTA/EmptyListCTA';
  6. import { TagFilter } from './components/TagFilter/TagFilter';
  7. import { SideMenu } from './components/sidemenu/SideMenu';
  8. import { MetricSelect } from './components/Select/MetricSelect';
  9. import AppNotificationList from './components/AppNotifications/AppNotificationList';
  10. import { ColorPicker, SeriesColorPickerPopoverWithTheme, SecretFormField, DataLinksEditor } from '@grafana/ui';
  11. import { FunctionEditor } from 'app/plugins/datasource/graphite/FunctionEditor';
  12. import { SearchField } from './components/search/SearchField';
  13. import { GraphContextMenu } from 'app/plugins/panel/graph/GraphContextMenu';
  14. import ReactProfileWrapper from 'app/features/profile/ReactProfileWrapper';
  15. import { LokiAnnotationsQueryEditor } from '../plugins/datasource/loki/components/AnnotationsQueryEditor';
  16. export function registerAngularDirectives() {
  17. react2AngularDirective('sidemenu', SideMenu, []);
  18. react2AngularDirective('functionEditor', FunctionEditor, ['func', 'onRemove', 'onMoveLeft', 'onMoveRight']);
  19. react2AngularDirective('appNotificationsList', AppNotificationList, []);
  20. react2AngularDirective('pageHeader', PageHeader, ['model', 'noTabs']);
  21. react2AngularDirective('emptyListCta', EmptyListCTA, [
  22. 'title',
  23. 'buttonIcon',
  24. 'buttonLink',
  25. 'buttonTitle',
  26. ['onClick', { watchDepth: 'reference', wrapApply: true }],
  27. 'proTip',
  28. 'proTipLink',
  29. 'proTipLinkTitle',
  30. 'proTipTarget',
  31. 'infoBox',
  32. 'infoBoxTitle',
  33. ]);
  34. react2AngularDirective('searchField', SearchField, [
  35. 'query',
  36. 'autoFocus',
  37. ['onChange', { watchDepth: 'reference' }],
  38. ['onKeyDown', { watchDepth: 'reference' }],
  39. ]);
  40. react2AngularDirective('tagFilter', TagFilter, [
  41. 'tags',
  42. ['onChange', { watchDepth: 'reference' }],
  43. ['tagOptions', { watchDepth: 'reference' }],
  44. ]);
  45. react2AngularDirective('colorPicker', ColorPicker, [
  46. 'color',
  47. ['onChange', { watchDepth: 'reference', wrapApply: true }],
  48. ]);
  49. react2AngularDirective('seriesColorPickerPopover', SeriesColorPickerPopoverWithTheme, [
  50. 'color',
  51. 'series',
  52. 'onColorChange',
  53. 'onToggleAxis',
  54. ]);
  55. react2AngularDirective('metricSelect', MetricSelect, [
  56. 'options',
  57. 'onChange',
  58. 'value',
  59. 'isSearchable',
  60. 'className',
  61. 'placeholder',
  62. ['variables', { watchDepth: 'reference' }],
  63. ]);
  64. react2AngularDirective('stackdriverQueryEditor', StackdriverQueryEditor, [
  65. 'target',
  66. 'onQueryChange',
  67. 'onExecuteQuery',
  68. ['events', { watchDepth: 'reference' }],
  69. ['datasource', { watchDepth: 'reference' }],
  70. ['templateSrv', { watchDepth: 'reference' }],
  71. ]);
  72. react2AngularDirective('stackdriverAnnotationQueryEditor', StackdriverAnnotationQueryEditor, [
  73. 'target',
  74. 'onQueryChange',
  75. 'onExecuteQuery',
  76. ['datasource', { watchDepth: 'reference' }],
  77. ['templateSrv', { watchDepth: 'reference' }],
  78. ]);
  79. react2AngularDirective('secretFormField', SecretFormField, [
  80. 'value',
  81. 'isConfigured',
  82. 'inputWidth',
  83. 'labelWidth',
  84. ['onReset', { watchDepth: 'reference', wrapApply: true }],
  85. ['onChange', { watchDepth: 'reference', wrapApply: true }],
  86. ]);
  87. react2AngularDirective('graphContextMenu', GraphContextMenu, [
  88. 'x',
  89. 'y',
  90. 'items',
  91. ['onClose', { watchDepth: 'reference', wrapApply: true }],
  92. ['getContextMenuSource', { watchDepth: 'reference', wrapApply: true }],
  93. ['formatSourceDate', { watchDepth: 'reference', wrapApply: true }],
  94. ]);
  95. // We keep the drilldown terminology here because of as using data-* directive
  96. // being in conflict with HTML data attributes
  97. react2AngularDirective('drilldownLinksEditor', DataLinksEditor, [
  98. 'value',
  99. 'suggestions',
  100. ['onChange', { watchDepth: 'reference', wrapApply: true }],
  101. ]);
  102. react2AngularDirective('reactProfileWrapper', ReactProfileWrapper, []);
  103. react2AngularDirective('lokiAnnotationsQueryEditor', LokiAnnotationsQueryEditor, [
  104. 'expr',
  105. 'onChange',
  106. ['datasource', { watchDepth: 'reference' }],
  107. ]);
  108. }