feat(alerting): removed severity

This commit is contained in:
Torkel Ödegaard
2016-09-13 15:09:55 +02:00
parent 6375418d8c
commit b0c7e61ef8
23 changed files with 143 additions and 238 deletions

View File

@@ -38,9 +38,8 @@ var reducerTypes = [
var noDataModes = [
{text: 'OK', value: 'ok'},
{text: 'Critical', value: 'critical'},
{text: 'Warning', value: 'warning'},
{text: 'Unknown', value: 'unknown'},
{text: 'Alerting', value: 'alerting'},
{text: 'No Data', value: 'no_data'},
];
function createReducerPart(model) {
@@ -48,10 +47,6 @@ function createReducerPart(model) {
return new QueryPart(model, def);
}
var severityLevels = {
'critical': {text: 'Critical', iconClass: 'icon-gf icon-gf-critical', stateClass: 'alert-state-critical'},
'warning': {text: 'Warning', iconClass: 'icon-gf icon-gf-warning', stateClass: 'alert-state-warning'},
};
function getStateDisplayModel(state) {
switch (state) {
@@ -62,23 +57,16 @@ function getStateDisplayModel(state) {
stateClass: 'alert-state-ok'
};
}
case 'critical': {
case 'alerting': {
return {
text: 'CRITICAL',
text: 'ALERTING',
iconClass: 'icon-gf icon-gf-critical',
stateClass: 'alert-state-critical'
};
}
case 'warning': {
case 'no_data': {
return {
text: 'WARNING',
iconClass: 'icon-gf icon-gf-warning',
stateClass: 'alert-state-warning'
};
}
case 'unknown': {
return {
text: 'UNKNOWN',
text: 'NO DATA',
iconClass: "fa fa-question",
stateClass: 'alert-state-warning'
};
@@ -106,7 +94,6 @@ export default {
getStateDisplayModel: getStateDisplayModel,
conditionTypes: conditionTypes,
evalFunctions: evalFunctions,
severityLevels: severityLevels,
noDataModes: noDataModes,
reducerTypes: reducerTypes,
createReducerPart: createReducerPart,

View File

@@ -13,9 +13,8 @@ export class AlertListCtrl {
stateFilters = [
{text: 'All', value: null},
{text: 'OK', value: 'ok'},
{text: 'Unknown', value: 'unknown'},
{text: 'Warning', value: 'warning'},
{text: 'Critical', value: 'critical'},
{text: 'Alerting', value: 'alerting'},
{text: 'No Data', value: 'no_data'},
{text: 'Execution Error', value: 'execution_error'},
];

View File

@@ -17,7 +17,6 @@ export class AlertTabCtrl {
alert: any;
conditionModels: any;
evalFunctions: any;
severityLevels: any;
noDataModes: any;
addNotificationSegment;
notifications;
@@ -41,7 +40,6 @@ export class AlertTabCtrl {
this.subTabIndex = 0;
this.evalFunctions = alertDef.evalFunctions;
this.conditionTypes = alertDef.conditionTypes;
this.severityLevels = alertDef.severityLevels;
this.noDataModes = alertDef.noDataModes;
this.appSubUrl = config.appSubUrl;
}
@@ -155,8 +153,7 @@ export class AlertTabCtrl {
alert.conditions.push(this.buildDefaultCondition());
}
alert.noDataState = alert.noDataState || 'unknown';
alert.severity = alert.severity || 'critical';
alert.noDataState = alert.noDataState || 'no_data';
alert.frequency = alert.frequency || '60s';
alert.handler = alert.handler || 1;
alert.notifications = alert.notifications || [];
@@ -321,11 +318,6 @@ export class AlertTabCtrl {
this.panelCtrl.render();
}
severityChanged() {
ThresholdMapper.alertToGraphThresholds(this.panel);
this.panelCtrl.render();
}
evaluatorTypeChanged(evaluator) {
// ensure params array is correct length
switch (evaluator.type) {

View File

@@ -29,18 +29,8 @@
<div class="gf-form">
<span class="gf-form-label width-8">Name</span>
<input type="text" class="gf-form-input width-25" ng-model="ctrl.alert.name">
</div>
<div class="gf-form-inline">
<div class="gf-form">
<span class="gf-form-label width-8">Evaluate every</span>
<input class="gf-form-input max-width-7" type="text" ng-model="ctrl.alert.frequency"></input>
</div>
<div class="gf-form">
<span class="gf-form-label">Severity</span>
<div class="gf-form-select-wrapper width-13">
<select class="gf-form-input" ng-model="ctrl.alert.severity" ng-options="key as value.text for (key, value) in ctrl.severityLevels" ng-change="ctrl.severityChanged()">
</select>
</div>
<span class="gf-form-label width-8">Evaluate every</span>
<input class="gf-form-input max-width-5" type="text" ng-model="ctrl.alert.frequency"></input>
</div>
</div>
</div>

View File

@@ -62,7 +62,7 @@ export class ThresholdMapper {
for (var t of panel.thresholds) {
t.fill = true;
t.line = true;
t.colorMode = panel.alert.severity;
t.colorMode = 'critical';
}
var updated = true;