Replaced if statement by a trace deletion on main controller

This commit is contained in:
Jesús Ángel González 2018-04-20 09:29:13 +02:00 committed by Javier Castro
parent 45e794f5c7
commit c40dcb84d1
2 changed files with 3 additions and 23 deletions

View File

@ -285,6 +285,9 @@ app.controller('agentsController',
if($scope.tab === 'configuration'){
return $scope.getAgentConfig(newAgentId);
}
// Deleting app state traces in the url
$location.search('_a', null);
let id = null;
// They passed an id

View File

@ -331,29 +331,6 @@ function discoverController(
/////////////////////////////// WAZUH ///////////////////////////////////
////////////////////////////////////////////////////////////////////////////
/** Start of "Prevents from double agent" */
if($rootScope.agentsAutoCompleteFired){
$rootScope.agentsAutoCompleteFired = false;
if(!$rootScope.$$phase) $rootScope.$digest();
let agentsIncluded = [];
// Get all filters related to agent.id and store them on an array
queryFilter.getFilters().filter(item => {
if(item && item.query && item.query.match && typeof item.query.match['agent.id'] !== 'undefined') agentsIncluded.push(item);
});
// If the array has a length greater than 1 it means that there are more than one agent.id filter
if(agentsIncluded.length > 1) {
// Keep safe the last agent.id filter
const lastAgent = agentsIncluded.pop();
// Remove all the agent.id filters
agentsIncluded.filter(item => queryFilter.removeFilter(item));
// Add the safe kept agent.id filter
queryFilter.addFilters(lastAgent);
// Clear the temporary array
agentsIncluded = [];
}
}
/** End of "Prevents from double agent" */
$rootScope.discoverPendingUpdates = [];
$rootScope.discoverPendingUpdates.push($state.query, queryFilter.getFilters());
$rootScope.$broadcast('updateVis', $state.query, queryFilter.getFilters());