Add select events option

Added a option to select which events should be displayed, thus giving
the ability to have a trigger history, showing all the problem events as
well as the OK events.
This commit is contained in:
evandro-portugal
2016-01-20 15:17:54 -02:00
parent 96e9756109
commit b0b3e28017
3 changed files with 23 additions and 3 deletions

View File

@@ -112,6 +112,16 @@
ng-change="get_data()">
</select>
</li>
<li class="tight-form-item" style="width: 13em">
<strong>Show events</strong>
</li>
<li>
<select class="input-medium tight-form-input"
ng-model="panel.showEvents"
ng-options="f.text for f in showEventsFields track by f.value"
ng-change="get_data()">
</select>
</li>
</ul>
<div class="clearfix"></div>
</div>

View File

@@ -48,6 +48,12 @@ function (angular, app, _, $, config, PanelMeta) {
{ text: 'severity', value: 'priority' }
];
$scope.showEventsFields = [
{ text: 'all events', value: [0,1] },
{ text: 'Ok events', value: 0 },
{ text: 'Problem events', value: 1 }
];
var grafanaDefaultSeverity = [
{ priority: 0, severity: 'Not classified', color: '#B7DBAB', show: true },
{ priority: 1, severity: 'Information', color: '#82B5D8', show: true },
@@ -72,6 +78,7 @@ function (angular, app, _, $, config, PanelMeta) {
limit: 10,
showTriggers: 'all triggers',
sortTriggersBy: { text: 'last change', value: 'lastchange' },
showEvents: { text: 'Problem events', value: '1' },
triggerSeverity: grafanaDefaultSeverity
};
@@ -125,7 +132,8 @@ function (angular, app, _, $, config, PanelMeta) {
groupid,
hostid,
applicationids,
$scope.panel.triggers.name)
$scope.panel.triggers.name,
$scope.panel.showEvents.value)
.then(function(triggers) {
var promises = _.map(triggers, function (trigger) {
var lastchange = new Date(trigger.lastchange * 1000);