Fixed undefined host names after lodash upgrade.

This commit is contained in:
Alexander Zobnin
2016-09-24 14:02:20 +03:00
parent aa882d752e
commit dc72bc2780

View File

@@ -230,13 +230,13 @@ angular.module('grafana.services').factory('QueryProcessor', function($q) {
// Group history by itemid // Group history by itemid
var grouped_history = _.groupBy(history, 'itemid'); var grouped_history = _.groupBy(history, 'itemid');
var hosts = _.groupBy(_.flatten(_.map(items, 'hosts')), 'hostid'); var hosts = _.flatten(_.map(items, 'hosts'));
return _.map(grouped_history, function(hist, itemid) { return _.map(grouped_history, function(hist, itemid) {
var item = _.find(items, {'itemid': itemid}); var item = _.find(items, {'itemid': itemid});
var alias = item.name; var alias = item.name;
if (_.keys(hosts).length > 1 || addHostName) { if (_.keys(hosts).length > 1 || addHostName) {
var host = hosts[item.hostid]; var host = _.find(hosts, {'hostid': item.hostid});
alias = host.name + ": " + alias; alias = host.name + ": " + alias;
} }
return { return {