mirror of
https://github.com/grafana/grafana.git
synced 2026-09-05 04:40:13 -05:00
Angular: Remove deprecated angular modal support and libs (#49781)
This commit is contained in:
@@ -3,7 +3,6 @@ import 'angular-route';
|
||||
import 'angular-sanitize';
|
||||
import 'angular-bindonce';
|
||||
import 'vendor/bootstrap/bootstrap';
|
||||
import 'vendor/angular-other/angular-strap';
|
||||
|
||||
import angular from 'angular'; // eslint-disable-line no-duplicate-imports
|
||||
import { extend } from 'lodash';
|
||||
@@ -78,14 +77,7 @@ export class AngularApp {
|
||||
}
|
||||
);
|
||||
|
||||
this.ngModuleDependencies = [
|
||||
'grafana.core',
|
||||
'ngSanitize',
|
||||
'$strap.directives',
|
||||
'grafana',
|
||||
'pasvaz.bindonce',
|
||||
'react',
|
||||
];
|
||||
this.ngModuleDependencies = ['grafana.core', 'ngSanitize', 'grafana', 'pasvaz.bindonce', 'react'];
|
||||
|
||||
// makes it possible to add dynamic stuff
|
||||
angularModules.forEach((m: angular.IModule) => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { deprecationWarning } from '@grafana/data';
|
||||
import { GrafanaRootScope } from 'app/angular/GrafanaCtrl';
|
||||
import { appEvents } from 'app/core/app_events';
|
||||
|
||||
import { HideModalEvent, ShowModalEvent } from '../../types/events';
|
||||
@@ -12,7 +11,7 @@ export class UtilSrv {
|
||||
modalScope: any;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(private $rootScope: GrafanaRootScope, private $modal: any) {}
|
||||
constructor() {}
|
||||
|
||||
init() {
|
||||
appEvents.subscribe(ShowModalEvent, (e) => this.showModal(e.payload));
|
||||
@@ -23,43 +22,16 @@ export class UtilSrv {
|
||||
* @deprecated use showModalReact instead that has this capability built in
|
||||
*/
|
||||
hideModal() {
|
||||
deprecationWarning('UtilSrv', 'hideModal', 'showModalReact');
|
||||
deprecationWarning('UtilSrv', 'hideModal', '');
|
||||
if (this.modalScope && this.modalScope.dismiss) {
|
||||
this.modalScope.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use showModalReact instead
|
||||
* @deprecated
|
||||
*/
|
||||
showModal(options: any) {
|
||||
deprecationWarning('UtilSrv', 'showModal', 'showModalReact');
|
||||
if (this.modalScope && this.modalScope.dismiss) {
|
||||
this.modalScope.dismiss();
|
||||
}
|
||||
|
||||
this.modalScope = options.scope;
|
||||
|
||||
if (options.model) {
|
||||
this.modalScope = this.$rootScope.$new();
|
||||
this.modalScope.model = options.model;
|
||||
} else if (!this.modalScope) {
|
||||
this.modalScope = this.$rootScope.$new();
|
||||
}
|
||||
|
||||
const modal = this.$modal({
|
||||
modalClass: options.modalClass,
|
||||
template: options.src,
|
||||
templateHtml: options.templateHtml,
|
||||
persist: false,
|
||||
show: false,
|
||||
scope: this.modalScope,
|
||||
keyboard: false,
|
||||
backdrop: options.backdrop,
|
||||
});
|
||||
|
||||
Promise.resolve(modal).then((modalEl) => {
|
||||
modalEl.modal('show');
|
||||
});
|
||||
deprecationWarning('UtilSrv', 'showModal', 'publish ShowModalReactEvent');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user