Change message for API version mismatch in WzD #4544
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Solves #4299
Important information
On PR #4103, a method was changed to request the API endpoint. Only for testing purposes of this particular issue, it is possible to replace line 50 of
server/lib/api-interceptor.ts
with the following:method: !!authContext ? 'POST' : 'GET',
to avoid getting an error due to a not allowed method and trigger the desired error.Changes made:
PLUGIN_APP_NAME
constant to make the message match the same structure as in Wazuh Dashboard, for easier modifications in the future.addTagsToUrl
function onhealth-check-container.tsx
and modified the displayed error message to use that function.addTagsToUrl
This function receives a string and returns it with the next modifications:
<something> guide: <URL>
, it will modify that part to return<something> guide
wrapped in <a> tags with the href pointing to the URL.guide:
before it, it will wrap the URL in <a> tags.Before the changes:
After the changes:
Tests
Scenario: have an environment with different versions of Wazuh API and Wazuh Dashboard, in which the major and minor are not the same.
When the user opens the Wazuh section
Then the health-check confirmation should show an error on
Check Wazuh API Version
And the log message should contain a URL to the Wazuh dashboard troubleshooting section of Wazuh Documentation.
And the log message should not contain any <a> tags or HTML structure
And the message shown at the bottom should contain a clickable link to the Wazuh dashboard troubleshooting section of Wazuh Documentation.
Scenario: have an environment with different versions of Wazuh API and Wazuh Dashboard, in which the major and minor are not the same.
When the user forces a health check in debug mode
Then the health-check confirmation should show an error on
Check Wazuh API Version
And the log message should contain a URL to the Wazuh Dashboard troubleshooting section of Wazuh Documentation.
And the log message should not contain any <a> tags or HTML structure
And the message shown at the bottom should contain a clickable link to the Wazuh Dashboard troubleshooting section of Wazuh Documentation.