-
Notifications
You must be signed in to change notification settings - Fork 182
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
Made index pattern selector appear without refreshing page #3598
base: 4.2-7.10
Are you sure you want to change the base?
Conversation
- Redux store now handles the current index states - Pattern handler updates the redux store whenever there are changes - Wz menu reloads it's data whenever there are changes to the index patterns
public/components/wz-menu/wz-menu.js
Outdated
// Getting the list of index patterns | ||
if (list) { | ||
this.setState({ | ||
patternList: list, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: If we move the list of valid index patterns to the Redux store, we should not use the component state for this case. Take into account this for renders or conditionals for display the index pattern selector, but it should use the values from the store instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in bff95d0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR: LGTM!
Testing: It works perfectly, i have changed the text of index pattern configuration option and after execute Health-Check, it appears the index pattern selector, so LGTM!
// Getting the list of index patterns | ||
if (list) { | ||
this.setState({ | ||
currentSelectedPattern: AppState.getCurrentPattern(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: Why the selected index pattern is saved as the state of the component? The lists of valid index patterns are saved in Redux with this PR if I am not wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a section of the code that remains unchanged, it only appears to be changed due to having executed the linter.
In any case, I believe the original intent for this code is to update the component when the selection has changed, and not when the list of available patterns has changed which is the purpose of this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Note: We should refactor at the next iterations, as the selected index pattern is managed, moving to Redux store instead of the component state.
Previous behaviour
The index pattern selector did not show in the menu after it was created from within the app unless you either refreshed the page, exited and re-entered the app or opened the menu.
Current behaviour
Upon performing a health check, the wz menu updates its data and displays the selector for index patterns if it is needed. To achieve this, the following changes were required.
To test
app/wazuh#/settings?tab=configuration
Closes #3579