feat(thresholds): refactoring and adding many unit tests

This commit is contained in:
Torkel Ödegaard
2016-08-12 10:32:46 +02:00
parent 895cff78b6
commit 06210a4a22
6 changed files with 205 additions and 122 deletions

View File

@@ -129,7 +129,8 @@ export class AlertTabCtrl {
graphThresholdChanged(evt) {
for (var condition of this.alert.conditions) {
if (condition.type === 'query') {
condition.evaluator.params[0] = evt.threshold.value;
condition.evaluator.params[evt.handleIndex] = evt.threshold.value;
this.evaluatorParamsChanged();
break;
}
}
@@ -140,7 +141,7 @@ export class AlertTabCtrl {
type: 'query',
query: {params: ['A', '5m', 'now']},
reducer: {type: 'avg', params: []},
evaluator: {type: '>', params: [null]},
evaluator: {type: 'gt', params: [null]},
};
}
@@ -171,7 +172,7 @@ export class AlertTabCtrl {
}
delete() {
this.alert.enabled = false;
this.panel.alert = {enabled: false};
this.initModel();
}