grafana/public/app/angular/services/UtilSrv.ts
Jack Westbrook 3a7623753b
Build: Replace babel-loader with esbuild-loader (#57837)
* build(webpack): replace babel-loader with esbuild-loader

* build(webpack): add esbuild minifier to production builds

* Wip

* Removed ngInject and replaced with manual inject params

* chore: bump esbuild to 0.15.13

* Fixed angular issues

* build(frontend): update esbuild to 0.16.16

* chore(webpack): support browserslist for esbuild

* build(esbuild): unify versions of esbuild to 0.16.17 and esbuild-loader to 2.21.0

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2023-01-23 12:15:05 +01:00

37 lines
928 B
TypeScript

import { deprecationWarning } from '@grafana/data';
import { appEvents } from 'app/core/app_events';
import { HideModalEvent, ShowModalEvent } from '../../types/events';
/**
* Old legacy utilSrv exposed to angular services and handles angular modals.
* Not used by any core or known external plugin.
*/
export class UtilSrv {
modalScope: any;
constructor() {}
init() {
appEvents.subscribe(ShowModalEvent, (e) => this.showModal(e.payload));
appEvents.subscribe(HideModalEvent, this.hideModal.bind(this));
}
/**
* @deprecated use showModalReact instead that has this capability built in
*/
hideModal() {
deprecationWarning('UtilSrv', 'hideModal', '');
if (this.modalScope && this.modalScope.dismiss) {
this.modalScope.dismiss();
}
}
/**
* @deprecated
*/
showModal(options: any) {
deprecationWarning('UtilSrv', 'showModal', 'publish ShowModalReactEvent');
}
}