Added new function to go groups, added array of groups

This commit is contained in:
Jesús Ángel González 2018-03-13 13:35:58 +01:00 committed by Javier Castro
parent 0c2c72bbe1
commit 2d7c24898f

View File

@ -6,7 +6,7 @@ app.controller('agentsPreviewController', function ($scope,$rootScope, genericRe
$scope.status = 'all';
$scope.osPlatform = 'all';
$scope.osPlatforms = [];
$scope.groups = [];
$scope.mostActiveAgent = {
name: '',
id : ''
@ -25,6 +25,11 @@ app.controller('agentsPreviewController', function ($scope,$rootScope, genericRe
$scope.agents.filters = [];
if(filter.includes('Unknown')){
$scope.agents.addFilter('status','Never connected');
/** Pending API implementation */
//} else if(filter.includes('group-')){
// $scope.agents.addFilter('group',filter.split('group-')[1]);
} else {
const platform = filter.split(' - ')[0];
const version = filter.split(' - ')[1];
@ -38,7 +43,7 @@ app.controller('agentsPreviewController', function ($scope,$rootScope, genericRe
// Retrieve os list
const retrieveList = agents => {
for(let agent of agents){
if(agent.group && !$scope.groups.includes(agent.group)) $scope.groups.push(agent.group);
if('os' in agent && 'name' in agent.os){
let exists = $scope.osPlatforms.filter((e) => e.name === agent.os.name && e.platform === agent.os.platform && e.version === agent.os.version);
if(!exists.length){
@ -103,6 +108,13 @@ app.controller('agentsPreviewController', function ($scope,$rootScope, genericRe
}
};
$scope.goGroup = agent => {
$rootScope.globalAgent = agent;
$rootScope.comeFrom = 'agents';
$location.search('tab', 'groups');
$location.path('/manager');
};
$scope.showAgent = agent => {
$rootScope.globalAgent = agent.id;
$rootScope.comeFrom = 'agentsPreview';