mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 12:13:15 +08:00
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import { PostgresDatasource } from './datasource';
|
|
import { PostgresQueryCtrl } from './query_ctrl';
|
|
|
|
class PostgresConfigCtrl {
|
|
static templateUrl = 'partials/config.html';
|
|
|
|
current: any;
|
|
|
|
/** @ngInject **/
|
|
constructor($scope) {
|
|
this.current.jsonData.sslmode = this.current.jsonData.sslmode || 'verify-full';
|
|
}
|
|
|
|
// the value portion is derived from postgres server_version_num/100
|
|
postgresVersions = [
|
|
{ name: '9.3.x', value: 903 },
|
|
{ name: '9.4.x', value: 904 },
|
|
{ name: '9.5.x', value: 905 },
|
|
{ name: '9.6.x', value: 906 },
|
|
];
|
|
}
|
|
|
|
const defaultQuery = `SELECT
|
|
extract(epoch from time_column) AS time,
|
|
text_column as text,
|
|
tags_column as tags
|
|
FROM
|
|
metric_table
|
|
WHERE
|
|
$__timeFilter(time_column)
|
|
`;
|
|
|
|
class PostgresAnnotationsQueryCtrl {
|
|
static templateUrl = 'partials/annotations.editor.html';
|
|
|
|
annotation: any;
|
|
|
|
/** @ngInject **/
|
|
constructor() {
|
|
this.annotation.rawQuery = this.annotation.rawQuery || defaultQuery;
|
|
}
|
|
}
|
|
|
|
export {
|
|
PostgresDatasource,
|
|
PostgresDatasource as Datasource,
|
|
PostgresQueryCtrl as QueryCtrl,
|
|
PostgresConfigCtrl as ConfigCtrl,
|
|
PostgresAnnotationsQueryCtrl as AnnotationsQueryCtrl,
|
|
};
|