Files
Sven Klemm b2d880c6de modify $__timeGroup macro so it can be used in select clause (#9527)
* modify $__timeGroup macro so it can be used in select clause

* fix $__interval_ms for postgres datasource

* use $__timeGroup macro in documentation

* fix annotation template query
remove title since its no longer used and add tags instead

* change __timeFilter macro to work on postgresql < 8.1 and redshift
2017-10-18 18:10:01 +02:00

46 lines
984 B
TypeScript

///<reference path="../../../headers/common.d.ts" />
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 || 'require';
}
}
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,
};