Made index pattern selector appear without refreshing page#3598
Made index pattern selector appear without refreshing page#3598mpRegalado wants to merge 4 commits into4.2-7.10from
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.
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.
CPAlejandro
left a comment
There was a problem hiding this comment.
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.
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.
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
Desvelao
left a comment
There was a problem hiding this comment.
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=configurationCloses #3579