wazuh-dashboard-plugins
wazuh-dashboard-plugins copied to clipboard
[Remove discover] Handle index pattern selected on discover
Description
Make the search bar use the index selected in the index pattern selector.
Preconditions
The user must add a custom index pattern in the App Settings > Index pattern
section
That will show the index pattern selector in the header.
Uses cases
- When the user selects the index pattern using the selector. The discover (events tab) must use the selected index pattern.
Discover
- When the discover component receives a default index pattern like prop. The discover must use it (The component has to receive the default index pattern with an IndexPattern type)
- When the discover component does not receive a default index pattern like prop the component must get the current index pattern from the AppState.
before
type WazuhDiscoverProps {
indexPatternName: string
tableColumns: tDataGridColumn
}
after
type WazuhDiscoverProps {
indexPatternName: IndexPattern
tableColumns: tDataGridColumn
}
Tasks
- [x] Research about index pattern selector feature
- [ ] Create a generic index pattern selector component
Error use case
When the index pattern doesn't find indices by the pattern ID the index pattern doesn't change and maintains the current selection.
Solution
Change the error message and make it more clear explaining the problem. Like OSD does in the Dashboard Management > Index pattern
section
Current use case
- Get the list of index patterns
- Validate index patterns
- Select an index pattern
Tasks
- [x] Create a generic artifact to manage the different data sources separating them by domain
- For instance: Have a data source that has the responsibility to manage the index patterns
- [x] Create unit tests for all classes, components, etc
Proposed solution
sequenceDiagram
participant DataSourceFactory
participant DataSourceHandler
participant DataSourceInstance
DataSourceFactory->>DataSourceHandler: the factory is received by the handler using a dependency injection
DataSourceHandler->>DataSourceInstance: the handler can return the list of data sources created by the factory
In this way, we can create different types of data sources, and each is responsible for itself
Pending tasks
- [ ] Update documentation in the previous comment
- [ ] Add wz-data-source-selector unit test