module.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 value portion is derived from postgres server_version_num/100
  11. postgresVersions = [
  12. { name: '9.3.x', value: 903 },
  13. { name: '9.4.x', value: 904 },
  14. { name: '9.5.x', value: 905 },
  15. { name: '9.6.x', value: 906 },
  16. ];
  17. }
  18. const defaultQuery = `SELECT
  19. extract(epoch from time_column) AS time,
  20. text_column as text,
  21. tags_column as tags
  22. FROM
  23. metric_table
  24. WHERE
  25. $__timeFilter(time_column)
  26. `;
  27. class PostgresAnnotationsQueryCtrl {
  28. static templateUrl = 'partials/annotations.editor.html';
  29. annotation: any;
  30. /** @ngInject **/
  31. constructor() {
  32. this.annotation.rawQuery = this.annotation.rawQuery || defaultQuery;
  33. }
  34. }
  35. export {
  36. PostgresDatasource,
  37. PostgresDatasource as Datasource,
  38. PostgresQueryCtrl as QueryCtrl,
  39. PostgresConfigCtrl as ConfigCtrl,
  40. PostgresAnnotationsQueryCtrl as AnnotationsQueryCtrl,
  41. };