Config and manager tabs: Fixes

This commit is contained in:
jesmg 2016-07-28 14:41:27 +00:00
parent d8037f0c28
commit 66c5397983
5 changed files with 60 additions and 37 deletions

View File

@ -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();

View File

@ -194,10 +194,6 @@
<md-option value="registry">Registry</md-option>
</md-select>
</md-input-container>
<label>Clean FIM database in all agents:</label>
<md-button class="md-raised md-primary" ng-click="cleandb()">Clean</md-button>
<label>Start scan in all agents:</label>
<md-button class="md-raised md-primary" ng-click="startfim()">Scan</md-button>
</md-dialog>
</div>
</div>

View File

@ -53,8 +53,8 @@
<i class="fa fa-caret-up" aria-hidden="true" ng-show="show" ng-click="show = false"></i>
</p>
</span>
<p ng-show="show" class="right-text">
<span ng-repeat="item in managerConfiguration.global.white_list|orderBy">{{ item }} <span ng-show="!$last">, </span></span>
<p ng-show="show" class="right-text" ng-repeat="item in managerConfiguration.global.white_list|orderBy">
{{ item }}
</p>
<md-divider></md-divider>
</span>
@ -236,10 +236,11 @@
<p class="right-text">{{ item.timeout }}</p>
</span>
</span>
<span ng-show="show" ng-if="item.rules_group">
<span ng-show="show" ng-if="item.rules_group" ng-repeat="group in item.rules_group.split(',');">
<span layout="row" layout-align="space-between center">
<p> Rules group </p>
<p class="right-text" style="word-wrap: break-word; word-break: break-all;">{{ item.rules_group }}</p>
<p ng-show="$first"> Rules group </p>
<p ng-show="!$first"></p>
<p class="right-text">{{ group }}</p>
</span>
</span>
<span ng-show="show" ng-if="item.rules_id">

View File

@ -3,13 +3,13 @@
<md-content class="md-padding">
<md-nav-bar md-selected-nav-item="menuNavItem" nav-bar-aria-label="navigation menu">
<md-nav-item id="header_logo" md-nav-href="#/" name="wazuh" aria-label="img logo">
<img aria-label="Logo image" src="/plugins/wazuh/icon.png" height="44" weight="252"></img>
</md-nav-item>
<img aria-label="Logo image" src="/plugins/wazuh/icon.png" height="44" weight="252"></img>
</md-nav-item>
<md-nav-item md-nav-href="#/manager" name="manager">Manager</md-nav-item>
<md-nav-item md-nav-href="#/agents" name="agents">Agents</md-nav-item>
<md-nav-item md-nav-href="#/ruleset" name="ruleset">Ruleset</md-nav-item>
<md-nav-item md-nav-href="#/fim" name="fim">File integrity</md-nav-item>
<md-nav-item md-nav-href="#/policy_monitoring" name="policy_monitoring">Policy monitoring</md-nav-item>
<md-nav-item md-nav-href="#/policy_monitoring" name="policy_monitoring">Policy monitoring</md-nav-item>
<md-nav-item md-nav-href="#/settings" name="settings">Settings</md-nav-item>
</md-nav-bar>
</md-content>
@ -31,14 +31,17 @@
<div flex layout="column">
<md-card>
<md-card-content>
<h3>Manager status</h3>
<span layout="column" ng-repeat="daemon in daemons">
<span layout="row" layout-align="space-between center">
<h3>Manager status</h3>
<h3 class="right-text"><md-icon md-font-icon="fa fa-cog" ng-click="showDialog()" /></h3>
</span>
<span layout="column" ng-repeat="daemon in daemons">
<span layout="row" layout-align="space-between center">
<p>{{daemon.daemon}}</p>
<p class="right-text"><div ng-class="getDaemonStatusClass(daemon.status)" class="round"></div></p>
</span>
<md-divider></md-divider>
</span>
<p class="right-text"><span ng-class="getDaemonStatusClass(daemon.status)" class="round" style="float: right"></span></p>
</span>
<md-divider></md-divider>
</span>
</md-card-content>
</md-card>
</div>
@ -69,7 +72,9 @@
</md-list-item>
<md-divider></md-divider>
<md-list-item>
<p>Top reporting agent (Today)</p>
<p>Top reporting agent
<h6>(Last 24 hours)</h6>
</p>
<p class="right-text">{{stats['/top/agent']}}</p>
</md-list-item>
<md-divider></md-divider>
@ -81,7 +86,8 @@
<div flex layout="column">
<md-card>
<md-card-content>
<h3>Alerts overview (Today stats)</h3>
<h3>Alerts overview</h3>
<h6>(Last 24h hours)</h6>
<md-list>
<md-list-item>
<p>Alerts</p>
@ -106,7 +112,8 @@
<div flex layout="column">
<md-card>
<md-card-content>
<h3>FIM overview (Today stats)</h3>
<h3>FIM overview</h3>
<h6>(Last 24h hours)</h6>
<md-list>
<md-list-item>
<p>FIM alerts</p>
@ -131,5 +138,15 @@
</md-content>
<div style="display: none">
<div class="md-dialog-container" id="actionsDialog">
<md-dialog layout-padding layout="column" layout-align="space-around center">
<md-button class="md-raised md-primary" ng-click="start()">Start</md-button>
<md-button class="md-raised md-primary" ng-click="stop()">Stop</md-button>
<md-button class="md-raised md-primary" ng-click="restart()">Restart</md-button>
</md-dialog>
</div>
</div>
</div>

View File

@ -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 = [];