Migrate backendSrv to getBackendSrv, fix direct DB connection

This commit is contained in:
Alexander Zobnin
2020-03-20 17:03:49 +03:00
parent 58949be25e
commit dad0fd965d
14 changed files with 975 additions and 240 deletions

View File

@@ -1,4 +1,5 @@
import _ from 'lodash';
import { getBackendSrv } from '@grafana/runtime';
import { compactQuery } from '../../../utils';
import mysql from './mysql';
import postgres from './postgres';
@@ -17,8 +18,7 @@ export class SQLConnector extends DBConnector {
this.sqlDialect = null;
super.loadDBDataSource()
.then(ds => {
this.backendSrv = ds.backendSrv;
.then(() => {
this.loadSQLDialect();
});
}
@@ -96,7 +96,7 @@ export class SQLConnector extends DBConnector {
maxDataPoints: this.limit
};
return this.backendSrv.datasourceRequest({
return getBackendSrv().datasourceRequest({
url: '/api/tsdb/query',
method: 'POST',
data: {