/// import coreModule from "app/core/core_module"; export class ThresholdFormCtrl { panelCtrl: any; panel: any; disabled: boolean; /** @ngInject */ constructor($scope) { this.panel = this.panelCtrl.panel; if (this.panel.alert) { this.disabled = true; } var unbindDestroy = $scope.$on("$destroy", () => { this.panelCtrl.editingThresholds = false; this.panelCtrl.render(); unbindDestroy(); }); this.panelCtrl.editingThresholds = true; } addThreshold() { this.panel.thresholds.push({ value: undefined, colorMode: "critical", op: "gt", fill: true, line: true }); this.panelCtrl.render(); } removeThreshold(index) { this.panel.thresholds.splice(index, 1); this.panelCtrl.render(); } render() { this.panelCtrl.render(); } onFillColorChange(index) { return newColor => { this.panel.thresholds[index].fillColor = newColor; this.render(); }; } onLineColorChange(index) { return newColor => { this.panel.thresholds[index].lineColor = newColor; this.render(); }; } } var template = `
Thresholds

Visual thresholds options disabled. Visit the Alert tab update your thresholds.
To re-enable thresholds, the alert rule must be deleted from this panel.

`; coreModule.directive("graphThresholdForm", function() { return { restrict: "E", template: template, controller: ThresholdFormCtrl, bindToController: true, controllerAs: "ctrl", scope: { panelCtrl: "=" } }; });