Merge pull request #768 from wazuh/issue-767

Optimizations
This commit is contained in:
Javier Castro 2018-08-01 20:10:14 +02:00 committed by GitHub
commit 2fd448442e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 223 additions and 337 deletions

View File

@ -24,20 +24,15 @@
"homepage": "https://www.wazuh.com/",
"dependencies": {
"angular-animate": "1.6.5",
"angular-aria": "1.6.5",
"angular-cookies": "1.6.5",
"angular-material": "1.1.10",
"angular-md5": "^0.1.10",
"ansicolors": "^0.3.2",
"dom-to-image": "^2.6.0",
"install": "^0.10.1",
"js-yaml": "3.10.0",
"json2csv": "^4.1.2",
"lodash": "3.10.1",
"needle": "^2.0.1",
"node-cron": "^1.1.2",
"pdfmake": "^0.1.37",
"query-string": "5.1.1",
"querystring-browser": "1.0.4",
"simple-tail": "^1.1.0",
"timsort": "^0.3.0",
"winston": "3.0.0"

View File

@ -183,7 +183,7 @@ function (
if ($scope.agent.os) {
$scope.agentOS = $scope.agent.os.name + ' ' + $scope.agent.os.version;
}
else { $scope.agentOS = 'Unknown' };
else { $scope.agentOS = 'Unknown' }
// Syscheck
$scope.agent.syscheck = data[1].data.data;
@ -235,7 +235,7 @@ function (
errorHandler.info('Your download should begin automatically...', 'CSV')
const currentApi = JSON.parse(appState.getCurrentAPI()).id;
const output = await csvReq.fetch(data_path, currentApi, wzTableFilter.get());
const blob = new Blob([output], {type: 'text/csv'});
const blob = new Blob([output], {type: 'text/csv'}); // eslint-disable-line
FileSaver.saveAs(blob, 'packages.csv');
@ -263,7 +263,7 @@ function (
})
.catch(error => errorHandler.handle(error,'Agents'));
$scope.isArray = angular.isArray;
$scope.isArray = Array.isArray;
$scope.getAgentConfig = newAgentId => {
if (newAgentId) {

View File

@ -12,8 +12,7 @@
import { uiModules } from 'ui/modules'
import CodeMirror from '../utils/codemirror/lib/codemirror'
import jsonLint from '../utils/codemirror/json-lint'
import queryString from 'query-string'
import $ from 'jquery'
import queryString from 'querystring-browser'
const app = uiModules.get('app/wazuh', []);

View File

@ -17,7 +17,7 @@ const app = uiModules.get('app/wazuh', []);
// Groups preview controller
app.controller('groupsPreviewController',
function ($scope, $rootScope, $location, apiReq, errorHandler, csvReq, appState, shareAgent, wzTableFilter) {
function ($scope, $location, apiReq, errorHandler, csvReq, appState, shareAgent, wzTableFilter) {
$scope.$on('groupsIsReloaded',() => {
$scope.currentGroup = false;
$scope.lookingGroup = false;
@ -31,7 +31,7 @@ function ($scope, $rootScope, $location, apiReq, errorHandler, csvReq, appState,
errorHandler.info('Your download should begin automatically...', 'CSV')
const currentApi = JSON.parse(appState.getCurrentAPI()).id;
const output = await csvReq.fetch(data_path, currentApi, wzTableFilter.get());
const blob = new Blob([output], {type: 'text/csv'});
const blob = new Blob([output], {type: 'text/csv'}); // eslint-disable-line
FileSaver.saveAs(blob, 'groups.csv');
@ -162,12 +162,4 @@ function ($scope, $rootScope, $location, apiReq, errorHandler, csvReq, appState,
$scope.filename = false;
}
});
});
app.controller('groupsController', function ($scope,$rootScope) {
$scope.groupsMenu = 'preview';
$scope.groupName = '';
$scope.$on("$destroy", () => {
});
});
});

View File

@ -114,7 +114,7 @@ app.controller('managerStatusController', function ($scope, errorHandler, apiReq
app.controller('managerConfigurationController', function ($scope, errorHandler, apiReq) {
//Initialization
$scope.load = true;
$scope.isArray = angular.isArray;
$scope.isArray = Array.isArray;
$scope.switchItem = item => {
$scope.XMLContent = false;

View File

@ -42,7 +42,7 @@ app.controller('managerLogController', function ($scope, apiReq, errorHandler, c
errorHandler.info('Your download should begin automatically...', 'CSV')
const currentApi = JSON.parse(appState.getCurrentAPI()).id;
const output = await csvReq.fetch('/manager/logs', currentApi, wzTableFilter.get());
const blob = new Blob([output], {type: 'text/csv'});
const blob = new Blob([output], {type: 'text/csv'}); // eslint-disable-line
FileSaver.saveAs(blob, 'logs.csv');

View File

@ -9,8 +9,8 @@
*
* Find more information about this on the LICENSE file.
*/
import { uiModules } from 'ui/modules'
import $ from 'jquery'
import { uiModules } from 'ui/modules';
const app = uiModules.get('app/wazuh', []);
// Logs controller

View File

@ -22,7 +22,7 @@ const colors = [
const app = uiModules.get('app/wazuh', []);
app.controller('rulesController', function ($timeout, $scope, $rootScope, $sce, errorHandler, genericReq, appState, csvReq, wzTableFilter) {
app.controller('rulesController', function ($scope, $rootScope, $sce, errorHandler, appState, csvReq, wzTableFilter) {
$scope.appliedFilters = [];
$scope.search = term => {
@ -79,7 +79,7 @@ app.controller('rulesController', function ($timeout, $scope, $rootScope, $sce,
$scope.searchTerm = '';
$scope.viewingDetail = false;
$scope.setRulesTab('rules');
$scope.isArray = angular.isArray;
$scope.isArray = Array.isArray;
$scope.colorRuleArg = ruleArg => {
ruleArg = ruleArg.toString();
@ -109,7 +109,7 @@ app.controller('rulesController', function ($timeout, $scope, $rootScope, $sce,
errorHandler.info('Your download should begin automatically...', 'CSV')
const currentApi = JSON.parse(appState.getCurrentAPI()).id;
const output = await csvReq.fetch('/rules', currentApi, wzTableFilter.get());
const blob = new Blob([output], {type: 'text/csv'});
const blob = new Blob([output], {type: 'text/csv'}); // eslint-disable-line
FileSaver.saveAs(blob, 'rules.csv');
@ -150,7 +150,7 @@ app.controller('rulesController', function ($timeout, $scope, $rootScope, $sce,
});
app.controller('decodersController', function ($timeout, $scope, $rootScope, $sce, errorHandler, genericReq, appState, csvReq, wzTableFilter) {
app.controller('decodersController', function ($scope, $rootScope, $sce, errorHandler, appState, csvReq, wzTableFilter) {
$scope.setRulesTab = tab => $rootScope.globalRulesetTab = tab;
$scope.appliedFilters = [];
@ -160,7 +160,7 @@ app.controller('decodersController', function ($timeout, $scope, $rootScope, $sc
$scope.viewingDetail = false;
$scope.typeFilter = "all";
$scope.setRulesTab('decoders');
$scope.isArray = angular.isArray;
$scope.isArray = Array.isArray;
$scope.includesFilter = filterName => $scope.appliedFilters.map(item => item.name).includes(filterName);
@ -228,7 +228,7 @@ app.controller('decodersController', function ($timeout, $scope, $rootScope, $sc
try {
const currentApi = JSON.parse(appState.getCurrentAPI()).id;
const output = await csvReq.fetch('/decoders', currentApi, wzTableFilter.get());
const blob = new Blob([output], {type: 'text/csv'});
const blob = new Blob([output], {type: 'text/csv'}); // eslint-disable-line
FileSaver.saveAs(blob, 'decoders.csv');

View File

@ -16,7 +16,7 @@ import TabNames from '../utils/tab-names';
const app = uiModules.get('app/wazuh', []);
app.controller('settingsController',
function ($scope, $routeParams, $window, $route, $location, testAPI, appState, genericReq, errorHandler, wzMisc, wazuhConfig) {
function ($scope, $routeParams, $window, $location, testAPI, appState, genericReq, errorHandler, wzMisc, wazuhConfig) {
if (wzMisc.getValue('comeFromWizard')) {
$window.sessionStorage.removeItem('healthCheck');
wzMisc.setWizard(false);
@ -82,7 +82,7 @@ function ($scope, $routeParams, $window, $route, $location, testAPI, appState, g
// Get current API index
const getCurrentAPIIndex = () => {
$scope.apiEntries.map((entry,index,array) => {
$scope.apiEntries.map((entry,index,array) => { // eslint-disable-line
if(entry._id === $scope.currentDefault) currentApiEntryIndex = index;
})
}

View File

@ -1,3 +1,15 @@
/*
* Wazuh app - Wazuh welcome card directive
* Copyright (C) 2018 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/
import template from './wz-welcome-card.html';
import { uiModules } from 'ui/modules';

View File

@ -25,12 +25,12 @@ app.factory('vis2png', function ($rootScope) {
working = true;
const len = visArray.length;
let currentCompleted = 0;
await Promise.all(visArray.map(async (currentValue, index, array) => {
await Promise.all(visArray.map(async currentValue => {
const tmpNode = htmlObject[currentValue]
try {
const tmpResult = await domtoimage.toPng(tmpNode[0]);
rawArray.push({element:tmpResult,width:tmpNode.width(),height:tmpNode.height(), id: currentValue});
} catch (error) {}
} catch (error) {} // eslint-disable-line
currentCompleted++;
$rootScope.reportStatus = `Generating report...${Math.round((currentCompleted/len) * 100)}%`
if(!$rootScope.$$phase) $rootScope.$digest()

View File

@ -1,24 +0,0 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="200.000000pt" height="200.000000pt" viewBox="0 0 200.000000 200.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.13, written by Peter Selinger 2001-2015
</metadata>
<g transform="translate(0.000000,200.000000) scale(0.100000,-0.100000)"
fill="#1A80B6" stroke="none">
<path d="M35 1958 c-3 -7 -4 -440 -3 -963 l3 -950 962 -3 963 -2 0 965 0 965
-960 0 c-759 0 -962 -3 -965 -12z m1905 -958 l0 -940 -940 0 -940 0 0 940 0
940 940 0 940 0 0 -940z"/>
<path d="M580 1487 l-65 -232 -92 -108 -93 -107 67 -63 c38 -35 132 -122 209
-195 l142 -131 78 -186 79 -185 94 2 93 3 75 181 75 181 212 194 213 194 -71
78 c-119 132 -116 126 -186 371 -35 124 -66 226 -69 226 -3 -1 -44 -82 -90
-181 l-84 -179 -166 2 -166 3 -91 178 c-50 97 -93 179 -95 181 -2 3 -33 -100
-69 -227z m712 -617 c-129 -127 -179 -170 -198 -170 -19 0 -32 13 -60 56 l-36
56 -20 -33 c-30 -51 -59 -79 -81 -79 -16 0 -346 298 -355 322 -2 4 16 8 41 8
42 0 50 -5 180 -120 l136 -121 27 41 c25 37 30 40 73 40 42 0 48 -4 74 -41
l29 -40 86 79 c48 44 110 100 137 125 44 41 55 46 95 46 l45 0 -173 -169z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -139,7 +139,7 @@ function discoverController(
else wzInterval = 'M';
} catch (error) {}
} catch (error) {} // eslint-disable-line
return wzInterval;
};
@ -373,7 +373,8 @@ function discoverController(
if (!sort) return;
// get the current sort from {key: val} to ["key", "val"];
const currentSort = _.pairs($scope.searchSource.get('sort')).pop();
// WAZUH: replaced _.pairs by Object.entries due to Lodash compatibility
const currentSort = Object.entries($scope.searchSource.get('sort')).pop(); // eslint-disable-line
// if the searchSource doesn't know, tell it so
if (!angular.equals(sort, currentSort)) $scope.fetch();

View File

@ -9,7 +9,7 @@
*
* Find more information about this on the LICENSE file.
*/
export default async (appState,genericReq,errorHandler,$rootScope,$location, wzMisc) => {
export default async (appState, genericReq, $rootScope, $location, wzMisc) => {
try {
const data = await genericReq.request('GET', '/api/wazuh-elastic/timestamp');
const current = appState.getCreatedAt();

View File

@ -9,12 +9,12 @@
*
* Find more information about this on the LICENSE file.
*/
import { StateProvider } from 'ui/state_management/state';
import { SavedObjectsClientProvider } from 'ui/saved_objects';
import healthCheck from './health-check'
export default (Promise, courier, config, $q, $rootScope, $window, $location, Private, appState, genericReq,errorHandler, wzMisc) => {
export default (courier, $q, $rootScope, $window, $location, Private, appState, genericReq,errorHandler, wzMisc) => {
const deferred = $q.defer();
const catchFunction = error => {
@ -27,7 +27,7 @@ export default (Promise, courier, config, $q, $rootScope, $window, $location, Pr
deferred.reject();
$location.path('/health-check');
} else {
const State = Private(StateProvider);
const savedObjectsClient = Private(SavedObjectsClientProvider);
savedObjectsClient.find({
type : 'index-pattern',
@ -41,7 +41,7 @@ export default (Promise, courier, config, $q, $rootScope, $window, $location, Pr
if (appState.getCurrentPattern()) { // There's cookie for the pattern
currentPattern = appState.getCurrentPattern();
} else {
if(!data.data.data.length){
if(!data || !data.data || !data.data.data || !data.data.data.length){
wzMisc.setBlankScr('Sorry but no valid index patterns were found')
$location.search('tab',null);
$location.path('/blank-screen');
@ -53,7 +53,7 @@ export default (Promise, courier, config, $q, $rootScope, $window, $location, Pr
const onlyWazuhAlerts = savedObjects.filter(element => element.id === currentPattern);
if (onlyWazuhAlerts.length === 0) { // There's now selected ip
if (!onlyWazuhAlerts || !onlyWazuhAlerts.length) { // There's now selected ip
deferred.resolve('No ip');
return;
}

View File

@ -12,7 +12,7 @@
// Manage leaving the app to another Kibana tab
export default ($location, $window) => {
let url = $location.$$absUrl.substring(0, $location.$$absUrl.indexOf('#'));
const url = $location.$$absUrl.substring(0, $location.$$absUrl.indexOf('#'));
if ($window.sessionStorage.getItem(`lastSubUrl:${url}`).includes('/wazuh#/visualize') ||
$window.sessionStorage.getItem(`lastSubUrl:${url}`).includes('/wazuh#/doc') ||

View File

@ -99,7 +99,7 @@ export default ($rootScope, $location, $q, $window, testAPI, appState, genericRe
appState.setExtensions(currentApi,extensions);
}
checkTimestamp(appState,genericReq,errorHandler,$rootScope,$location)
checkTimestamp(appState, genericReq, $rootScope, $location, wzMisc)
.then(() => testAPI.check_stored(currentApi))
.then(data => {
if(data && data === 'cookies_outdated'){

View File

@ -27,154 +27,81 @@ import settingsTemplate from '../templates/settings/settings.jade'
import blankScreenTemplate from '../templates/error-handler/blank-screen.html'
import devToolsTemplate from '../templates/dev-tools/dev-tools.html'
function ip(courier, $q, $rootScope, $window, $location, Private, appState, genericReq,errorHandler, wzMisc){
return getIp(courier, $q, $rootScope, $window, $location, Private, appState, genericReq,errorHandler, wzMisc);
}
function nestedResolve(
$q, genericReq, errorHandler, wazuhConfig,
$rootScope, $location, $window, testAPI, appState, wzMisc
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig)
.then(() => settingsWizard($rootScope, $location, $q, $window, testAPI, appState, genericReq, errorHandler, wzMisc, wazuhConfig));
}
function savedSearch(courier, $location, $window, $rootScope, savedSearches, $route){
return getSavedSearch(courier, $location, $window, $rootScope, savedSearches, $route);
}
function wzConfig($q, genericReq, errorHandler, wazuhConfig) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig);
}
function wzKibana($location, $window) {
return goToKibana($location, $window);
}
//Routes
routes.enable();
routes
.when('/health-check', {
template: healthCheckTemplate,
resolve: {
"nestedResolve": function(
$q, genericReq, errorHandler, wazuhConfig,
$rootScope, $location, $window, testAPI, appState, wzMisc
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig)
.then(() => settingsWizard($rootScope, $location, $q, $window, testAPI, appState, genericReq, errorHandler, wzMisc, wazuhConfig));
},
"ip": getIp
}
resolve: { nestedResolve, ip }
})
.when('/agents/:id?/:tab?/:view?', {
template: agentsTemplate,
resolve: {
"nestedResolve": function(
$q, genericReq, errorHandler, wazuhConfig,
$rootScope, $location, $window, testAPI, appState, wzMisc
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig)
.then(() => settingsWizard($rootScope, $location, $q, $window, testAPI, appState, genericReq, errorHandler, wzMisc, wazuhConfig));
},
"ip": getIp,
"savedSearch": getSavedSearch
}
resolve: { nestedResolve, ip, savedSearch }
})
.when('/agents-preview/:tab?/', {
template: agentsPrevTemplate,
resolve: {
"nestedResolve": function(
$q, genericReq, errorHandler, wazuhConfig,
$rootScope, $location, $window, testAPI, appState, wzMisc
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig)
.then(() => settingsWizard($rootScope, $location, $q, $window, testAPI, appState, genericReq, errorHandler, wzMisc, wazuhConfig));
},
}
resolve: { nestedResolve }
})
.when('/manager/:tab?/', {
template: managerTemplate,
resolve: {
"nestedResolve": function(
$q, genericReq, errorHandler, wazuhConfig,
$rootScope, $location, $window, testAPI, appState, wzMisc
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig)
.then(() => settingsWizard($rootScope, $location, $q, $window, testAPI, appState, genericReq, errorHandler, wzMisc, wazuhConfig));
},
"ip": getIp,
"savedSearch": getSavedSearch
}
resolve: { nestedResolve, ip, savedSearch }
})
.when('/overview/', {
template: overviewTemplate,
resolve: {
"nestedResolve": function(
$q, genericReq, errorHandler, wazuhConfig,
$rootScope, $location, $window, testAPI, appState, wzMisc
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig)
.then(() => settingsWizard($rootScope, $location, $q, $window, testAPI, appState, genericReq, errorHandler, wzMisc, wazuhConfig));
},
"ip": getIp,
"savedSearch": getSavedSearch
}
resolve: { nestedResolve, ip, savedSearch }
})
.when('/wazuh-discover/', {
template: discoverTemplate,
resolve: {
"nestedResolve": function(
$q, genericReq, errorHandler, wazuhConfig,
$rootScope, $location, $window, testAPI, appState, wzMisc
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig)
.then(() => settingsWizard($rootScope, $location, $q, $window, testAPI, appState, genericReq, errorHandler, wzMisc, wazuhConfig));
},
"ip": getIp,
"savedSearch": getSavedSearch
}
resolve: { nestedResolve, ip, savedSearch }
})
.when('/settings/:tab?/', {
template: settingsTemplate,
resolve: {
"getWzConfig": function(
$q, genericReq, errorHandler, wazuhConfig
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig);
}
}
resolve: { wzConfig }
})
.when('/visualize/create?', {
redirectTo: function () {},
resolve: {
"getWzConfig": function(
$q, genericReq, errorHandler, wazuhConfig
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig);
},
"checkAPI": goToKibana
}
resolve: { wzConfig, wzKibana }
})
.when('/context/:pattern?/:type?/:id?', {
redirectTo: function () {},
resolve: {
"getWzConfig": function(
$q, genericReq, errorHandler, wazuhConfig
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig);
},
"checkAPI": goToKibana
}
resolve: { wzConfig,wzKibana }
})
.when('/doc/:pattern?/:index?/:type?/:id?', {
redirectTo: function () {},
resolve: {
"getWzConfig": function(
$q, genericReq, errorHandler, wazuhConfig
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig);
},
"checkAPI": goToKibana
}
resolve: { wzConfig, wzKibana }
})
.when('/wazuh-dev', {
template: devToolsTemplate,
resolve: {
"nestedResolve": function(
$q, genericReq, errorHandler, wazuhConfig,
$rootScope, $location, $window, testAPI, appState, wzMisc
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig)
.then(() => settingsWizard($rootScope, $location, $q, $window, testAPI, appState, genericReq, errorHandler, wzMisc, wazuhConfig));
},
}
resolve: { nestedResolve }
})
.when('/blank-screen', {
template: blankScreenTemplate,
resolve: {
"getWzConfig": function(
$q, genericReq, errorHandler, wazuhConfig
) {
return getWzConfig($q, genericReq, errorHandler, wazuhConfig);
}
}
resolve: { wzConfig }
})
.when('/', {
redirectTo: '/overview/'

View File

@ -1,152 +0,0 @@
<md-content flex layout="column" ng-controller="groupsPreviewController" class="overflow-hidden" ng-if="groupsMenu == 'preview'"
ng-init="lookingGroup=false">
<!-- Loading ring -->
<div class='uil-ring-css' ng-show="load">
<div></div>
</div>
<!-- Headline -->
<div ng-show="!load" layout="column" layout-padding>
<span class="font-size-18"><i class="fa fa-fw fa-object-group" aria-hidden="true"></i> Groups</span>
<span class="md-subheader">List and check your groups, its agents and files</span>
</div>
<!-- End headline -->
<div flex layout="column" layout-align="start stretch" ng-show="!load" ng-init="groupsSelectedTab='agents'">
<!-- MD5 Sums and Details cards -->
<div layout="row" class="md-padding" ng-if="lookingGroup">
<!-- Group MD5 sums section -->
<md-card flex class="no-margin-left wz-md-card">
<md-card-content>
<span class="wz-headline-title">{{ currentGroup.name }}</span>
<md-divider class="wz-margin-top-10"></md-divider>
<div layout="row" class="wz-padding-top-10">
<span flex="25">Configuration sum</span>
<span class="wz-text-right color-grey">{{ currentGroup.conf_sum }}</span>
</div>
<div layout="row" class="wz-padding-top-10">
<span flex="25">Merged sum</span>
<span class="wz-text-right color-grey">{{ currentGroup.merged_sum }}</span>
</div>
</md-card-content>
</md-card>
<!-- End Group MD5 sums section -->
<!-- Group Details section -->
<md-card flex class="no-margin-right wz-md-card">
<md-card-content>
<span class="wz-headline-title">Details</span>
<md-divider class="wz-margin-top-10"></md-divider>
<div layout="row" class="wz-padding-top-10">
<span flex="20" class="wz-text-link" ng-class="groupsSelectedTab==='agents' ? 'wz-text-active' : ''" ng-click="goBackToAgents()"
tooltip="Click to open the list of agents" tooltip-placement="left">Agents</span>
<span class="wz-text-link" tooltip="Click to open the list of agents" tooltip-placement="right" ng-click="goBackToAgents()">{{ currentGroup.count }}</span>
</div>
<div layout="row" class="wz-padding-top-10">
<span flex="20" class="wz-text-link" ng-class="groupsSelectedTab==='files' ? 'wz-text-active' : ''" ng-click="goBackFiles()"
tooltip="Click to open the list of files" tooltip-placement="left">Content</span>
<span class="wz-text-link" tooltip="Click to open the list of files" tooltip-placement="right" ng-click="goBackFiles()">{{ totalFiles }}</span>
</div>
</md-card-content>
</md-card>
<!-- End Group Details section -->
</div>
<!-- End MD5 Sums and Details cards -->
<!-- Search bar -->
<div layout="row" class="md-padding">
<input placeholder="Filter..." ng-model="custom_search" type="text" class="kuiLocalSearchInput ng-empty ng-pristine ng-scope ng-touched ng-valid"
aria-invalid="false" wz-enter="search(custom_search)">
<button type="submit" aria-label="Search" class="kuiLocalSearchButton height-40" ng-click="search(custom_search)">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
</div>
<!-- End search bar -->
<!-- Groups table -->
<div layout="row" ng-if="!lookingGroup" class="md-padding">
<wazuh-table
flex
extra-limit="true"
path="'/agents/groups'"
keys="['name',{value:'count',size:1},{value:'merged_sum',size:3}]"
allow-click="true"
rows-per-page="14">
</wazuh-table>
</div>
<!-- End groups table -->
<!-- CSV Download button section for groups -->
<div layout="row" class="md-padding" ng-if="!lookingGroup">
<span flex></span>
<a class="small" id="btnDownload" ng-click="downloadCsv('/agents/groups')">Formatted
<i aria-hidden="true" class="fa fa-fw fa-download"></i>
</a>
</div>
<!-- End CSV Download button section for groups -->
<!-- Group agents table -->
<div layout="row" ng-if="lookingGroup && groupsSelectedTab==='agents' && currentGroup" class="md-padding">
<wazuh-table
flex
path="'/agents/groups/' + currentGroup.name"
keys="['id','name','ip','status','os.name','os.version','version']"
allow-click="true"
rows-per-page="14">
</wazuh-table>
</div>
<!-- End Group agents table -->
<!-- CSV Download button section for group agents -->
<div layout="row" class="md-padding" ng-if="lookingGroup && groupsSelectedTab==='agents'">
<span flex></span>
<a class="small" id="btnDownload" ng-click="downloadCsv('/agents/groups/' + currentGroup.name)">Formatted
<i aria-hidden="true" class="fa fa-fw fa-download"></i>
</a>
</div>
<!-- End CSV Download button section for group agents -->
<!-- Group files table -->
<div layout="row" ng-if="lookingGroup && groupsSelectedTab==='files' && !fileViewer && currentGroup" class="md-padding">
<wazuh-table
extra-limit="true"
flex
path="'/agents/groups/' + currentGroup.name + '/files'"
keys="[{value:'filename',size:2},{value:'hash',size:6}]"
allow-click="true"
rows-per-page="10">
</wazuh-table>
</div>
<!-- End Group files table -->
<!-- CSV Download button section for group files-->
<div layout="row" class="md-padding" ng-if="lookingGroup && groupsSelectedTab==='files' && !file">
<span flex></span>
<a class="small" id="btnDownload" ng-click="downloadCsv('/agents/groups/' + currentGroup.name + '/files')">Formatted
<i aria-hidden="true" class="fa fa-fw fa-download"></i>
</a>
</div>
<!-- End CSV Download button section for group files -->
<!-- File JSON viewer section -->
<div flex layout="column" class="md-padding" ng-if="lookingGroup && groupsSelectedTab==='files' && file">
<div flex layout="column">
<div layout="row" class="wz-padding-bottom-14">
<span flex class="wz-headline-title">{{ filename }}</span>
<span flex class="wz-text-right cursor-pointer color-grey" ng-click="goBackFiles()">close</span>
</div>
<div flex layout="column">
<pre flex class="wz-pre json-beautifier jsonbeauty2 wz-overflow-y-auto"><code wz-dynamic="file"></code></pre>
</div>
</div>
</div>
<!-- End File JSON viewer section -->
</div>
</md-content>

View File

@ -1 +0,0 @@
<div flex layout="column" class="mozilla-table-size-85" ng-controller="groupsController" ng-if="tab == 'groups'">

View File

@ -0,0 +1,140 @@
<div flex layout="column" class="mozilla-table-size-85" ng-controller="groupsPreviewController" ng-if="tab == 'groups'">
<md-content flex layout="column" class="overflow-hidden" ng-init="lookingGroup=false">
<!-- Loading ring -->
<div class='uil-ring-css' ng-show="load">
<div></div>
</div>
<!-- Headline -->
<div ng-show="!load" layout="column" layout-padding>
<span class="font-size-18">
<i class="fa fa-fw fa-object-group" aria-hidden="true"></i> Groups</span>
<span class="md-subheader">List and check your groups, its agents and files</span>
</div>
<!-- End headline -->
<div flex layout="column" layout-align="start stretch" ng-show="!load" ng-init="groupsSelectedTab='agents'">
<!-- MD5 Sums and Details cards -->
<div layout="row" class="md-padding" ng-if="lookingGroup">
<!-- Group MD5 sums section -->
<md-card flex class="no-margin-left wz-md-card">
<md-card-content>
<span class="wz-headline-title">{{ currentGroup.name }}</span>
<md-divider class="wz-margin-top-10"></md-divider>
<div layout="row" class="wz-padding-top-10">
<span flex="25">Configuration sum</span>
<span class="wz-text-right color-grey">{{ currentGroup.conf_sum }}</span>
</div>
<div layout="row" class="wz-padding-top-10">
<span flex="25">Merged sum</span>
<span class="wz-text-right color-grey">{{ currentGroup.merged_sum }}</span>
</div>
</md-card-content>
</md-card>
<!-- End Group MD5 sums section -->
<!-- Group Details section -->
<md-card flex class="no-margin-right wz-md-card">
<md-card-content>
<span class="wz-headline-title">Details</span>
<md-divider class="wz-margin-top-10"></md-divider>
<div layout="row" class="wz-padding-top-10">
<span flex="20" class="wz-text-link" ng-class="groupsSelectedTab==='agents' ? 'wz-text-active' : ''" ng-click="goBackToAgents()"
tooltip="Click to open the list of agents" tooltip-placement="left">Agents</span>
<span class="wz-text-link" tooltip="Click to open the list of agents" tooltip-placement="right" ng-click="goBackToAgents()">{{ currentGroup.count }}</span>
</div>
<div layout="row" class="wz-padding-top-10">
<span flex="20" class="wz-text-link" ng-class="groupsSelectedTab==='files' ? 'wz-text-active' : ''" ng-click="goBackFiles()"
tooltip="Click to open the list of files" tooltip-placement="left">Content</span>
<span class="wz-text-link" tooltip="Click to open the list of files" tooltip-placement="right" ng-click="goBackFiles()">{{ totalFiles }}</span>
</div>
</md-card-content>
</md-card>
<!-- End Group Details section -->
</div>
<!-- End MD5 Sums and Details cards -->
<!-- Search bar -->
<div layout="row" class="md-padding">
<input placeholder="Filter..." ng-model="custom_search" type="text" class="kuiLocalSearchInput ng-empty ng-pristine ng-scope ng-touched ng-valid"
aria-invalid="false" wz-enter="search(custom_search)">
<button type="submit" aria-label="Search" class="kuiLocalSearchButton height-40" ng-click="search(custom_search)">
<span class="fa fa-search" aria-hidden="true"></span>
</button>
</div>
<!-- End search bar -->
<!-- Groups table -->
<div layout="row" ng-if="!lookingGroup" class="md-padding">
<wazuh-table flex extra-limit="true" path="'/agents/groups'" keys="['name',{value:'count',size:1},{value:'merged_sum',size:3}]"
allow-click="true" rows-per-page="14">
</wazuh-table>
</div>
<!-- End groups table -->
<!-- CSV Download button section for groups -->
<div layout="row" class="md-padding" ng-if="!lookingGroup">
<span flex></span>
<a class="small" id="btnDownload" ng-click="downloadCsv('/agents/groups')">Formatted
<i aria-hidden="true" class="fa fa-fw fa-download"></i>
</a>
</div>
<!-- End CSV Download button section for groups -->
<!-- Group agents table -->
<div layout="row" ng-if="lookingGroup && groupsSelectedTab==='agents' && currentGroup" class="md-padding">
<wazuh-table flex path="'/agents/groups/' + currentGroup.name" keys="['id','name','ip','status','os.name','os.version','version']"
allow-click="true" rows-per-page="14">
</wazuh-table>
</div>
<!-- End Group agents table -->
<!-- CSV Download button section for group agents -->
<div layout="row" class="md-padding" ng-if="lookingGroup && groupsSelectedTab==='agents'">
<span flex></span>
<a class="small" id="btnDownload" ng-click="downloadCsv('/agents/groups/' + currentGroup.name)">Formatted
<i aria-hidden="true" class="fa fa-fw fa-download"></i>
</a>
</div>
<!-- End CSV Download button section for group agents -->
<!-- Group files table -->
<div layout="row" ng-if="lookingGroup && groupsSelectedTab==='files' && !fileViewer && currentGroup" class="md-padding">
<wazuh-table extra-limit="true" flex path="'/agents/groups/' + currentGroup.name + '/files'" keys="[{value:'filename',size:2},{value:'hash',size:6}]"
allow-click="true" rows-per-page="10">
</wazuh-table>
</div>
<!-- End Group files table -->
<!-- CSV Download button section for group files-->
<div layout="row" class="md-padding" ng-if="lookingGroup && groupsSelectedTab==='files' && !file">
<span flex></span>
<a class="small" id="btnDownload" ng-click="downloadCsv('/agents/groups/' + currentGroup.name + '/files')">Formatted
<i aria-hidden="true" class="fa fa-fw fa-download"></i>
</a>
</div>
<!-- End CSV Download button section for group files -->
<!-- File JSON viewer section -->
<div flex layout="column" class="md-padding" ng-if="lookingGroup && groupsSelectedTab==='files' && file">
<div flex layout="column">
<div layout="row" class="wz-padding-bottom-14">
<span flex class="wz-headline-title">{{ filename }}</span>
<span flex class="wz-text-right cursor-pointer color-grey" ng-click="goBackFiles()">close</span>
</div>
<div flex layout="column">
<pre flex class="wz-pre json-beautifier jsonbeauty2 wz-overflow-y-auto"><code wz-dynamic="file"></code></pre>
</div>
</div>
</div>
<!-- End File JSON viewer section -->
</div>
</md-content>
</div>

View File

@ -1,3 +0,0 @@
include ./groups.head
include ./groups-preview.html
include ../../footer.foot

View File

@ -5,6 +5,6 @@ include ./manager-configuration.html
include ./manager-osseclog.html
include ./manager-reporting.html
include ./monitoring/monitoring.jade
include ./groups/groups.jade
include ./groups/groups.html
include ./ruleset/ruleset.jade
include ../footer.foot