Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign inventory, stats and configuration page to use tabs #7089

Merged
merged 185 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
185 commits
Select commit Hold shift + click to select a range
a4d6831
Add toTitleCase function for changing text to title case
guidomodarelli Oct 9, 2024
3757935
Update MainModuleAgent component to display section in EuiTabs
guidomodarelli Oct 9, 2024
9e4e087
Update module.scss styles for module header agent
guidomodarelli Oct 9, 2024
658628e
Change stats page to use tabs in Wazuh app
guidomodarelli Oct 9, 2024
43b3035
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
guidomodarelli Oct 10, 2024
c06deb9
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
guidomodarelli Oct 14, 2024
e795f2d
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
guidomodarelli Oct 17, 2024
39a124a
Refactor useAsyncAction function with TypeScript
guidomodarelli Oct 17, 2024
39c416f
Refactor AgentsWelcome component structure and layout
guidomodarelli Oct 17, 2024
76f8772
Refactor conditional rendering logic for main agent module
guidomodarelli Oct 17, 2024
cffd23d
Remove unused EuiTitle import and euiThemeVars
guidomodarelli Oct 17, 2024
bf9c817
Add EuiPanel around AgentInfo component in MainModuleAgent
guidomodarelli Oct 17, 2024
75b63d5
Update indexPattern access to handle null values safely
guidomodarelli Oct 17, 2024
855bcc8
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
guidomodarelli Oct 17, 2024
c9843b2
Fix Prettier issue
guidomodarelli Oct 17, 2024
adb1517
Remove global breadcrumb from MainModuleAgent component
guidomodarelli Oct 17, 2024
31e2404
Update AgentStats component with AgentInfo component
guidomodarelli Oct 17, 2024
6b850bf
Add AgentInfo component and update configuration options
guidomodarelli Oct 17, 2024
4aab649
Fix Prettier issue
guidomodarelli Oct 17, 2024
72a939f
Update stats and configuration page to use tabs
guidomodarelli Oct 17, 2024
24b7513
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
guidomodarelli Oct 18, 2024
a88f491
feat: add AgentInfo component to display agent details with customiza…
guidomodarelli Oct 18, 2024
a99798c
fix: update import path for AgentInfo and adjust EuiSpacer size to im…
guidomodarelli Oct 18, 2024
701544d
style: add overflow-y auto to visualization layout for improved scrol…
guidomodarelli Oct 18, 2024
c42b6ce
refactor: simplify layout in SyscollectorInventory by removing unnece…
guidomodarelli Oct 18, 2024
dce16f6
refactor: remove unused styles in welcome component for cleaner SCSS …
guidomodarelli Oct 18, 2024
8cccdf8
refactor: update import path for AgentInfo in agents-welcome for impr…
guidomodarelli Oct 18, 2024
e8b83c2
refactor: remove unused .wz-module-header-agent styles for cleaner SC…
guidomodarelli Oct 18, 2024
4738d9d
refactor: remove unused import of Agent in endpoints-summary for clea…
guidomodarelli Oct 18, 2024
10b5720
refactor: simplify MainModuleAgent component by removing unnecessary …
guidomodarelli Oct 18, 2024
a6f9d6e
refactor: enhance SyscollectorInventory with EuiPanel and AgentInfo f…
guidomodarelli Oct 18, 2024
153abef
refactor: update import path for AgentInfo to improve module structur…
guidomodarelli Oct 18, 2024
9e8c553
refactor: use clsx for conditional class assignment in MainModuleAgen…
guidomodarelli Oct 18, 2024
beb2348
refactor: adjust margin for .wz-module-header-agent to improve layout…
guidomodarelli Oct 18, 2024
be72611
refactor: fine-tune margin for EuiFlexItem in MainModuleOverview to e…
guidomodarelli Oct 18, 2024
a71e6cc
refactor: refine EuiFlexGroup and EuiFlexItem margins in MainModuleAg…
guidomodarelli Oct 18, 2024
8590bca
refactor: update SyscollectorInventory to use EuiPage for improved la…
guidomodarelli Oct 18, 2024
1ccea2f
refactor: update Prettier and VSCode settings for consistent formatti…
guidomodarelli Oct 18, 2024
50d5a3d
refactor: adjust font size and weight for .euiTab__content in module.…
guidomodarelli Oct 18, 2024
de36ca8
refactor: streamline MainModuleAgent component by simplifying conditi…
guidomodarelli Oct 18, 2024
f75f265
refactor: simplify component structure by removing unnecessary divs a…
guidomodarelli Oct 18, 2024
feb1d10
refactor: remove padding and min-height from welcome agent tabs for a…
guidomodarelli Oct 18, 2024
1750e91
refactor: remove unused variable in AgentsWelcome component for impro…
guidomodarelli Oct 18, 2024
c6736e9
refactor: add margin-right to ButtonExploreAgent for better alignment…
guidomodarelli Oct 18, 2024
abba275
refactor: simplify import statements and improve code consistency in …
guidomodarelli Oct 18, 2024
5e9e3eb
refactor: adjust indentation for improved readability in MainModuleAg…
guidomodarelli Oct 18, 2024
158d0b5
refactor: streamline formatting and improve readability in AgentInfo …
guidomodarelli Oct 18, 2024
3f9e991
refactor: update marginTop style in MainModuleAgent component for bet…
guidomodarelli Oct 18, 2024
d95bd1e
feat: add SECTIONS enum to define constants for different sections in…
guidomodarelli Oct 18, 2024
824a699
feat: create AgentTabs constants for improved organization of agent-r…
guidomodarelli Oct 18, 2024
0fa7c2c
refactor: remove unused sections constants from WzMenu for cleaner co…
guidomodarelli Oct 18, 2024
70918fe
feat: integrate AgentTabs constants into AgentsWelcome for consistent…
guidomodarelli Oct 18, 2024
9ce4e3b
fix: update Endpoint summary link to use constants for navigation and…
guidomodarelli Oct 18, 2024
829516c
feat: enhance routing in AgentView by utilizing AgentTabs constants f…
guidomodarelli Oct 18, 2024
2fadc35
refactor: streamline AgentView implementation by consolidating import…
guidomodarelli Oct 18, 2024
3a54b8e
refactor: replace hardcoded route paths with SECTIONS constants for i…
guidomodarelli Oct 18, 2024
0d012be
refactor: update MainModuleAgent to use AgentTabs for improved tab ma…
guidomodarelli Oct 18, 2024
a7ab3ab
refactor: optimize ButtonExploreAgent rendering and streamline Compli…
guidomodarelli Oct 18, 2024
6700d65
feat: add Network component for displaying agent network details, inc…
guidomodarelli Oct 18, 2024
45e5e8c
feat: introduce Software component to display agent software details,…
guidomodarelli Oct 18, 2024
e05fd9e
feat: enhance AgentView to include MainSyscollector and enable switch…
guidomodarelli Oct 18, 2024
b7b5006
feat: update MainModuleAgent to support switchTab functionality for i…
guidomodarelli Oct 18, 2024
887d87a
feat: refactor SyscollectorInventory to conditionally render Software…
guidomodarelli Oct 18, 2024
8199c23
feat: simplify imports and adjust layout in SyscollectorInventory for…
guidomodarelli Oct 18, 2024
a8ebe85
feat: rename Network and Software components to NetworkTab and Softwa…
guidomodarelli Oct 18, 2024
8da905e
feat: add ProcessesTab component to Syscollector for displaying agent…
guidomodarelli Oct 18, 2024
6c1f9ed
feat: refactor SyscollectorInventory to improve component imports and…
guidomodarelli Oct 18, 2024
59bbd12
feat: update CHANGELOG to reflect change of inventory, stats, and con…
guidomodarelli Oct 18, 2024
6d0fdb1
feat: clean up SyscollectorInventory layout by removing redundant dir…
guidomodarelli Oct 18, 2024
d3e123b
feat: streamline component imports and formatting in various files fo…
guidomodarelli Oct 18, 2024
42ba4f8
Revert prettier file
guidomodarelli Oct 21, 2024
c35a3ef
Revert Prettier and .vscode/settings.json
guidomodarelli Oct 21, 2024
7e25eac
Revert ,vscode/settings.json
guidomodarelli Oct 21, 2024
b520fb9
Fix Prettier issue
guidomodarelli Oct 21, 2024
8ae8a4a
Refactor MainModuleAgent to use inventoryTabs for rendering tabs dyna…
guidomodarelli Oct 21, 2024
5da3846
Update inventory tests to use AgentTabs for network section rendering…
guidomodarelli Oct 21, 2024
8193c76
Update inventory snapshots and tests for network ports table renderin…
guidomodarelli Oct 21, 2024
cb64da2
Update inventory snapshots and tests for network interfaces and setti…
guidomodarelli Oct 21, 2024
e819422
Refactor inventory tests to enhance structure and maintainability for…
guidomodarelli Oct 21, 2024
cbe9f87
Update inventory snapshots and tests for software and Windows updates…
guidomodarelli Oct 21, 2024
8eb1443
Update inventory snapshots and tests for processes table rendering, e…
guidomodarelli Oct 21, 2024
9b00742
Add data-test-subj for agent info in snapshots and tests, ensuring ac…
guidomodarelli Oct 21, 2024
ab30773
Refactor agent-stats component by removing redundant statsAgents defi…
guidomodarelli Oct 21, 2024
1f5bb73
Add tests for AgentStats component, ensuring it correctly renders age…
guidomodarelli Oct 21, 2024
6a72e89
Add tests for WzConfigurationSwitch component, ensuring it correctly …
guidomodarelli Oct 21, 2024
40a161a
Add data-test-subj attributes to multiple table components for improv…
guidomodarelli Oct 21, 2024
f137853
Fix Prettier issue
guidomodarelli Oct 21, 2024
120ca60
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
guidomodarelli Oct 21, 2024
4663576
Enhance type annotations in ReportingService for improved clarity and…
guidomodarelli Oct 22, 2024
7cff612
Add data-test attributes for improved testing in MainModuleAgent and …
guidomodarelli Oct 22, 2024
a84aae0
Improve type safety in MainModuleAgent and GenerateReportButton by sp…
guidomodarelli Oct 22, 2024
36b9375
Remove unused imports and instances of ReportingService and FilterHan…
guidomodarelli Oct 22, 2024
7da109c
Remove unused imports in MainModuleAgent for cleaner code and improve…
guidomodarelli Oct 22, 2024
88071a9
Remove unused state property 'switchModule' in MainModuleAgent for cl…
guidomodarelli Oct 22, 2024
5b96d53
Remove unused state property 'selectView' in MainModuleAgent for clea…
guidomodarelli Oct 22, 2024
03ee4e4
Fix optional chaining for renderTabs method in MainModuleAgent to imp…
guidomodarelli Oct 22, 2024
238d753
Refactor tab layout in MainModuleAgent for improved readability and c…
guidomodarelli Oct 22, 2024
7e9150f
Add unit tests for MainModuleAgent to validate tab rendering behavior…
guidomodarelli Oct 22, 2024
28e2a2e
Add unique key prop to EuiTab in MainModuleAgent for better performan…
guidomodarelli Oct 22, 2024
9638a56
Update MainModuleAgent and tests for dynamic report tab rendering bas…
guidomodarelli Oct 22, 2024
580d7b4
Refactor MainModuleAgent tests to use Testing Library, improving read…
guidomodarelli Oct 22, 2024
3511f3a
Refactor WzConfigurationSwitch tests to use Testing Library, enhancin…
guidomodarelli Oct 22, 2024
9563d0a
Refactor MainAgent tests to use constants for report tab identifiers,…
guidomodarelli Oct 22, 2024
f1c5df5
Refactor AgentStats tests to utilize queryDataTestAttr for agent info…
guidomodarelli Oct 22, 2024
bc5ee7e
Refactor AgentStats test to use container and queryDataTestAttr, impr…
guidomodarelli Oct 22, 2024
b22a505
Fix Prettier issue
guidomodarelli Oct 22, 2024
f8eb47c
Update report tab constants in main-agent tests for consistency with …
guidomodarelli Oct 22, 2024
e79b61a
Refactor AgentStats test to use wrapper for querying agent info, enha…
guidomodarelli Oct 22, 2024
5d60cb5
Enhance WzManagementConfiguration to always show agent info and impro…
guidomodarelli Oct 23, 2024
8169159
Add data-test-subj to EuiSpacer and update tests for WzConfigurationS…
guidomodarelli Oct 23, 2024
ea57eec
Remove outdated group display logic in WzConfigurationSwitch to impro…
guidomodarelli Oct 23, 2024
1051ba6
Fix Prettier issue
guidomodarelli Oct 23, 2024
947029c
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
chantal-kelm Oct 23, 2024
6df7fc0
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
guidomodarelli Oct 24, 2024
1e591b7
style(visualizations): remove overflow-y property from visualization …
guidomodarelli Oct 24, 2024
c5adbc9
refactor(configuration-switch): streamline agent grouping display and…
guidomodarelli Oct 24, 2024
9afec66
refactor(agent-stats): enhance stats display with structured fields a…
guidomodarelli Oct 24, 2024
7536d31
refactor(main-agent): simplify section checks by limiting tabs to SOF…
guidomodarelli Oct 24, 2024
d03174b
refactor(main-agent): destructure props for improved readability and …
guidomodarelli Oct 24, 2024
32dfee3
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
guidomodarelli Oct 24, 2024
e94af7c
test(main-agent): add tests to verify absence of generate report butt…
guidomodarelli Oct 24, 2024
ed8946a
test(inventory): remove STATE column from processes table test for ac…
guidomodarelli Oct 24, 2024
6e1a600
test(agent-stats): add tests to verify absence of generate report but…
guidomodarelli Oct 24, 2024
4ef3da8
test(agent-stats): simplify imports in agent-stats test file for clea…
guidomodarelli Oct 24, 2024
efa2575
fix(wz-text-with-tooltip): refactor props interface and clean up comp…
guidomodarelli Oct 24, 2024
f88c74f
fix(group-truncate): update filterAction type and simplify action fun…
guidomodarelli Oct 24, 2024
22bdfd8
refactor(agent-info): migrate agents-info.js to TypeScript for improv…
guidomodarelli Oct 24, 2024
ab0d2de
refactor(agent-info): rename agents-info to agent-info for consistent…
guidomodarelli Oct 24, 2024
fffa060
fix(group-truncate): make action type explicit and handle optional fi…
guidomodarelli Oct 24, 2024
fa69e14
refactor(agent-info): rename checkField to renderField for improved c…
guidomodarelli Oct 24, 2024
4382087
refactor(agent-info): simplify getOsName method for clearer logic and…
guidomodarelli Oct 24, 2024
3cc4ef3
refactor(agent-status): enhance type safety in AgentStatus props and …
guidomodarelli Oct 24, 2024
4b452c3
refactor(agent-info): streamline agent stats structure and replace Wz…
guidomodarelli Oct 24, 2024
a98013d
refactor(agent-info): update labels to use RibbonItemLabel constants …
guidomodarelli Oct 24, 2024
576504c
refactor(agent-info): simplify agent stats display by replacing speci…
guidomodarelli Oct 24, 2024
bc30258
refactor(api-response): add api_version field to IData interface for …
guidomodarelli Oct 24, 2024
2cdbc20
refactor(agent-info): remove direct agent reference from RibbonItem, …
guidomodarelli Oct 24, 2024
b5828ee
feat(ribbon-item): implement RibbonItem component for enhanced displa…
guidomodarelli Oct 24, 2024
840ddce
refactor(ribbon-item): rename renderTitle to renderValue for improved…
guidomodarelli Oct 24, 2024
39a5be9
feat(ribbon): add Ribbon component for flexible ribbon layout, enhanc…
guidomodarelli Oct 24, 2024
092932c
refactor(ribbon-item): rename class from wz-agent-info to wz-ribbon-i…
guidomodarelli Oct 24, 2024
62bba5c
refactor(ribbon): rename Ribbon to WzRibbon for consistent naming acr…
guidomodarelli Oct 24, 2024
6ec46cd
refactor(syscollector-metrics): simplify rendering by utilizing WzRib…
guidomodarelli Oct 24, 2024
393e040
refactor(inventory): replace AgentInfo with InventoryMetrics to strea…
guidomodarelli Oct 24, 2024
d71f988
refactor(ribbon): add loading state and improve structure by wrapping…
guidomodarelli Oct 24, 2024
9b2b89b
refactor(syscollector-metrics): streamline imports and use lodash dir…
guidomodarelli Oct 24, 2024
4190a75
refactor(syscollector-metrics): replace static label with constant fo…
guidomodarelli Oct 24, 2024
ace02eb
refactor(syscollector-metrics): increase maxWidth for CPU styling to …
guidomodarelli Oct 24, 2024
587787b
refactor(ribbon-item): enhance OS detection by adding support for Ubu…
guidomodarelli Oct 24, 2024
99bbb26
refactor(ribbon-item): adjust styling to incorporate font size consta…
guidomodarelli Oct 24, 2024
ebb08b2
refactor(ribbon-item): add optional icon property to ribbon items for…
guidomodarelli Oct 24, 2024
6768d9f
refactor(agents-welcome): simplify layout by removing unnecessary Eui…
guidomodarelli Oct 24, 2024
4acce0a
refactor(main-agent): streamline rendering logic by removing redundan…
guidomodarelli Oct 24, 2024
fee0e17
refactor(ribbon): add unique keys for ribbon items to enhance renderi…
guidomodarelli Oct 24, 2024
c962268
refactor(syscollector-metrics): add unique keys to ribbon items for i…
guidomodarelli Oct 24, 2024
64db74f
refactor(agent-stats): replace panel with WzRibbon for better present…
guidomodarelli Oct 24, 2024
768accc
Fix Prettier issue
guidomodarelli Oct 24, 2024
cf35f36
refactor(ribbon): add SCSS styling for ribbon item and remove unused …
guidomodarelli Oct 24, 2024
f5782da
refactor(syscollector): replace EuiPanel with EuiPageBody for improve…
guidomodarelli Oct 24, 2024
446d8cb
style(constants): fix formatting issue in AGENT_STATUS_CODE array to …
guidomodarelli Oct 24, 2024
bef4774
chore(tests): update snapshots and refactor inventory tests for bette…
guidomodarelli Oct 24, 2024
aae6909
Fix Prettier issue
guidomodarelli Oct 24, 2024
5150a1e
feat(tests): enhance WzConfigurationSwitch tests and add CSS selector…
guidomodarelli Oct 24, 2024
2f85fae
feat(ui): rename report-tabs to agent-tabs for improved clarity in Ma…
guidomodarelli Oct 24, 2024
1cb8d2d
feat(tests): update test descriptions and selectors to reflect renami…
guidomodarelli Oct 24, 2024
79ad758
feat(tests): refine agent-stats and main-agent tests to include check…
guidomodarelli Oct 25, 2024
cedfaeb
feat(tests): add inventory metrics tests for Debian agent in Syscolle…
guidomodarelli Oct 25, 2024
2f745ed
feat(tests): improve selector readability in main-agent tests by extr…
guidomodarelli Oct 25, 2024
4344b3a
feat(tests): enhance main-agent tests with comprehensive coverage for…
guidomodarelli Oct 25, 2024
93d2eb5
feat(tests): add ribbon rendering tests in AgentStats to ensure accur…
guidomodarelli Oct 25, 2024
d4c9c5a
fix(tests): correct syntax in AgentStats test for improved readabilit…
guidomodarelli Oct 25, 2024
8d2fe0b
feat(tests): add unit tests for InventoryMetrics to validate renderin…
guidomodarelli Oct 25, 2024
a0bd8a4
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
guidomodarelli Oct 25, 2024
b18a797
fix(wz-agents): change agent parameter type to optional for better fl…
guidomodarelli Oct 25, 2024
48f6559
fix(agent-info/syscollector): update labels and key assignments for b…
guidomodarelli Oct 25, 2024
6a05349
fix(ribbon): adjust padding size and justify content for better layou…
guidomodarelli Oct 25, 2024
4b3d4fa
fix(ribbon): update label formats to lowercase and switch from label …
guidomodarelli Oct 25, 2024
067a691
fix(ribbon): add conditional rendering to prevent empty icon display …
guidomodarelli Oct 25, 2024
e539e0d
fix(agent-group-truncate): enhance button styling with specified font…
guidomodarelli Oct 25, 2024
b5d0eca
fix(snapshot): update ribbon item data-test attribute to reflect corr…
guidomodarelli Oct 25, 2024
dc4c328
Merge branch '4.10.0' into enhancement/7088-redesign-stats-page-to-us…
guidomodarelli Oct 28, 2024
62b8008
fix(reporting): change default value of agents parameter from string …
guidomodarelli Oct 28, 2024
973d1ca
fix(agent): remove unnecessary prop from WzManagementConfiguration in…
guidomodarelli Oct 28, 2024
1db69ef
fix(ribbon): rename STATUS label to AGENT_STATUS in ribbon and agent …
guidomodarelli Oct 28, 2024
688263f
fix(agent-info): update label casing for agent status and group in Ag…
guidomodarelli Oct 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Changed the warning icon in events view to a info icon [#7057](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7057)
- Changed feature container margins to ensure consistent separation and uniform design. [#7034](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7034)
- Changed the initial width to the default columns on each selected field [#7059](https://github.com/wazuh/wazuh-dashboard-plugins/issues/7059)
- Changed inventory, stats and configuration page to use tabs [#7089](https://github.com/wazuh/wazuh-dashboard-plugins/pull/7089)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion docker/imposter/wazuh-config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
plugin: openapi
specFile: https://raw.githubusercontent.com/wazuh/wazuh/master/api/api/spec/spec.yaml
specFile: https://raw.githubusercontent.com/wazuh/wazuh/4.10.0/api/api/spec/spec.yaml
system:
stores:
# this store is preloaded from file
Expand Down
31 changes: 22 additions & 9 deletions plugins/main/common/services/wz_agent_status.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
import { UI_COLOR_AGENT_STATUS, UI_LABEL_NAME_AGENT_STATUS, API_NAME_AGENT_STATUS } from '../constants';
import {
UI_COLOR_AGENT_STATUS,
UI_LABEL_NAME_AGENT_STATUS,
API_NAME_AGENT_STATUS,
} from '../constants';

type TAgentStatus = typeof API_NAME_AGENT_STATUS[keyof typeof API_NAME_AGENT_STATUS];
export type TAgentStatus =
(typeof API_NAME_AGENT_STATUS)[keyof typeof API_NAME_AGENT_STATUS];

type TAgentStatusColor = typeof UI_COLOR_AGENT_STATUS[keyof typeof UI_COLOR_AGENT_STATUS];
type TAgentStatusLabel = typeof UI_LABEL_NAME_AGENT_STATUS[keyof typeof UI_LABEL_NAME_AGENT_STATUS];
type TAgentStatusColor =
(typeof UI_COLOR_AGENT_STATUS)[keyof typeof UI_COLOR_AGENT_STATUS];
type TAgentStatusLabel =
(typeof UI_LABEL_NAME_AGENT_STATUS)[keyof typeof UI_LABEL_NAME_AGENT_STATUS];

export function agentStatusColorByAgentStatus(status: TAgentStatus): TAgentStatusColor{
return UI_COLOR_AGENT_STATUS[status] || UI_COLOR_AGENT_STATUS.default;
export function agentStatusColorByAgentStatus(
status: TAgentStatus,
): TAgentStatusColor {
return UI_COLOR_AGENT_STATUS[status] || UI_COLOR_AGENT_STATUS.default;
}

export function agentStatusLabelByAgentStatus(status: TAgentStatus): TAgentStatusLabel{
return UI_LABEL_NAME_AGENT_STATUS[status] || UI_LABEL_NAME_AGENT_STATUS.default;
}
export function agentStatusLabelByAgentStatus(
status: TAgentStatus,
): TAgentStatusLabel {
return (
UI_LABEL_NAME_AGENT_STATUS[status] || UI_LABEL_NAME_AGENT_STATUS.default
);
}
29 changes: 19 additions & 10 deletions plugins/main/public/app-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Settings } from './components/settings';
import { WzSecurity } from './components/security';
import $ from 'jquery';
import NavigationService from './react-services/navigation-service';
import { SECTIONS } from './sections';

export function Application(props) {
const dispatch = useDispatch();
Expand Down Expand Up @@ -66,33 +67,41 @@ export function Application(props) {
<WzAgentSelectorWrapper />
<WzUpdatesNotification />
<Switch>
<Route path={'/health-check'} exact render={HealthCheck}></Route>
<Route
path={'/agents-preview/deploy'}
path={`/${SECTIONS.HEALTH_CHECK}`}
exact
render={HealthCheck}
></Route>
<Route
path={`/${SECTIONS.AGENTS_PREVIEW}/deploy`}
exact
render={RegisterAgent}
></Route>
<Route path={'/agents'} exact render={AgentView}></Route>
<Route path={`/${SECTIONS.AGENTS}`} exact render={AgentView}></Route>
<Route
path={'/agents-preview/'}
path={`/${SECTIONS.AGENTS_PREVIEW}/`}
exact
render={MainEndpointsSummary}
></Route>
<Route path={'/manager'} exact render={WzManagement}></Route>
<Route
path={'/overview'}
path={`/${SECTIONS.MANAGER}`}
exact
render={WzManagement}
></Route>
<Route
path={`/${SECTIONS.OVERVIEW}`}
exact
render={props => <Overview {...props} />}
></Route>
<Route path={'/settings'} exact render={Settings}></Route>
<Route path={'/security'} exact render={WzSecurity}></Route>
<Route path={`/${SECTIONS.SETTINGS}`} exact render={Settings}></Route>
<Route path={`/${SECTIONS.SECURITY}`} exact render={WzSecurity}></Route>
<Route
path={'/wazuh-dev'}
path={`/${SECTIONS.WAZUH_DEV}`}
exact
render={props => <ToolsRouter {...props} />}
></Route>
<Route
path={'/blank-screen'}
path={`/${SECTIONS.BLANK_SCREEN}`}
exact
render={props => <WzBlankScreen {...props} />}
></Route>
Expand Down
18 changes: 16 additions & 2 deletions plugins/main/public/components/agents/agent-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,29 @@ import React from 'react';
import {
agentStatusColorByAgentStatus,
agentStatusLabelByAgentStatus,
TAgentStatus,
} from '../../../common/services/wz_agent_status';
import { ColumnWithStatusIcon } from './column-with-status-icon';
import { EuiIconTip } from '@elastic/eui';
import { AGENT_STATUS_CODE } from '../../../common/constants';
import '../../styles/common.scss';
import { Agent } from '../endpoints-summary/types';

export const AgentStatus = ({ status, children = null, style = {}, agent }) => {
interface AgentStatusProps {
status: TAgentStatus;
children?: string | null;
style?: React.CSSProperties;
agent?: Agent;
}

export const AgentStatus = ({
status,
children,
style = {},
agent,
}: AgentStatusProps) => {
const statusCodeAgent = AGENT_STATUS_CODE.find(
(status: StatusCodeAgent) => status.STATUS_CODE === agent?.status_code,
status => status.STATUS_CODE === agent?.status_code,
);
return (
<div
Expand Down
68 changes: 68 additions & 0 deletions plugins/main/public/components/agents/stats/agent-stats.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React from 'react';
import { render, act } from '@testing-library/react';
import { AgentStats } from './agent-stats';
import { queryDataTestAttr } from '../../../../test/public/query-attr';
import { CSS } from '../../../../test/utils/CSS';

jest.mock('../../../react-services', () => ({
WzRequest: {
apiReq: jest.fn().mockResolvedValue(undefined),
},
}));

describe('AgentStats', () => {
it('should not render agent info ribbon', async () => {
await act(async () => {
const { container } = render(<AgentStats agent={{ id: '000' }} />);

const agentInfoRibbon = container.querySelector(
queryDataTestAttr('agent-info'),
);
expect(agentInfoRibbon).toBeFalsy();
});
});

it('should render stats info ribbon', async () => {
await act(async () => {
const { container } = render(<AgentStats agent={{ id: '000' }} />);

expect(
container.querySelector(queryDataTestAttr('ribbon-item-status')),
).toBeTruthy();

expect(
container.querySelector(
queryDataTestAttr('ribbon-item-buffer_enabled'),
),
).toBeTruthy();

expect(
container.querySelector(queryDataTestAttr('ribbon-item-msg_buffer')),
).toBeTruthy();

expect(
container.querySelector(queryDataTestAttr('ribbon-item-msg_count')),
).toBeTruthy();

expect(
container.querySelector(queryDataTestAttr('ribbon-item-msg_sent')),
).toBeTruthy();

expect(
container.querySelector(queryDataTestAttr('ribbon-item-last_ack')),
).toBeTruthy();

expect(
container.querySelector(
queryDataTestAttr('ribbon-item-last_keepalive'),
),
).toBeTruthy();

expect(
container.querySelectorAll(
queryDataTestAttr('ribbon-item-', CSS.Attribute.Substring),
),
).toHaveLength(7);
});
});
});
45 changes: 17 additions & 28 deletions plugins/main/public/components/agents/stats/agent-stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
import { getErrorOrchestrator } from '../../../react-services/common-services';
import { endpointSummary } from '../../../utils/applications';
import NavigationService from '../../../react-services/navigation-service';
import WzRibbon from '../../common/ribbon/ribbon';

const tableColumns = [
{
Expand Down Expand Up @@ -142,7 +143,8 @@ export const MainAgentStats = compose(
),
)(AgentStats);

function AgentStats({ agent }) {
export function AgentStats(props) {
const { agent } = props;
const [loading, setLoading] = useState();
const [dataStatLogcollector, setDataStatLogcollector] = useState({});
const [dataStatAgent, setDataStatAgent] = useState();
Expand Down Expand Up @@ -186,33 +188,20 @@ function AgentStats({ agent }) {
return (
<EuiPage>
<EuiPageBody>
<EuiFlexGroup>
<EuiFlexItem>
<EuiPanel paddingSize='m'>
<EuiFlexGroup>
{statsAgents.map(stat => (
<EuiFlexItem key={`agent-stat-${stat.field}`} grow={false}>
<EuiText>
{stat.title}:{' '}
{loading ? (
<EuiLoadingSpinner size='s' />
) : (
<strong>
{dataStatAgent !== undefined
? stat.render
? stat.render(dataStatAgent[stat.field])
: dataStatAgent?.[stat.field]
: '-'}
</strong>
)}
</EuiText>
</EuiFlexItem>
))}
</EuiFlexGroup>
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer />
<WzRibbon
items={statsAgents.map(stat => ({
key: stat.field,
label: stat.title,
isLoading: loading,
value:
dataStatAgent !== undefined
? stat.render
? stat.render(dataStatAgent[stat.field])
: dataStatAgent?.[stat.field]
: '-',
}))}
/>
<EuiSpacer size='xxl' />
<EuiFlexGroup>
<EuiFlexItem>
<AgentStatTable
Expand Down
Loading
Loading