module.ts 1.2 KB

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