wazuh-dashboard-plugins
wazuh-dashboard-plugins copied to clipboard
Refactor management/rules
Description
This PR refactors Management Rules views:
- To use standard / reusable Wazuh tables and flyouts to improve maintainability
- Removes the use of redux on a single ruleset view to determine whether it renders rules, decoders or cdb lists
- Segregates the modules views in their own module folder to simplify the logic and improve maintainability
- Integrates the rules / decoders details as a flyout in the table view to improve consistency with other table-details behavior in the app
- Fixes redundant API requests in the reusable Wazuh API table component
- Enhances Wazuh API table component with custom action buttons
- Fixes a ruleset view pagination bug when the it parsed the rule id from the
redirectRule
query param. It could not retrieve the rule details if it was not in the first 500 results
Closes #4105
Screenshots
Table view
Details flyout
Test cases
Summary
All call to action and navigation elements should be tested in Rules, Decoders, CDB Lists modules. When in doubt, compare the behavior of the feature with any 4.3.x Wazuh version
Tests:
-
All table features
- Pagination
- Sorting
- Row clicking
- Links within the table rows
- Search input
- Custom action buttons (
Manage rule files
,Add new rule file
,Refresh
,Export formatted
, etc.)- Manage rule / decoder files button should clear previous filters before switching the table
- Custom rules / decoders filter button
-
Clicking a row in the rules or decoders tables should open a flyout with the details of the selected item
- In the details flyout information accordion, there are "links" that should close the flyout and filter the property in the background table
- Clicking a row in the table within the details flyout should replace the information in the flyout with the selected item
- Clicking in the tables rule / decoder filename should load the file content view
-
Clicking a
rule.id
in the Events table should load the rules view with an open flyout showing the selected rule information
Jest Test Coverage | % | values |
---|---|---|
Statements | 4.05% | ( 1487 / 36690 ) |
Branches | 1.62% | ( 463 / 28551 ) |
Functions | 2.97% | ( 267 / 8978 ) |
Lines | 4.1% | ( 1439 / 35067 ) |
:warning: This issue should be taken into account when resolving this PR.
There is an open PR to fix it, but the changes will conflict with this PR. We should secure the functionality is the same.
warning This issue should be taken into account when resolving this PR.
There is an open PR to fix it, but the changes will conflict with this PR. We should secure the functionality is the same.
Applied the same solution to the columns actions in this commit: https://github.com/wazuh/wazuh-kibana-app/pull/4174/commits/7822cc52218377a1158f1873282efa1f966082b6
Test For Rules: Screencast from 02-09-22 12:40:59.webm Screencast from 02-09-22 12:37:59.webm Screencast from 02-09-22 12:25:06.webm
Test For Decoders: Screencast from 02-09-22 13:01:54.webm Screencast from 02-09-22 13:00:18.webm Screencast from 02-09-22 12:58:58.webm Screencast from 02-09-22 12:56:23.webm
Testing RBAC with the refactor
Read Only User:
Read - Delete:
Read - Write:
I need help checking the needed permissions to create/update a rule.
I try to test it and I got this error:
C.C @asteriscos @AlexRuiz7
@Mayons95 could you please specify which roles/permissions were used in your tests?
I used a read-only rules test case and this was the outcome.
RBAC Tests
I tested this roles with each call to action and work as expected. With this we finish RBAC tests in this PR and is ready to merge.