Angular: Remove deprecated angular modal support and libs (#49781)

This commit is contained in:
Torkel Ödegaard
2022-05-31 08:19:29 +02:00
committed by GitHub
parent 056a1fec3d
commit 8fa8c9dc8b
5 changed files with 5 additions and 2173 deletions
+1 -9
View File
@@ -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) => {
+4 -32
View File
@@ -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');
}
}