Annotations: show host name as colored tag.

This commit is contained in:
Alexander Zobnin
2016-11-07 23:30:58 +03:00
parent 77e16b70a5
commit 2330a3ae08

View File

@@ -396,19 +396,20 @@ export class ZabbixAPIDatasource {
} }
return _.map(events, event => { return _.map(events, event => {
var title =''; let tags;
if (annotation.showHostname) { if (annotation.showHostname) {
title += event.hosts[0].name + ': '; tags = _.map(event.hosts, 'name');
} }
// Show event type (OK or Problem) // Show event type (OK or Problem)
title += Number(event.value) ? 'Problem' : 'OK'; let title = Number(event.value) ? 'Problem' : 'OK';
var formatted_acknowledges = utils.formatAcknowledges(event.acknowledges); let formatted_acknowledges = utils.formatAcknowledges(event.acknowledges);
return { return {
annotation: annotation, annotation: annotation,
time: event.clock * 1000, time: event.clock * 1000,
title: title, title: title,
tags: tags,
text: indexedTriggers[event.objectid].description + formatted_acknowledges text: indexedTriggers[event.objectid].description + formatted_acknowledges
}; };
}); });