mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): reduce states. Make exeuction result configurable.
ref #6444
This commit is contained in:
@@ -37,10 +37,14 @@ var reducerTypes = [
|
||||
];
|
||||
|
||||
var noDataModes = [
|
||||
{text: 'OK', value: 'ok'},
|
||||
{text: 'Alerting', value: 'alerting'},
|
||||
{text: 'No Data', value: 'no_data'},
|
||||
{text: 'Keep Last', value: 'keep_last'},
|
||||
{text: 'Keep Last State', value: 'keep_state'},
|
||||
];
|
||||
|
||||
var executionErrorModes = [
|
||||
{text: 'Alerting', value: 'alerting'},
|
||||
{text: 'Keep Last State', value: 'keep_state'},
|
||||
];
|
||||
|
||||
function createReducerPart(model) {
|
||||
@@ -48,7 +52,6 @@ function createReducerPart(model) {
|
||||
return new QueryPart(model, def);
|
||||
}
|
||||
|
||||
|
||||
function getStateDisplayModel(state) {
|
||||
switch (state) {
|
||||
case 'ok': {
|
||||
@@ -113,6 +116,7 @@ export default {
|
||||
conditionTypes: conditionTypes,
|
||||
evalFunctions: evalFunctions,
|
||||
noDataModes: noDataModes,
|
||||
executionErrorModes: executionErrorModes,
|
||||
reducerTypes: reducerTypes,
|
||||
createReducerPart: createReducerPart,
|
||||
joinEvalMatches: joinEvalMatches,
|
||||
|
||||
@@ -19,6 +19,7 @@ export class AlertTabCtrl {
|
||||
conditionModels: any;
|
||||
evalFunctions: any;
|
||||
noDataModes: any;
|
||||
executionErrorModes: any;
|
||||
addNotificationSegment;
|
||||
notifications;
|
||||
alertNotifications;
|
||||
@@ -42,6 +43,7 @@ export class AlertTabCtrl {
|
||||
this.evalFunctions = alertDef.evalFunctions;
|
||||
this.conditionTypes = alertDef.conditionTypes;
|
||||
this.noDataModes = alertDef.noDataModes;
|
||||
this.executionErrorModes = alertDef.executionErrorModes;
|
||||
this.appSubUrl = config.appSubUrl;
|
||||
}
|
||||
|
||||
@@ -140,6 +142,7 @@ export class AlertTabCtrl {
|
||||
}
|
||||
|
||||
alert.noDataState = alert.noDataState || 'no_data';
|
||||
alert.executionErrorState = alert.executionErrorState || 'alerting';
|
||||
alert.frequency = alert.frequency || '60s';
|
||||
alert.handler = alert.handler || 1;
|
||||
alert.notifications = alert.notifications || [];
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
<div class="gf-form-group">
|
||||
<div class="gf-form">
|
||||
<span class="gf-form-label">If no data points or all values are null</span>
|
||||
<span class="gf-form-label width-18">If no data points or all values are null</span>
|
||||
<span class="gf-form-label query-keyword">SET STATE TO</span>
|
||||
<div class="gf-form-select-wrapper">
|
||||
<select class="gf-form-input" ng-model="ctrl.alert.noDataState" ng-options="f.value as f.text for f in ctrl.noDataModes">
|
||||
@@ -90,6 +90,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gf-form">
|
||||
<span class="gf-form-label width-18">If query exeuction throws an error</span>
|
||||
<span class="gf-form-label query-keyword">SET STATE TO</span>
|
||||
<div class="gf-form-select-wrapper">
|
||||
<select class="gf-form-input" ng-model="ctrl.alert.executionErrorState" ng-options="f.value as f.text for f in ctrl.executionErrorModes">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-button-row">
|
||||
<button class="btn btn-inverse" ng-click="ctrl.test()">
|
||||
Test Rule
|
||||
|
||||
Reference in New Issue
Block a user