mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 18:32:23 +08:00
Types: Adds type safety to appEvents (#19418)
* Types: Add type safety to appEvents
This commit is contained in:
@ -9,9 +9,10 @@ import { DataSourceSrv as DataSourceService, getDataSourceSrv as getDataSourceSe
|
||||
|
||||
// Types
|
||||
import { DataSourceApi, DataSourceSelectItem } from '@grafana/ui';
|
||||
import { ScopedVars } from '@grafana/data';
|
||||
import { ScopedVars, AppEvents } from '@grafana/data';
|
||||
import { auto } from 'angular';
|
||||
import { TemplateSrv } from '../templating/template_srv';
|
||||
import { GrafanaRootScope } from 'app/routes/GrafanaCtrl';
|
||||
|
||||
export class DatasourceSrv implements DataSourceService {
|
||||
datasources: { [name: string]: DataSourceApi };
|
||||
@ -20,7 +21,7 @@ export class DatasourceSrv implements DataSourceService {
|
||||
constructor(
|
||||
private $q: any,
|
||||
private $injector: auto.IInjectorService,
|
||||
private $rootScope: any,
|
||||
private $rootScope: GrafanaRootScope,
|
||||
private templateSrv: TemplateSrv
|
||||
) {
|
||||
this.init();
|
||||
@ -86,7 +87,7 @@ export class DatasourceSrv implements DataSourceService {
|
||||
deferred.resolve(instance);
|
||||
})
|
||||
.catch(err => {
|
||||
this.$rootScope.appEvent('alert-error', [dsConfig.name + ' plugin failed', err.toString()]);
|
||||
this.$rootScope.appEvent(AppEvents.alertError, [dsConfig.name + ' plugin failed', err.toString()]);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
|
Reference in New Issue
Block a user