Merge pull request #145 from evandro-portugal/grafana-3.0

Add select events option
This commit is contained in:
Alexander Zobnin
2016-01-21 19:22:00 +04:00
3 changed files with 23 additions and 3 deletions

View File

@@ -574,7 +574,7 @@ function (angular, _) {
return this.performZabbixAPIRequest('service.getsla', params);
};
p.getTriggers = function(limit, sortfield, groupids, hostids, applicationids, name) {
p.getTriggers = function(limit, sortfield, groupids, hostids, applicationids, name, showevents) {
var params = {
output: 'extend',
expandDescription: true,
@@ -582,7 +582,7 @@ function (angular, _) {
monitored: true,
//only_true: true,
filter: {
value: 1
value: [0,1]
},
search : {
description: name
@@ -600,6 +600,8 @@ function (angular, _) {
params.sortfield = sortfield;
}
params.filter.value = showevents;
return this.performZabbixAPIRequest('trigger.get', params);
};

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);