module.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import InfluxDatasource from './datasource';
  2. import { InfluxQueryCtrl } from './query_ctrl';
  3. import { InfluxLogsQueryField } from './components/InfluxLogsQueryField';
  4. import InfluxStartPage from './components/InfluxStartPage';
  5. import {
  6. createChangeHandler,
  7. createResetHandler,
  8. PasswordFieldEnum,
  9. } from '../../../features/datasources/utils/passwordHandlers';
  10. import { DataSourcePlugin } from '@grafana/ui';
  11. class InfluxConfigCtrl {
  12. static templateUrl = 'partials/config.html';
  13. current: any;
  14. onPasswordReset: ReturnType<typeof createResetHandler>;
  15. onPasswordChange: ReturnType<typeof createChangeHandler>;
  16. constructor() {
  17. this.onPasswordReset = createResetHandler(this, PasswordFieldEnum.Password);
  18. this.onPasswordChange = createChangeHandler(this, PasswordFieldEnum.Password);
  19. this.current.jsonData.httpMode = this.current.jsonData.httpMode || 'GET';
  20. }
  21. httpMode = [{ name: 'GET', value: 'GET' }, { name: 'POST', value: 'POST' }];
  22. }
  23. class InfluxAnnotationsQueryCtrl {
  24. static templateUrl = 'partials/annotations.editor.html';
  25. }
  26. export const plugin = new DataSourcePlugin(InfluxDatasource)
  27. .setConfigCtrl(InfluxConfigCtrl)
  28. .setQueryCtrl(InfluxQueryCtrl)
  29. .setAnnotationQueryCtrl(InfluxAnnotationsQueryCtrl)
  30. .setExploreLogsQueryField(InfluxLogsQueryField)
  31. .setExploreStartPage(InfluxStartPage);