diff --git a/public/controllers/overview.js b/public/controllers/overview.js index f4284c784d..3169fecede 100644 --- a/public/controllers/overview.js +++ b/public/controllers/overview.js @@ -97,6 +97,10 @@ function ($scope, $location, $rootScope, appState, $scope.switchSubtab = async (subtab, force = false, sameTab = true, preserveDiscover = false) => { try { + if($scope.tab && $scope.tab === 'welcome' && typeof $scope.agentsCountTotal === 'undefined'){ + await getSummary(); + } + if ($scope.tabView === subtab && !force) return; visFactoryService.clear() @@ -154,6 +158,25 @@ function ($scope, $location, $rootScope, appState, } }; + const getSummary = async () => { + try { + const data = await apiReq.request('GET', '/agents/summary', { }); + + if(data && data.data && data.data.data){ + $scope.agentsCountActive = data.data.data.Active; + $scope.agentsCountDisconnected = data.data.data.Disconnected; + $scope.agentsCountNeverConnected = data.data.data['Never connected']; + $scope.agentsCountTotal = data.data.data.Total; + $scope.agentsCoverity = (data.data.data.Active / data.data.data.Total) * 100; + } else { + throw new Error('Error fetching /agents/summary from Wazuh API'); + } + return; + } catch (error) { + return Promise.reject(error); + } + } + const loadConfiguration = async () => { try { const configuration = wazuhConfig.getConfig(); @@ -161,17 +184,7 @@ function ($scope, $location, $rootScope, appState, $scope.wzMonitoringEnabled = !!configuration['wazuh.monitoring.enabled']; if(!$scope.wzMonitoringEnabled){ - const data = await apiReq.request('GET', '/agents/summary', { }); - - if(data && data.data && data.data.data){ - $scope.agentsCountActive = data.data.data.Active; - $scope.agentsCountDisconnected = data.data.data.Disconnected; - $scope.agentsCountNeverConnected = data.data.data['Never connected']; - $scope.agentsCountTotal = data.data.data.Total; - $scope.agentsCoverity = (data.data.data.Active / data.data.data.Total) * 100; - } else { - throw new Error('Error fetching /agents/summary from Wazuh API'); - } + await getSummary(); } return; @@ -184,6 +197,7 @@ function ($scope, $location, $rootScope, appState, const init = async () => { try { + await Promise.all([ loadPciAndGDPR(), loadConfiguration() @@ -191,13 +205,19 @@ function ($scope, $location, $rootScope, appState, $scope.switchTab($scope.tab,true); + if($scope.tab && $scope.tab === 'welcome'){ + await getSummary(); + } + + if(!$scope.$$phase) $scope.$digest() + return; } catch (error) { errorHandler.handle(error, 'Overview (init)') return; } - } + }; init(); diff --git a/public/directives/index.js b/public/directives/index.js index 81624b3b56..65f488bc62 100644 --- a/public/directives/index.js +++ b/public/directives/index.js @@ -13,4 +13,5 @@ import './wz-dynamic/wz-dynamic'; import './wz-enter/wz-enter'; import './wz-menu/wz-menu'; import './wz-menu/wz-menu.less'; -import './wazuh-table/controller' \ No newline at end of file +import './wz-table/wz-table'; +import './wz-welcome-card/wz-welcome-card'; \ No newline at end of file diff --git a/public/directives/wazuh-table/template.html b/public/directives/wz-table/wz-table.html similarity index 100% rename from public/directives/wazuh-table/template.html rename to public/directives/wz-table/wz-table.html diff --git a/public/directives/wazuh-table/controller.js b/public/directives/wz-table/wz-table.js similarity index 99% rename from public/directives/wazuh-table/controller.js rename to public/directives/wz-table/wz-table.js index 79c19410f1..1f0b47ce2b 100644 --- a/public/directives/wazuh-table/controller.js +++ b/public/directives/wz-table/wz-table.js @@ -10,7 +10,7 @@ * Find more information about this on the LICENSE file. */ -import template from './template.html'; +import template from './wz-table.html'; import { uiModules } from 'ui/modules'; import DataFactory from '../../services/data-factory'; import KeyEquivalenece from '../../../util/csv-key-equivalence'; diff --git a/public/directives/wz-welcome-card/wz-welcome-card.html b/public/directives/wz-welcome-card/wz-welcome-card.html new file mode 100644 index 0000000000..482c11cde6 --- /dev/null +++ b/public/directives/wz-welcome-card/wz-welcome-card.html @@ -0,0 +1,18 @@ +
+
+
+
+ + +
+
+ +
+

+ {{ description }} +

+
+
+
+
+
\ No newline at end of file diff --git a/public/directives/wz-welcome-card/wz-welcome-card.js b/public/directives/wz-welcome-card/wz-welcome-card.js new file mode 100644 index 0000000000..8a93ca8d64 --- /dev/null +++ b/public/directives/wz-welcome-card/wz-welcome-card.js @@ -0,0 +1,23 @@ +import template from './wz-welcome-card.html'; +import { uiModules } from 'ui/modules'; + +const app = uiModules.get('app/wazuh', []); + +app.directive('wzWelcomeCard',function(){ + return { + restrict: 'E', + scope: { + title: '=title', + description: '=description', + logo: '=logo', + switchTab: '&', + currentTab: '=currentTab', + wzLogo: '=wzLogo' + }, + replace: true, + link: function(scope,elm,attrs){ + scope.callSwitchTab = () => scope.switchTab(); + }, + template + }; +}); \ No newline at end of file diff --git a/public/img/groups.png b/public/img/groups.png new file mode 100644 index 0000000000..d8a595f161 Binary files /dev/null and b/public/img/groups.png differ diff --git a/public/img/reporting.png b/public/img/reporting.png new file mode 100644 index 0000000000..09b8249f8c Binary files /dev/null and b/public/img/reporting.png differ diff --git a/public/img/ruleset.png b/public/img/ruleset.png new file mode 100644 index 0000000000..b380005a98 Binary files /dev/null and b/public/img/ruleset.png differ diff --git a/public/less/component.less b/public/less/component.less index d9f9fd9331..2de0262adc 100644 --- a/public/less/component.less +++ b/public/less/component.less @@ -20,7 +20,8 @@ height: auto !important; } -.wz-nav-item button { +.wz-nav-item button, +.wz-no-padding { padding: 0 !important; } diff --git a/public/less/layout.less b/public/less/layout.less index c6969f8433..80682ef059 100644 --- a/public/less/layout.less +++ b/public/less/layout.less @@ -83,6 +83,10 @@ padding-top: 0px !important; } +.wz-padding-bottom-0 { + padding-bottom: 0px !important; +} + .wz-padding-top-5 { padding-top: 5px !important; } diff --git a/public/templates/agents/agents-welcome.html b/public/templates/agents/agents-welcome.html index 5a9fb9f553..6d43580dbc 100644 --- a/public/templates/agents/agents-welcome.html +++ b/public/templates/agents/agents-welcome.html @@ -3,13 +3,12 @@
Agent overview - Visualize the current overall status of this agent
-
- +
+
Name: {{ agent.name }} @@ -35,8 +34,8 @@
-
- +
+
Last keep alive: {{agent.lastKeepAlive || 'Unknown' }}
Registration date: {{agent.dateAdd}}
@@ -61,68 +60,121 @@
- -
- - - Host monitoring - -
- General - File integrity - Configuration - Inventory -
-
-
-
- - -
- - - System audit - -
- Policy monitoring - Audit - Open SCAP - CIS-CAT +
+
+
+
+

Host monitoring

+
+
+ + + + +
- - -
- - - -
- - - Security - -
- Vulnerabilities - VirusTotal +
+
+
+

System audit

+
+
+ + + + +
- - +
+
- - -
- - - Compliance - -
- PCI DSS - GDPR +
+
+
+
+
+

Security

+
+
+ + +
+
- - +
+
+
+
+

Compliance

+
+
+ + +
+
+
+
+
-
diff --git a/public/templates/manager/manager-welcome.html b/public/templates/manager/manager-welcome.html index 49f7788a4b..93f7e2bc26 100644 --- a/public/templates/manager/manager-welcome.html +++ b/public/templates/manager/manager-welcome.html @@ -3,41 +3,64 @@
Management - Administer and review your cluster
-
- - - Administration - -
- Ruleset - Groups - Configuration -
-
-
-
- - -
- - - Status and reports - -
- Status - Logs - Monitoring - Reporting +
+
+
+
+

Administration

+
+
+ + + +
- - +
+
+
+

Status and reports

+
+
+ + + + +
+
+
+
- -
diff --git a/public/templates/overview/overview-welcome.html b/public/templates/overview/overview-welcome.html index 2600c3b6dc..789677c959 100644 --- a/public/templates/overview/overview-welcome.html +++ b/public/templates/overview/overview-welcome.html @@ -2,72 +2,138 @@
- Overview - Visualize the current overall status of your cluster + + Overview
- - -
- - - Host monitoring - -
- General - File integrity - AWS +
+ + +
+ Total agents: {{agentsCountTotal >= 0 ? agentsCountTotal : '---'}}
-
-
-
- - - -
- - - System audit - -
- Policy monitoring - Audit - Open SCAP - CIS-CAT +
+ Active agents: {{agentsCountActive >= 0 ? agentsCountActive : '---'}} +
+
+ Disconnected agents: {{agentsCountDisconnected >= 0 ? agentsCountDisconnected : '---'}} +
+
+ Never connected agents: {{agentsCountNeverConnected >= 0 ? agentsCountNeverConnected : '---'}}
- - -
- - - Security - -
- Vulnerabilities - VirusTotal +
+
+
+
+

Host monitoring

+
+
+ + + +
- - +
+
+
+

System audit

+
+
+ + + + +
+
+
+
- - -
- - - Compliance - -
- PCI DSS - GDPR +
+
+
+
+
+

Security

+
+
+ + +
+
- - +
+
+
+
+

Compliance

+
+
+ + +
+
+
+
+
- - -
+
\ No newline at end of file