mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Simple query editor - a text area with a Show Help section. Validation for empty query and if the time_sec column is missing.
42 lines
949 B
TypeScript
42 lines
949 B
TypeScript
///<reference path="../../../headers/common.d.ts" />
|
|
|
|
import angular from 'angular';
|
|
import _ from 'lodash';
|
|
import {MysqlDatasource} from './datasource';
|
|
import {MysqlQueryCtrl} from './query_ctrl';
|
|
|
|
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,
|
|
};
|
|
|