Added methods for getting trend from different api types. Added some

hacks for getting applications from different apis.
This commit is contained in:
Alexander Zobnin
2016-02-02 14:45:03 +03:00
parent 5f0f79da0f
commit fa10d76e2b
3 changed files with 34 additions and 3 deletions

View File

@@ -187,10 +187,14 @@ function (angular, _, utils) {
*/
function convertApplications(applications) {
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';
return {
name: key,
applicationids: _.map(value, 'applicationid'),
hosts: _.uniq(_.map(_.flatten(value, 'hosts'), 'hostid'))
hosts: _.uniq(_.map(_.flatten(value, hostField), 'hostid'))
};
});
}