From 993adb72e041814821141ad47f9b14134670add3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 19 Nov 2020 14:37:04 +0100 Subject: [PATCH] TimeRegions: Fixed issue with time regions and tresholds due to angular js upgrade (#29229) --- public/app/plugins/panel/graph/thresholds_form.ts | 6 ++++-- public/app/plugins/panel/graph/time_regions_form.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/public/app/plugins/panel/graph/thresholds_form.ts b/public/app/plugins/panel/graph/thresholds_form.ts index ac8a3c6006e..9b3ffa9f58d 100644 --- a/public/app/plugins/panel/graph/thresholds_form.ts +++ b/public/app/plugins/panel/graph/thresholds_form.ts @@ -7,14 +7,16 @@ export class ThresholdFormCtrl { disabled: boolean; /** @ngInject */ - constructor($scope: any) { + constructor(private $scope: any) {} + + $onInit() { this.panel = this.panelCtrl.panel; if (this.panel.alert) { this.disabled = true; } - const unbindDestroy = $scope.$on('$destroy', () => { + const unbindDestroy = this.$scope.$on('$destroy', () => { this.panelCtrl.editingThresholds = false; this.panelCtrl.render(); unbindDestroy(); diff --git a/public/app/plugins/panel/graph/time_regions_form.ts b/public/app/plugins/panel/graph/time_regions_form.ts index c7e3cdcea87..68a1ddcf6be 100644 --- a/public/app/plugins/panel/graph/time_regions_form.ts +++ b/public/app/plugins/panel/graph/time_regions_form.ts @@ -8,10 +8,12 @@ export class TimeRegionFormCtrl { colorModes: any; /** @ngInject */ - constructor($scope: any) { + constructor(private $scope: any) {} + + $onInit() { this.panel = this.panelCtrl.panel; - const unbindDestroy = $scope.$on('$destroy', () => { + const unbindDestroy = this.$scope.$on('$destroy', () => { this.panelCtrl.editingTimeRegions = false; this.panelCtrl.render(); unbindDestroy();