Adapt annotations prototypes to calling convention of 2.5.1
From public/app/plugins/PLUGIN_CHANGES.md: 2.5.1 datasource annotationQuery changed. now single options parameter with: - range - rangeRaw - annotation
This commit is contained in:
@@ -336,24 +336,24 @@ function (angular, _, dateMath) {
|
|||||||
// Annotations //
|
// Annotations //
|
||||||
/////////////////
|
/////////////////
|
||||||
|
|
||||||
ZabbixAPIDatasource.prototype.annotationQuery = function(annotation, rangeUnparsed) {
|
ZabbixAPIDatasource.prototype.annotationQuery = function(options) {
|
||||||
var from = Math.ceil(dateMath.parse(rangeUnparsed.from) / 1000);
|
var from = Math.ceil(dateMath.parse(options.rangeRaw.from) / 1000);
|
||||||
var to = Math.ceil(dateMath.parse(rangeUnparsed.to) / 1000);
|
var to = Math.ceil(dateMath.parse(options.rangeRaw.to) / 1000);
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var params = {
|
var params = {
|
||||||
output: ['triggerid', 'description'],
|
output: ['triggerid', 'description'],
|
||||||
search: {
|
search: {
|
||||||
'description': annotation.trigger
|
'description': options.annotation.trigger
|
||||||
},
|
},
|
||||||
searchWildcardsEnabled: true,
|
searchWildcardsEnabled: true,
|
||||||
expandDescription: true
|
expandDescription: true
|
||||||
};
|
};
|
||||||
if (annotation.host) {
|
if (options.annotation.host) {
|
||||||
params.host = templateSrv.replace(annotation.host);
|
params.host = templateSrv.replace(options.annotation.host);
|
||||||
}
|
}
|
||||||
else if (annotation.group) {
|
else if (options.annotation.group) {
|
||||||
params.group = templateSrv.replace(annotation.group);
|
params.group = templateSrv.replace(options.annotation.group);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.zabbixAPI.performZabbixAPIRequest('trigger.get', params)
|
return this.zabbixAPI.performZabbixAPIRequest('trigger.get', params)
|
||||||
@@ -369,7 +369,7 @@ function (angular, _, dateMath) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Show problem events only
|
// Show problem events only
|
||||||
if (!annotation.showOkEvents) {
|
if (!options.annotation.showOkEvents) {
|
||||||
params.value = 1;
|
params.value = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,7 +379,7 @@ function (angular, _, dateMath) {
|
|||||||
_.each(result, function(e) {
|
_.each(result, function(e) {
|
||||||
var formatted_acknowledges = zabbixHelperSrv.formatAcknowledges(e.acknowledges);
|
var formatted_acknowledges = zabbixHelperSrv.formatAcknowledges(e.acknowledges);
|
||||||
events.push({
|
events.push({
|
||||||
annotation: annotation,
|
annotation: options.annotation,
|
||||||
time: e.clock * 1000,
|
time: e.clock * 1000,
|
||||||
title: Number(e.value) ? 'Problem' : 'OK',
|
title: Number(e.value) ? 'Problem' : 'OK',
|
||||||
text: objects[e.objectid].description + formatted_acknowledges
|
text: objects[e.objectid].description + formatted_acknowledges
|
||||||
|
|||||||
Reference in New Issue
Block a user