Skip to content

Add Fleet Management > Agents view #7283

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

Merged
merged 204 commits into from
Apr 14, 2025

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.)

Verify that one request is made to the Indexer, ensuring that unnecessary calls are not generated.

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.
@guidomodarelli guidomodarelli dismissed stale reviews from Machi3mfl and themself via 6b31ceb April 10, 2025 12:20
Updates the test configuration to enable coverage collection
only when running in a CI environment. Prevents unnecessary
coverage reporting during local development.
Introduces a localStorage mock to facilitate testing components relying on localStorage API.

Updates Jest configuration to include the mock setup file in test initialization for consistent test behavior.
Refactors multiple localStorage-based state managers into a single, unified manager.
Simplifies key generation by removing unnecessary parameters.
Updates tests to align with the new structure and validation logic.
Improves state validation for columns, widths, and page size.

Enhances maintainability and reduces redundancy in state management.
Unifies column and column-width state management into a single persistence manager for consistency and maintainability. Replaces `appId` with `moduleId` for improved clarity. Updates function names and test cases to align with the new state management approach. Simplifies and consolidates validation and retrieval logic.

Enhances code readability and reduces duplication.
Replaces TDataGridColumn with DataGridColumn across components for consistency and clarity. Introduces DataGridRenderColumn type for enhanced type definition. Updates tests and imports accordingly to align with changes.
Initializes pagination with `pageSize = 0` to avoid conflicts between local state and internal hooks, reducing multiple redundant fetches. Adds a conditional check to ensure data is only fetched once a valid `pageSize` is set. Replaces hardcoded page size options with a constant for consistency.
Replaces references to moduleId with appId for consistency across components. Updates hook logic, state management, and dependencies accordingly. Simplifies and removes redundant tests related to column rendering.
Migrates data grid logic to TypeScript for improved type safety
Introduces state persistence manager for column and pagination settings
Sanitizes rendered cell values for enhanced security
Simplifies and optimizes pagination and sorting logic
Improves column schema handling with memoized methods
Replaces the boolean-based reload logic with an RxJS Subject for triggering component refreshes. Improves code readability and reduces state management complexity by using observables.

Enhances maintainability and aligns with reactive programming patterns.
Refactors initialization of pagination state to use a dedicated type.
Removes unnecessary use of 'as const' in constants for improved readability.
Ensures consistent handling of page size defaults in the data grid logic.
Refactors state persistence logic to ensure invalid state resets
are persisted. Updates tests to reflect changes in state retrieval
behavior. Enhances reliability and consistency of state management.
Renames the "columnsWidth" property to "columnWidths" across
codebase for improved clarity and consistency.

Updates related type definitions, logic, and test cases
to reflect the new naming convention.
Ensures rows are always parsed into an array for consistency.
Updates row index validation to use a safer boundary check.
Improves reliability of data handling for pagination.
Wraps column schema definitions in a shallow copy to prevent unintended mutations when processing visible columns in the data grid.
Introduces `indexPatternExists` property to ensure operations depend on the presence of an index pattern.

Updates validation logic, state persistence, and column handling to bypass processing when the index pattern is missing, improving stability and preventing unnecessary operations.
Includes the indexPatternExists parameter in multiple test cases
to ensure proper coverage and handling of scenarios where index
patterns exist.
Replaces moduleId with appId in test cases for consistency.
Adds indexPatternExists parameter to improve test coverage and alignment with updated function requirements.
Refactors agent reloading logic to use a reactive pattern with subscriptions.
Replaces `reloadAgents` callbacks with direct calls to `refresh$.next()`.
Adds a `useEffect` hook to manage subscription lifecycle and ensure cleanup.

Improves code clarity and ensures consistent state updates.
@guidomodarelli
Copy link
Contributor

Verify that one request is made to the Indexer, ensuring that unnecessary calls are not generated.

Screen.Recording.2025-04-11.161143.mp4

Replaces the agent summary diagram with a new version to reflect updated information or design changes for improved clarity.
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 )

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 40.38% ( 773 / 1914 )
Branches 36.92% ( 353 / 956 )
Functions 38.38% ( 233 / 607 )
Lines 40.2% ( 753 / 1873 )

Copy link
Member

@Desvelao Desvelao left a comment

Choose a reason for hiding this comment

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

LGTM!

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! 🟢

@asteriscos asteriscos merged commit 6f8c003 into main Apr 14, 2025
3 checks passed
@asteriscos asteriscos deleted the enhancement/517-create-agent-management-apps branch April 14, 2025 15:23
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
5 participants