Skip to content

Commit

Permalink
Preserving consistency along the agent filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesús Ángel González committed Apr 24, 2018
1 parent 817d60b commit 2039cbb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 269 deletions.
267 changes: 0 additions & 267 deletions package-lock.json

This file was deleted.

18 changes: 16 additions & 2 deletions public/controllers/agents.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
import beautifier from 'plugins/wazuh/utils/json-beautifier';
import * as modules from 'ui/modules'
import rison from 'rison'

const app = modules.get('app/wazuh', []);

Expand Down Expand Up @@ -288,8 +289,21 @@ app.controller('agentsController',
return $scope.getAgentConfig(newAgentId);
}

// Deleting app state traces in the url
$location.search('_a', null);
try {
// Try to parse the _a trace and detect if there is any agent.id filter
// in order to delete it from the _a trace
const str = $location.search()._a;
if(str){
const decoded = rison.decode(str);
const tmp = decoded.filters.filter(item => !item.query.match['agent.id']);
decoded.filters = tmp;
const encoded = rison.encode(decoded);
$location.search('_a', encoded)
}
} catch (error) {
// If some rison.js related error is generated we simply clean the _a trace
$location.search('_a', null)
}
let id = null;

// They passed an id
Expand Down

0 comments on commit 2039cbb

Please sign in to comment.