Skip to content
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

[Remove discover] Change index pattern selector mechanism #6434

Closed
2 tasks done
Tracked by #6120
Machi3mfl opened this issue Feb 20, 2024 · 3 comments · Fixed by #6438
Closed
2 tasks done
Tracked by #6120

[Remove discover] Change index pattern selector mechanism #6434

Machi3mfl opened this issue Feb 20, 2024 · 3 comments · Fixed by #6438
Assignees
Labels

Comments

@Machi3mfl
Copy link
Member

Machi3mfl commented Feb 20, 2024

Description

Make the search bar use the index selected in the index pattern selector.

Screenshot 2024-02-20 at 12 39 23

Preconditions

The user must add a custom index pattern in the App Settings > Index pattern section

Screenshot 2024-02-20 at 12 40 24

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

  • Research about index pattern selector feature
  • Create a generic index pattern selector component
@Machi3mfl Machi3mfl self-assigned this Feb 20, 2024
@Tostti Tostti added type/enhancement Enhancement issue level/task Task issue type/change and removed type/enhancement Enhancement issue labels Feb 21, 2024
@Machi3mfl
Copy link
Member Author

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.

Screenshot 2024-02-21 at 15 48 29

Solution

Change the error message and make it more clear explaining the problem. Like OSD does in the Dashboard Management > Index pattern section

Screenshot 2024-02-22 at 11 57 52

@Machi3mfl
Copy link
Member Author

Machi3mfl commented Feb 29, 2024

Current use case

  • Get the list of index patterns
  • Validate index patterns
  • Select an index pattern

Tasks

  • 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
  • Create unit tests for all classes, components, etc
Screenshot 2024-03-11 at 17 38 37

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

@Machi3mfl
Copy link
Member Author

Machi3mfl commented Mar 11, 2024

Pending tasks

  • Update documentation in the previous comment
  • Add wz-data-source-selector unit test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants