module.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { PostgresDatasource } from './datasource';
  2. import { PostgresQueryCtrl } from './query_ctrl';
  3. class PostgresConfigCtrl {
  4. static templateUrl = 'partials/config.html';
  5. current: any;
  6. /** @ngInject **/
  7. constructor($scope) {
  8. this.current.jsonData.sslmode = this.current.jsonData.sslmode || 'verify-full';
  9. }
  10. /* the values are chosen to be equivalent to `select current_setting('server_version_num');` */
  11. postgresVersions = [
  12. { name: '8.0+', value: 80000 },
  13. { name: '8.1+', value: 80100 },
  14. ];
  15. }
  16. const defaultQuery = `SELECT
  17. extract(epoch from time_column) AS time,
  18. text_column as text,
  19. tags_column as tags
  20. FROM
  21. metric_table
  22. WHERE
  23. $__timeFilter(time_column)
  24. `;
  25. class PostgresAnnotationsQueryCtrl {
  26. static templateUrl = 'partials/annotations.editor.html';
  27. annotation: any;
  28. /** @ngInject **/
  29. constructor() {
  30. this.annotation.rawQuery = this.annotation.rawQuery || defaultQuery;
  31. }
  32. }
  33. export {
  34. PostgresDatasource,
  35. PostgresDatasource as Datasource,
  36. PostgresQueryCtrl as QueryCtrl,
  37. PostgresConfigCtrl as ConfigCtrl,
  38. PostgresAnnotationsQueryCtrl as AnnotationsQueryCtrl,
  39. };