Skip to content

Commit b2db2b2

Browse files
committed
Added OR to alert_tab
1 parent 6e94cce commit b2db2b2

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

public/app/features/alerting/alert_def.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ var evalFunctions = [
2828
{text: 'HAS NO VALUE' , value: 'no_value'}
2929
];
3030

31+
var evalOperators = [
32+
{text: 'OR', value: 'or'},
33+
{text: 'AND', value: 'and'},
34+
];
35+
3136
var reducerTypes = [
3237
{text: 'avg()', value: 'avg'},
3338
{text: 'min()', value: 'min'},
@@ -116,6 +121,7 @@ export default {
116121
getStateDisplayModel: getStateDisplayModel,
117122
conditionTypes: conditionTypes,
118123
evalFunctions: evalFunctions,
124+
evalOperators: evalOperators,
119125
noDataModes: noDataModes,
120126
executionErrorModes: executionErrorModes,
121127
reducerTypes: reducerTypes,

public/app/features/alerting/alert_tab_ctrl.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class AlertTabCtrl {
1818
alert: any;
1919
conditionModels: any;
2020
evalFunctions: any;
21+
evalOperators: any;
2122
noDataModes: any;
2223
executionErrorModes: any;
2324
addNotificationSegment;
@@ -41,6 +42,7 @@ export class AlertTabCtrl {
4142
this.$scope.ctrl = this;
4243
this.subTabIndex = 0;
4344
this.evalFunctions = alertDef.evalFunctions;
45+
this.evalOperators = alertDef.evalOperators;
4446
this.conditionTypes = alertDef.conditionTypes;
4547
this.noDataModes = alertDef.noDataModes;
4648
this.executionErrorModes = alertDef.executionErrorModes;
@@ -194,6 +196,7 @@ export class AlertTabCtrl {
194196
query: {params: ['A', '5m', 'now']},
195197
reducer: {type: 'avg', params: []},
196198
evaluator: {type: 'gt', params: [null]},
199+
operator: {type: 'and'},
197200
};
198201
}
199202

@@ -250,6 +253,7 @@ export class AlertTabCtrl {
250253
cm.queryPart = new QueryPart(source.query, alertDef.alertQueryDef);
251254
cm.reducerPart = alertDef.createReducerPart(source.reducer);
252255
cm.evaluator = source.evaluator;
256+
cm.operator = source.operator;
253257

254258
return cm;
255259
}

public/app/features/alerting/partials/alert_tab.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h5 class="section-heading">Alert Config</h5>
3838
<h5 class="section-heading">Conditions</h5>
3939
<div class="gf-form-inline" ng-repeat="conditionModel in ctrl.conditionModels">
4040
<div class="gf-form">
41-
<span class="gf-form-label query-keyword width-5" ng-if="$index">AND</span>
41+
<metric-segment-model css-class="query-keyword" ng-if="$index" property="conditionModel.operator.type" options="ctrl.evalOperators" custom="false"></metric-segment-model>
4242
<span class="gf-form-label query-keyword width-5" ng-if="$index===0">WHEN</span>
4343
</div>
4444
<div class="gf-form">

0 commit comments

Comments
 (0)