Commit b2db2b26 by utkarshcmu

Added OR to alert_tab

parent 6e94ccea
...@@ -28,6 +28,11 @@ var evalFunctions = [ ...@@ -28,6 +28,11 @@ var evalFunctions = [
{text: 'HAS NO VALUE' , value: 'no_value'} {text: 'HAS NO VALUE' , value: 'no_value'}
]; ];
var evalOperators = [
{text: 'OR', value: 'or'},
{text: 'AND', value: 'and'},
];
var reducerTypes = [ var reducerTypes = [
{text: 'avg()', value: 'avg'}, {text: 'avg()', value: 'avg'},
{text: 'min()', value: 'min'}, {text: 'min()', value: 'min'},
...@@ -116,6 +121,7 @@ export default { ...@@ -116,6 +121,7 @@ export default {
getStateDisplayModel: getStateDisplayModel, getStateDisplayModel: getStateDisplayModel,
conditionTypes: conditionTypes, conditionTypes: conditionTypes,
evalFunctions: evalFunctions, evalFunctions: evalFunctions,
evalOperators: evalOperators,
noDataModes: noDataModes, noDataModes: noDataModes,
executionErrorModes: executionErrorModes, executionErrorModes: executionErrorModes,
reducerTypes: reducerTypes, reducerTypes: reducerTypes,
......
...@@ -18,6 +18,7 @@ export class AlertTabCtrl { ...@@ -18,6 +18,7 @@ export class AlertTabCtrl {
alert: any; alert: any;
conditionModels: any; conditionModels: any;
evalFunctions: any; evalFunctions: any;
evalOperators: any;
noDataModes: any; noDataModes: any;
executionErrorModes: any; executionErrorModes: any;
addNotificationSegment; addNotificationSegment;
...@@ -41,6 +42,7 @@ export class AlertTabCtrl { ...@@ -41,6 +42,7 @@ export class AlertTabCtrl {
this.$scope.ctrl = this; this.$scope.ctrl = this;
this.subTabIndex = 0; this.subTabIndex = 0;
this.evalFunctions = alertDef.evalFunctions; this.evalFunctions = alertDef.evalFunctions;
this.evalOperators = alertDef.evalOperators;
this.conditionTypes = alertDef.conditionTypes; this.conditionTypes = alertDef.conditionTypes;
this.noDataModes = alertDef.noDataModes; this.noDataModes = alertDef.noDataModes;
this.executionErrorModes = alertDef.executionErrorModes; this.executionErrorModes = alertDef.executionErrorModes;
...@@ -194,6 +196,7 @@ export class AlertTabCtrl { ...@@ -194,6 +196,7 @@ export class AlertTabCtrl {
query: {params: ['A', '5m', 'now']}, query: {params: ['A', '5m', 'now']},
reducer: {type: 'avg', params: []}, reducer: {type: 'avg', params: []},
evaluator: {type: 'gt', params: [null]}, evaluator: {type: 'gt', params: [null]},
operator: {type: 'and'},
}; };
} }
...@@ -250,6 +253,7 @@ export class AlertTabCtrl { ...@@ -250,6 +253,7 @@ export class AlertTabCtrl {
cm.queryPart = new QueryPart(source.query, alertDef.alertQueryDef); cm.queryPart = new QueryPart(source.query, alertDef.alertQueryDef);
cm.reducerPart = alertDef.createReducerPart(source.reducer); cm.reducerPart = alertDef.createReducerPart(source.reducer);
cm.evaluator = source.evaluator; cm.evaluator = source.evaluator;
cm.operator = source.operator;
return cm; return cm;
} }
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<h5 class="section-heading">Conditions</h5> <h5 class="section-heading">Conditions</h5>
<div class="gf-form-inline" ng-repeat="conditionModel in ctrl.conditionModels"> <div class="gf-form-inline" ng-repeat="conditionModel in ctrl.conditionModels">
<div class="gf-form"> <div class="gf-form">
<span class="gf-form-label query-keyword width-5" ng-if="$index">AND</span> <metric-segment-model css-class="query-keyword" ng-if="$index" property="conditionModel.operator.type" options="ctrl.evalOperators" custom="false"></metric-segment-model>
<span class="gf-form-label query-keyword width-5" ng-if="$index===0">WHEN</span> <span class="gf-form-label query-keyword width-5" ng-if="$index===0">WHEN</span>
</div> </div>
<div class="gf-form"> <div class="gf-form">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment