mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
mysql: reading arbitrary SQL data in go is really strange, data is only in strings?
This commit is contained in:
@@ -7,24 +7,34 @@ export class MysqlDatasource {
|
||||
name: any;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(instanceSettings, private backendSrv) {
|
||||
constructor(instanceSettings, private backendSrv, private $q) {
|
||||
this.name = instanceSettings.name;
|
||||
this.id = instanceSettings.id;
|
||||
}
|
||||
|
||||
query(options) {
|
||||
var queries = _.filter(options.targets, item => {
|
||||
return item.hide !== true;
|
||||
}).map(item => {
|
||||
return {
|
||||
refId: item.refId,
|
||||
intervalMs: options.intervalMs,
|
||||
maxDataPoints: options.maxDataPoints,
|
||||
datasourceId: this.id,
|
||||
rawSql: item.rawSql,
|
||||
};
|
||||
});
|
||||
|
||||
if (queries.length === 0) {
|
||||
return this.$q.when({data: []});
|
||||
}
|
||||
|
||||
return this.backendSrv.post('/api/tsdb/query', {
|
||||
from: options.range.from.valueOf().toString(),
|
||||
to: options.range.to.valueOf().toString(),
|
||||
queries: [
|
||||
{
|
||||
"refId": "A",
|
||||
"intervalMs": options.intervalMs,
|
||||
"maxDataPoints": options.maxDataPoints,
|
||||
"datasourceId": this.id,
|
||||
}
|
||||
]
|
||||
queries: queries,
|
||||
}).then(res => {
|
||||
console.log('mysql response', res);
|
||||
|
||||
var data = [];
|
||||
if (res.results) {
|
||||
|
||||
Reference in New Issue
Block a user