mysql: annotation support. Fixes #8382

Simple query editor - a text area with a Show Help section.
Validation for empty query and if the time_sec column is missing.
This commit is contained in:
Daniel Lee
2017-05-22 22:18:20 +02:00
parent d47078e27f
commit 73cb035231
6 changed files with 201 additions and 18 deletions

View File

@@ -9,10 +9,33 @@ class MysqlConfigCtrl {
static templateUrl = 'partials/config.html';
}
const defaultQuery = `SELECT
UNIX_TIMESTAMP(<time_column>) as time_sec,
<title_column> as title,
<text_column> as text,
<tags_column> as tags
FROM <table name>
WHERE $__timeFilter(time_column)
ORDER BY <time_column> ASC
LIMIT 100
`;
class MysqlAnnotationsQueryCtrl {
static templateUrl = 'partials/annotations.editor.html';
annotation: any;
/** @ngInject **/
constructor() {
this.annotation.rawQuery = this.annotation.rawQuery || defaultQuery;
}
}
export {
MysqlDatasource,
MysqlDatasource as Datasource,
MysqlQueryCtrl as QueryCtrl,
MysqlConfigCtrl as ConfigCtrl,
MysqlAnnotationsQueryCtrl as AnnotationsQueryCtrl,
};