From 66c53979837b6cb05fec5f61ebffa6971d51f4c3 Mon Sep 17 00:00:00 2001 From: jesmg Date: Thu, 28 Jul 2016 14:41:27 +0000 Subject: [PATCH] Config and manager tabs: Fixes --- public/controllers/manager.js | 35 +++++++++++------- public/templates/fim.html | 4 -- public/templates/manager-configuration.html | 11 +++--- public/templates/manager.html | 41 +++++++++++++++------ routes/wazuh-api.js | 6 +-- 5 files changed, 60 insertions(+), 37 deletions(-) diff --git a/public/controllers/manager.js b/public/controllers/manager.js index d851212e8..483bfebba 100644 --- a/public/controllers/manager.js +++ b/public/controllers/manager.js @@ -3,7 +3,7 @@ var kuf = require('plugins/wazuh/utils/kibanaUrlFormatter.js'); // Require config var app = require('ui/modules').get('app/wazuh', []); -app.controller('managerController', function ($scope, $route, $q, alertify, sharedProperties, $location, $sce, DataFactory, tabProvider, $filter, $http) { +app.controller('managerController', function ($scope, $route, $q, alertify, sharedProperties, $location, $sce, DataFactory, tabProvider, $filter, $http, $mdDialog) { //Initialisation $scope.load = true; $scope.menuNavItem = 'manager'; @@ -11,8 +11,8 @@ app.controller('managerController', function ($scope, $route, $q, alertify, shar $scope.stats = []; $scope.stats['/top/agent'] = '-'; - $scope.stats['/overview/alerts'] = {"alerts":0,"ip":"-","group":"-"}; - $scope.stats['/overview/fim'] = {"alerts":0,"agent":"-","file":"-"}; + $scope.stats['/overview/alerts'] = { "alerts": 0, "ip": "-", "group": "-" }; + $scope.stats['/overview/fim'] = { "alerts": 0, "agent": "-", "file": "-" }; $scope.pageId = (Math.random().toString(36).substring(3)); tabProvider.register($scope.pageId); @@ -35,6 +35,15 @@ app.controller('managerController', function ($scope, $route, $q, alertify, shar //Functions + $scope.showDialog = function (ev) { + $mdDialog.show({ + contentElement: '#actionsDialog', + parent: angular.element(document.body), + targetEvent: ev, + clickOutsideToClose: true + }); + }; + $scope.getDaemonStatusClass = function (daemonStatus) { if (daemonStatus == "running") return "status green" @@ -159,15 +168,15 @@ app.controller('managerController', function ($scope, $route, $q, alertify, shar DataFactory.getAndClean('get', '/manager/status', {}) .then(function (data) { $scope.daemons = data.data; - DataFactory.getAndClean('get', '/agents/summary', {}) - .then(function (data) { - $scope.agentsCountActive = data.data.active; - $scope.agentsCountDisconnected = data.data.disconnected; - $scope.agentsCountNeverConnected = data.data.neverConnected; - $scope.agentsCountTotal = data.data.total; - loadStats(); - $scope.load = false; - }, printError); + DataFactory.getAndClean('get', '/agents/summary', {}) + .then(function (data) { + $scope.agentsCountActive = data.data.active; + $scope.agentsCountDisconnected = data.data.disconnected; + $scope.agentsCountNeverConnected = data.data.neverConnected; + $scope.agentsCountTotal = data.data.total; + loadStats(); + $scope.load = false; + }, printError); }, printError); }; @@ -223,7 +232,7 @@ app.controller('managerConfigurationController', function ($scope, $route, $q, a $scope.load = false; }, printError); }; - + //Load load(); diff --git a/public/templates/fim.html b/public/templates/fim.html index 109473080..ac44d9f1b 100644 --- a/public/templates/fim.html +++ b/public/templates/fim.html @@ -194,10 +194,6 @@ Registry - - Clean - - Scan diff --git a/public/templates/manager-configuration.html b/public/templates/manager-configuration.html index 774b4b6a9..209aab08f 100644 --- a/public/templates/manager-configuration.html +++ b/public/templates/manager-configuration.html @@ -53,8 +53,8 @@

-

- {{ item }} , +

+ {{ item }}

@@ -236,10 +236,11 @@

{{ item.timeout }}

- + -

Rules group

-

{{ item.rules_group }}

+

Rules group

+

+

{{ group }}

diff --git a/public/templates/manager.html b/public/templates/manager.html index f0f58069d..176e8552e 100644 --- a/public/templates/manager.html +++ b/public/templates/manager.html @@ -3,13 +3,13 @@ + + Manager Agents Ruleset File integrity - Policy monitoring + Policy monitoring Settings @@ -31,14 +31,17 @@
-

Manager status

- + +

Manager status

+

+
+

{{daemon.daemon}}

-

-
- -
+

+
+ +
@@ -69,7 +72,9 @@ -

Top reporting agent (Today)

+

Top reporting agent +

(Last 24 hours)
+

{{stats['/top/agent']}}

@@ -81,7 +86,8 @@
-

Alerts overview (Today stats)

+

Alerts overview

+
(Last 24h hours)

Alerts

@@ -106,7 +112,8 @@
-

FIM overview (Today stats)

+

FIM overview

+
(Last 24h hours)

FIM alerts

@@ -131,5 +138,15 @@ +
+
+ + Start + Stop + Restart + +
+
+
diff --git a/routes/wazuh-api.js b/routes/wazuh-api.js index c94655731..a3111550c 100644 --- a/routes/wazuh-api.js +++ b/routes/wazuh-api.js @@ -220,7 +220,7 @@ module.exports = function (server, options) { var elasticurl = _elurl+'/ossec-*/ossec/_search'; - var gte = new Date().setHours(0,0,0,0); + var gte = new Date() - (24 * 3600); var payload = { "size": 0, @@ -290,7 +290,7 @@ module.exports = function (server, options) { var elasticurl = _elurl + '/ossec-*/ossec/_search'; - var gte = new Date().setHours(0,0,0,0); + var gte = new Date() - (24 * 3600); var payloads = []; @@ -445,7 +445,7 @@ module.exports = function (server, options) { var elasticurl = _elurl + '/ossec-*/ossec/_search'; - var gte = new Date().setHours(0, 0, 0, 0); + var gte = new Date() - (24 * 3600); var payloads = [];