mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Angular: Fixing some annoying depreaction warnings (#36466)
This commit is contained in:
parent
a86ad1190c
commit
96a51561a3
@ -18,10 +18,14 @@ export class AngularLocationWrapper {
|
||||
this.url = this.wrapInDeprecationWarning(this.url);
|
||||
}
|
||||
|
||||
wrapInDeprecationWarning = (fn: Function, replacement?: string) => {
|
||||
deprecationWarning('$location', fn.name, replacement || 'locationService');
|
||||
return fn.bind(this);
|
||||
};
|
||||
wrapInDeprecationWarning(fn: Function, replacement?: string) {
|
||||
let self = this;
|
||||
|
||||
return function wrapper() {
|
||||
deprecationWarning('$location', fn.name, replacement || 'locationService');
|
||||
return fn.apply(self, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
absUrl(): string {
|
||||
return `${window.location.origin}${this.url()}`;
|
||||
|
@ -11,6 +11,7 @@ import {
|
||||
EventBusSrv,
|
||||
} from '@grafana/data';
|
||||
import { DashboardModel } from '../dashboard/state';
|
||||
import { AngularLocationWrapper } from 'app/angular/AngularLocationWrapper';
|
||||
|
||||
export class PanelCtrl {
|
||||
panel: any;
|
||||
@ -21,7 +22,6 @@ export class PanelCtrl {
|
||||
editorTabs: any;
|
||||
$scope: any;
|
||||
$injector: auto.IInjectorService;
|
||||
$location: any;
|
||||
$timeout: any;
|
||||
editModeInitiated = false;
|
||||
height: number;
|
||||
@ -30,15 +30,16 @@ export class PanelCtrl {
|
||||
events: EventBusExtended;
|
||||
loading = false;
|
||||
timing: any;
|
||||
$location: AngularLocationWrapper;
|
||||
|
||||
constructor($scope: any, $injector: auto.IInjectorService) {
|
||||
this.panel = this.panel ?? $scope.$parent.panel;
|
||||
this.dashboard = this.dashboard ?? $scope.$parent.dashboard;
|
||||
this.$injector = $injector;
|
||||
this.$location = $injector.get('$location');
|
||||
this.$scope = $scope;
|
||||
this.$timeout = $injector.get('$timeout');
|
||||
this.editorTabs = [];
|
||||
this.$location = new AngularLocationWrapper();
|
||||
this.events = new EventBusSrv();
|
||||
this.timing = {}; // not used but here to not break plugins
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user