wazuh-dashboard-plugins
wazuh-dashboard-plugins copied to clipboard
Custom branding: add validation to the plugin's settings
Description
We'll add validation to the settings of the plugin, so no invalid values can be set in the Settings / Configuration
section.
Objective
- Display errors when the input is invalid.
- Highlight the settings which contain errors.
- Disable configuration saving when there are errors.
Tasks
- Frontend
- [x] Add validation to each type of input component when its value changes.
- [x] Highlight the errors of each input.
- [x] Display the cause of error.
- [x] Add warning icon to the setting with the errors.
- [x] Disable the save button when there are errors due to invalid values.
- [ ] Add unit tests
- Backend
- [x] Validate route and body parameters of the following endpoints:
- [x]
PUT /utils/configuration
- [x]
PUT /utils/configuration/files/{key}
- [x]
- [ ] Tests
- [x] Validate route and body parameters of the following endpoints:
Depends on: #4443
Add feedback to the form's input
The management of the inputs for the plugin's settings has been improved. The following features have been added:
- An error message is added to the input when its value is invalid.
- The invalid settings are now highlighted in red.
- A warning icon is appended to the invalid settings.
- The total count of invalid settings is now shown in the bottom status bar.
- The button to save the configuration is disabled when there are invalid values.
Screenshots
-
Input's validation, invalid settings highlight, error count display and disabled of the save button.
-
Warning icon added to the invalid settings, reason displayed on mouse over.
- Added validation to each setting of the plugin in the frontend and the backend.
- Fixed some settings validation errors
- Updated the development branch with the last changes of the base branch
- Added tests to validate the updating of plugin settings using the API endpoint
PUT /utils/configuration
. (WIP)
In the validation, we should consider the values used by cloud environments, to be sure these pass the setting validations.
Some plugin configurations to keep in mind:
- https://github.com/wazuh/wazuh-saas/blob/master/services/internal/environments/common/data/kubernetes/wazuh-dashboard-wazuh-app-configmap.yaml
I created a new PR related to this issue to add de validation description to multi-line inputs description.