Merge branch '3.2' into 3.2-issue-370

This commit is contained in:
Javier Castro 2018-06-07 14:53:45 +02:00 committed by GitHub
commit d0b3b520b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 14 deletions

View File

@ -20,7 +20,9 @@ app.controller('agentsPreviewController', function ($scope, $rootScope, $routePa
$scope.agents = Agents;
$scope.status = 'all';
$scope.osPlatform = 'all';
$scope.version = 'all'
$scope.osPlatforms = [];
$scope.versions = [];
$scope.groups = [];
$scope.nodes = [];
$scope.node_name = 'all';
@ -59,6 +61,8 @@ app.controller('agentsPreviewController', function ($scope, $rootScope, $routePa
} else if(filter.includes('node-')){
$scope.agents.addFilter('node',filter.split('node-')[1]);
} else if(filter.includes('version-')) {
$scope.agents.addFilter('version',filter.split('version-')[1]);
} else {
const platform = filter.split(' - ')[0];
const version = filter.split(' - ')[1];
@ -75,6 +79,7 @@ app.controller('agentsPreviewController', function ($scope, $rootScope, $routePa
if(agent.id === '000') continue;
if(agent.group && !$scope.groups.includes(agent.group)) $scope.groups.push(agent.group);
if(agent.node_name && !$scope.nodes.includes(agent.node_name)) $scope.nodes.push(agent.node_name);
if(agent.version && !$scope.versions.includes(agent.version)) $scope.versions.push(agent.version);
if(agent.os && agent.os.name){
const exists = $scope.osPlatforms.filter((e) => e.name === agent.os.name && e.platform === agent.os.platform && e.version === agent.os.version);
if(!exists.length){

View File

@ -43,7 +43,7 @@ app.controller('agentsController', function ($timeout, $scope, $location, $rootS
$scope.tab = "general";
$location.search("tab", "general");
}
tabHistory.push($scope.tab)
if($scope.tab !== 'configuration' && $scope.tab !== 'welcome') tabHistory.push($scope.tab)
// Metrics Audit
const metricsAudit = {
@ -214,14 +214,14 @@ app.controller('agentsController', function ($timeout, $scope, $location, $rootS
// Switch tab
$scope.switchTab = (tab, force = false) => {
tabHistory.push(tab)
if (tabHistory.length > 3) tabHistory = tabHistory.slice(-3);
if(tab !== 'configuration' && tab !== 'welcome') tabHistory.push(tab)
if (tabHistory.length > 2) tabHistory = tabHistory.slice(-2);
tabVisualizations.setTab(tab);
if ($scope.tab === tab && !force) return;
const onlyAgent = $scope.tab === tab && force;
const sameTab = $scope.tab === tab;
$location.search('tab', tab);
const preserveDiscover = tabHistory.length === 3 && tabHistory[0] === tabHistory[2] && tabHistory[1] === 'configuration';
const preserveDiscover = tabHistory.length === 2 && tabHistory[0] === tabHistory[1];
$scope.tab = tab;
if($scope.tab === 'configuration'){
@ -360,15 +360,6 @@ app.controller('agentsController', function ($timeout, $scope, $location, $rootS
return;
}
//Load
try {
if($scope.tab !== 'configuration'){
$scope.getAgent();
}
$scope.agentsAutoComplete.nextPage('');
} catch (e) {
errorHandler.handle('Unexpected exception loading controller','Agents');
}
//Destroy
$scope.$on("$destroy", () => {
@ -539,4 +530,13 @@ app.controller('agentsController', function ($timeout, $scope, $location, $rootS
errorHandler.handle(error, 'Reporting')
}
}
//Load
try {
$scope.getAgent();
$scope.agentsAutoComplete.nextPage('');
} catch (e) {
errorHandler.handle('Unexpected exception loading controller','Agents');
}
});

View File

@ -68,7 +68,7 @@
</select>
</div>
<div flex="20" layout="column" class="height-40 wz-margin-top-17 wz-select-input">
<div flex="20" layout="column" class="height-40 wz-margin-top-17 wz-select-input wz-margin-right-15">
<select flex class="kuiSelect wz-border-none cursor-pointer" id="eventBox" ng-model="osPlatform" ng-change="applyFilters(osPlatform)" aria-label="Filter by operative system">
<option value="all">All OS platforms</option>
<option ng-repeat='platform in osPlatforms' value="{{platform.platform}} - {{platform.version}}">
@ -76,6 +76,14 @@
</option>
</select>
</div>
<div flex="20" layout="column" class="height-40 wz-margin-top-17 wz-select-input">
<select flex class="kuiSelect wz-border-none cursor-pointer" id="eventBox" ng-model="version" ng-change="applyFilters('version-' + version)" aria-label="Filter by Wazuh version">
<option value="all">All versions</option>
<option ng-repeat='version in versions' value="{{version}}">
{{version}}
</option>
</select>
</div>
<!-- This will work once the Wazuh API implements this feature -->
<!--<div flex="20" layout="column" class="height-40 md-block md-whiteframe-z1 wz-margin-top-17 wz-select-input">
<select flex class="kuiSelect wz-border-none cursor-pointer" id="eventBox" ng-model="group" ng-change="applyFilters('group-' + group)" aria-label="Filter by group">