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

Add Fleet Management > Agents view #7283

Open
wants to merge 124 commits into
base: main
Choose a base branch
from

Conversation

yenienserrano
Copy link
Member

@yenienserrano yenienserrano commented Feb 6, 2025

Description

Adds rendering of fleet management summary and detail views

Added the script to generate sample data of wazuh-agents* with this template

Issues Resolved

Evidence

image

Edit group

Screen.Recording.2025-02-20.at.5.34.53.PM.mov

Test

Check that the interface is visible, you can add sample data of the agents from the script (The table is using information from the indexer but the other actions are mocked up.)

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Desvelao and others added 2 commits February 6, 2025 10:14
- Copy the register-agent folder from wazuh plugin to wazuh-fleet
- Add the webDocumentationLink and form components/hook to
  register-agent copy
- Register minimal Fleet management app to display the register agent
  assistant view
@yenienserrano yenienserrano linked an issue Feb 6, 2025 that may be closed by this pull request
yenienserrano and others added 6 commits February 7, 2025 22:13
Added:
- Added inputs to match with the `wazuh-agent` cli:
  - Input to manage the username
  - Input to manage the password
  - Input to manage the SSL verification mode
  - Input to manage the key (This key must have 32 alphanumeric characters validation)
- Added new step "Server credentials" to define the username and password
- Added tests for the new inputs

Changed:
- Changed the generation of command to install and enroll the agent
- Changed the validation of "Assign a server address" input
- Changed the placeholder of "Assign a server address" input
- Changed the description of "Server address" step to indicate the usage of URL instead of raw IP or FQDNS

Removed:
- Groups management was removed because the current Wazuh agent enrollment does not support the definition of these.
  - Removed groups form input
  - Removed fetch information about available groups
- Removed fetch information about authentication password provided through the Wazuh server API
- Removed fetch information about protocol provided through the Wazuh server API
- Temporally:
  - The command to download the package were temporaly removed because the packages are not publically hosted. A warning message was added to inform about this.
@yenienserrano yenienserrano changed the title Add rendering of views without indexer table and fix lint Add Fleet Management > Agents view Feb 11, 2025
@yenienserrano yenienserrano self-assigned this Feb 13, 2025
yenienserrano and others added 12 commits February 13, 2025 12:23
…sons

The setting is saved in the advanced settings (tenant configuration) and
is visible to each user with read permissions in the tenant. So we
remove the setting to avoid other users can see the value. The user should
indicate the username and password each time the enroll agent assistant is
used.
… enhancement/514-add-enrollment-agent-assistant
…ckage type options

- Extract package type options into a constant array for better maintainability
- Simplify toast handling by directly using `getToasts().addInfo` and `getToasts().addDanger`
- Rename `handleOnSave` to `handleSave` for consistency
…ate functions

Improve code maintainability by breaking down complex rendering logic into smaller, reusable functions such as `renderAgentsAccordion`, `renderErrorCallout`, and `AgentGroupActionResult`. This reduces redundancy and enhances readability.
- Replace ambiguous types with specific type imports from Elastic UI and Wazuh Core
- Split `results` state into `items` and `total` for better clarity
- Remove unused `TDocumentDetailsTab` interface
- Update `setParams` to use explicit types for filters and query
…leSave

Refactor the `reloadAgents` callback to invoke the `reloadAgents` function instead of an empty function. Rename `handleOnSave` to `handleSave` for consistency and clarity. Additionally, centralize error messages in `EditAgentNameModal` to improve maintainability.
…to separate components

Improve code maintainability by breaking down the large component into smaller, more focused components for handling agents data and upgrade tasks
The `handleOnSave` function was renamed to `handleSave` for consistency and clarity. Additionally, the logic for processing agents was extracted into a separate `processAgent` function to improve readability and maintainability. This change does not alter the behavior of the code.
This commit relocates the `transformDateRange` function from the search-service to a dedicated utils module for better code organization and reusability. The function is now exported from the utils index and used in the search-bar component, reducing redundancy and improving maintainability.
Replace the generic 'any' type with the specific 'IAgentResponse' type in the agent details component to improve type safety and maintainability
Machi3mfl
Machi3mfl previously approved these changes Mar 20, 2025
Copy link
Member

@Machi3mfl Machi3mfl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: ✅
Test: ✅

Screen.Recording.2025-03-20.at.3.48.58.PM.mov

Move the NavigationService implementation to wazuh-core and update all references to use the service from wazuh-core. This change improves code maintainability by centralizing the navigation logic and reducing redundancy across the codebase.
Refactor the pre-commit hook to handle cases where no files are staged, improving clarity and reducing unnecessary checks. Also, update the output messages for better readability.
The `interface.ts` file in the search-bar component was deleted as it was no longer used in the codebase. This change helps in maintaining a cleaner and more efficient project structure by removing unnecessary files.
Machi3mfl
Machi3mfl previously approved these changes Mar 20, 2025
This change introduces an `isValid` flag to the validation state, improving clarity and consistency when checking if the agent name is valid. The flag is used in the Enter key handler to determine if the save action should proceed.
Renames error message object for clarity
Updates references to new object name in validation logic
Extracts agent name length constraints into constants for reusability.
Updates validation logic to use new constants.
Removes redundant isInvalid state property to streamline validation logic.
Updates related condition checks to use !isValid instead.
Machi3mfl
Machi3mfl previously approved these changes Mar 21, 2025
@guidomodarelli
Copy link
Contributor

guidomodarelli commented Mar 25, 2025

Legend:
⚫ => The test hasn't started yet.
🟢 => All checks passed.
🟡 => There is at least one expected fail or skipped test and no failures.
🔴 => There is at least one failed check.
⚪ => Doesn't apply.
🔧 => Request changes.

Testing

Visualizations interaction 🟢

Screen.Recording.2025-03-25.103733.mp4

Search bar interaction 🟢

Screen.Recording.2025-03-25.104217.mp4
Screen.Recording.2025-03-25.105244.mp4

Bulk actions 🟢

Screen.Recording.2025-03-25.105644.mp4

Agent Actions 🟢

Screen.Recording.2025-03-25.110101.mp4

guidomodarelli
guidomodarelli previously approved these changes Mar 25, 2025
Copy link
Contributor

@guidomodarelli guidomodarelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🟢

…for clarity

Rename `getVisTopAgentByNode` to `getVisStatus` for better readability and reorder the visualization functions in the `getKPIsPanel` method to match the updated naming convention. This improves code maintainability and consistency.
@yenienserrano yenienserrano dismissed stale reviews from guidomodarelli and Machi3mfl via e8bba67 March 26, 2025 19:57
Copy link
Contributor

Wazuh Core plugin code coverage (Jest) test % values
Statements 28.24% ( 711 / 2517 )
Branches 28.92% ( 370 / 1279 )
Functions 26.08% ( 186 / 713 )
Lines 28.38% ( 706 / 2487 )

Copy link
Contributor

Wazuh Fleet Management plugin code coverage (Jest) test % values
Statements 28.9% ( 348 / 1204 )
Branches 30.96% ( 161 / 520 )
Functions 28.7% ( 120 / 418 )
Lines 28.97% ( 341 / 1177 )

Copy link
Contributor

Wazuh Check Updates plugin code coverage (Jest) test % values
Statements 76.44% ( 172 / 225 )
Branches 58.65% ( 61 / 104 )
Functions 61.7% ( 29 / 47 )
Lines 76.44% ( 172 / 225 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create agent management apps
4 participants