mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): auto convert thresholds if existing
This commit is contained in:
parent
bc892789c1
commit
9c5b4e6f25
@ -7,15 +7,20 @@ import angular from 'angular';
|
||||
export class AlertTabCtrl {
|
||||
panel: any;
|
||||
panelCtrl: any;
|
||||
alerting: any;
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope) {
|
||||
$scope.alertTab = this;
|
||||
this.panelCtrl = $scope.ctrl;
|
||||
this.panel = this.panelCtrl.panel;
|
||||
this.alerting = this.alerting || {};
|
||||
|
||||
|
||||
this.convertThresholdsToAlertThresholds();
|
||||
}
|
||||
|
||||
convertThresholdsToAlerts() {
|
||||
convertThresholdsToAlertThresholds() {
|
||||
if (this.panel.grid && this.panel.grid.threshold1) {
|
||||
this.panel.alerting.warnLevel = '< ' + this.panel.grid.threshold1;
|
||||
}
|
||||
@ -34,7 +39,5 @@ export function graphAlertEditor() {
|
||||
scope: true,
|
||||
templateUrl: 'public/app/plugins/panel/graph/partials/tab_alerting.html',
|
||||
controller: AlertTabCtrl,
|
||||
//bindToController: true,
|
||||
//controllerAs: 'ctrl',
|
||||
};
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
</div>
|
||||
|
||||
<h5 class="section-heading">Thresholds</h5>
|
||||
<p ng-show="ctrl.panel.grid.threshold1 || ctrl.panel.grid.threshold2">We noticed you have existing threshholds.<a ng-click="alertTab.convertThresholdsToAlerts()">Convert them</a></p>
|
||||
<div class="gf-form">
|
||||
<span class="gf-form-label width-7">Warn level</span>
|
||||
<input class="gf-form-input max-width-7" type="text" ng-model="ctrl.panel.alerting.warnLevel"></input>
|
||||
|
Loading…
Reference in New Issue
Block a user