From f2201f946193f9f753b084c87f2a8bfd13ffa78c Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 13 Feb 2016 00:34:17 +0300 Subject: [PATCH] Iss #148 - fixed applications handling for Zabbix 2.2. --- plugins/datasource-zabbix/zabbixCache.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/datasource-zabbix/zabbixCache.js b/plugins/datasource-zabbix/zabbixCache.js index abe4fe3..8c8aafe 100644 --- a/plugins/datasource-zabbix/zabbixCache.js +++ b/plugins/datasource-zabbix/zabbixCache.js @@ -189,7 +189,11 @@ function (angular, _, utils) { return _.map(_.groupBy(applications, 'name'), function(value, key) { // Hack for supporting different apis (2.2 vs 2.4 vs 3.0) - var hostField = value['hosts'] ? 'hosts' : 'host'; + var hostField = 'host'; + if (value[0] && value[0]['hosts']) { + // For Zabbix 2.2 + hostField = 'hosts'; + } return { name: key,