mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add a @grafana/runtime package with backendSrv interface (#16533)
grafana-runtime/tsconfig.json imports query to avoid a build error ¯\_(ツ)_/¯
This commit is contained in:
@@ -5,11 +5,12 @@ import coreModule from 'app/core/core_module';
|
||||
// Services & Utils
|
||||
import config from 'app/core/config';
|
||||
import { importDataSourcePlugin } from './plugin_loader';
|
||||
import { DataSourceSrv as DataSourceService, getDataSourceSrv as getDataSourceService } from '@grafana/runtime';
|
||||
|
||||
// Types
|
||||
import { DataSourceApi, DataSourceSelectItem, ScopedVars } from '@grafana/ui/src/types';
|
||||
|
||||
export class DatasourceSrv {
|
||||
export class DatasourceSrv implements DataSourceService {
|
||||
datasources: { [name: string]: DataSourceApi };
|
||||
|
||||
/** @ngInject */
|
||||
@@ -175,14 +176,8 @@ export class DatasourceSrv {
|
||||
}
|
||||
}
|
||||
|
||||
let singleton: DatasourceSrv;
|
||||
|
||||
export function setDatasourceSrv(srv: DatasourceSrv) {
|
||||
singleton = srv;
|
||||
}
|
||||
|
||||
export function getDatasourceSrv(): DatasourceSrv {
|
||||
return singleton;
|
||||
return getDataSourceService() as DatasourceSrv;
|
||||
}
|
||||
|
||||
coreModule.service('datasourceSrv', DatasourceSrv);
|
||||
|
||||
Reference in New Issue
Block a user