import coreModule from 'grafana/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 = `
Visual thresholds options disabled.
Visit the Alert tab update your thresholds.
To re-enable thresholds, the alert rule must be deleted from this panel.