Minor bug fixes on overview and agents controllers

This commit is contained in:
Jesús Ángel González 2018-02-27 18:07:27 +01:00
parent 16aa78555f
commit e30970c173
3 changed files with 550 additions and 480 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,5 @@
const app = require('ui/modules').get('app/wazuh', []);
import $ from 'jquery';
//
app.controller('overviewController', function ($scope, $location, $rootScope, appState, genericReq, errorHandler) {
$rootScope.page = 'overview';
@ -15,7 +14,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
$scope.authSuccess = '';
const assignWatcher1 = () => {
watcher1 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-General-Metric-alerts > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-General-Metric-alerts\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-General-Metric-alerts\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.totalAlerts = newVal;
@ -25,7 +27,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
}
const assignWatcher2 = () => {
watcher2 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-General-Level-12-alerts > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-General-Level-12-alerts\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-General-Level-12-alerts\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.level12 = newVal;
@ -36,7 +41,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
const assignWatcher3 = () => {
watcher3 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-General-Authentication-failure > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-General-Authentication-failure\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-General-Authentication-failure\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.authFailure = newVal;
@ -47,7 +55,11 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
const assignWatcher4 = () => {
watcher4 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-General-Authentication-success > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
return $('[vis-id="\'Wazuh-App-Overview-General-Authentication-success\'"] > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-General-Authentication-success\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-General-Authentication-success\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.authSuccess = newVal;
@ -65,7 +77,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
const assignWatcher5 = () => {
watcher5 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-FIM-Added > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-FIM-Added\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-FIM-Added\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.fimAdded = newVal;
@ -75,7 +90,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
}
const assignWatcher6 = () => {
watcher6 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-FIM-Modified > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-FIM-Modified\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-FIM-Modified\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.fimModified = newVal;
@ -86,7 +104,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
const assignWatcher7 = () => {
watcher7 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-FIM-Deleted > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-FIM-Deleted\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-FIM-Deleted\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.fimDeleted = newVal;
@ -105,7 +126,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
const assignWatcher8 = () => {
watcher8 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-Audit-New-files > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-Audit-New-files\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-Audit-New-files\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.auditNewFiles = newVal;
@ -115,7 +139,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
}
const assignWatcher9 = () => {
watcher9 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-Audit-Read-files > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-Audit-Read-files\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-Audit-Read-files\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.auditReadFiles = newVal;
@ -126,7 +153,11 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
const assignWatcher10 = () => {
watcher10 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-Audit-Modified-files > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-Audit-Modified-files\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-Audit-Modified-files\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.auditModifiedFiles = newVal;
@ -137,7 +168,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
const assignWatcher11 = () => {
watcher11 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-Audit-Removed-files > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-Audit-Removed-files\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-Audit-Removed-files\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.auditRemovedFiles = newVal;
@ -157,7 +191,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
const assignWatcher12 = () => {
watcher12 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-VULS-Metric-Critical-severity > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-VULS-Metric-Critical-severity\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-VULS-Metric-Critical-severity\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.vulnCritical = newVal;
@ -167,7 +204,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
}
const assignWatcher13 = () => {
watcher13 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-VULS-Metric-High-severity > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-VULS-Metric-High-severity\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-VULS-Metric-High-severity\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.vulnHigh = newVal;
@ -178,7 +218,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
const assignWatcher14 = () => {
watcher14 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-VULS-Metric-Medium-severity > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-VULS-Metric-Medium-severity\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-VULS-Metric-Medium-severity\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.vulnMedium = newVal;
@ -189,7 +232,10 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
const assignWatcher15 = () => {
watcher15 = $scope.$watch(() => {
return $('#Wazuh-App-Overview-VULS-Metric-Low-severity > visualize > visualization > div > div > div > div > div.metric-value.ng-binding > span').text();
if ($('[vis-id="\'Wazuh-App-Overview-VULS-Metric-Low-severity\'"]').html().includes('<span')) {
return $('[vis-id="\'Wazuh-App-Overview-VULS-Metric-Low-severity\'"]').html().split('<span>')[1].split('</span')[0];
}
return false;
}, (newVal, oldVal) => {
if (newVal !== oldVal) {
$scope.vulnLow = newVal;
@ -348,7 +394,7 @@ app.controller('overviewController', function ($scope, $location, $rootScope, ap
} else if(watcher8) {
destroyAuditMetrics();
}
if($scope.tab === 'vuls' && subtab === 'panels' && !watcher12){
assignVulnMetrics();
} else if(watcher8) {

View File

@ -12,7 +12,7 @@
</md-card-content>
</md-card>
</div>
<div layout="row" layout-align="center stretch" class="height-120 wz-no-display">
<md-card flex>
<md-card-content class="wazuh-column">