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

[Vulnerabilities dashboards] Add search bar services #5960

Conversation

Machi3mfl
Copy link
Member

@Machi3mfl Machi3mfl commented Sep 28, 2023

Description

Add search bar services

Closes #5945

Unit test added

  • should return default app index pattern when not receiving a default index pattern
  • should return the same index pattern when receiving a default index pattern
  • should show an ERROR message and get the default app index pattern when not found the index pattern data by the ID received
  • should return the same filters and apply them to the filter manager when are received by props
  • should return and preserve filters when the index pattern received is equal to the index pattern already selected in the app
  • should return empty filters when the index pattern is NOT equal to the default app index pattern
Screenshot 2023-09-29 at 16 57 07

Check List

  • All tests pass
    • yarn test:jest
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@Machi3mfl
Copy link
Member Author

Machi3mfl commented Sep 28, 2023

Basic use example

  const SearchBar = getPlugins().data.ui.SearchBar;

  const { searchBarProps } = useSearchBarConfiguration({
    defaultIndexPatternID: 'your index id',
    onFiltersUpdated: (filters) => {
     // triggered when filters changes
      console.log(filters);
    },
    onQuerySubmitted: (payload) => {
     // triggered when query and time filter changes
      console.log(payload);
    },
  });

  return (
    <>
      <I18nProvider> {/* The searchbar is not rendered when is not wrapped by the i18n provider */}
        <SearchBar
          {...searchBarProps}
        />
      </I18nProvider>
    </>
  );

@Machi3mfl Machi3mfl linked an issue Sep 28, 2023 that may be closed by this pull request
8 tasks
@Machi3mfl Machi3mfl marked this pull request as ready for review September 29, 2023 19:58
@Machi3mfl Machi3mfl requested a review from a team as a code owner September 29, 2023 19:58
Copy link
Member

@jbiset jbiset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: 🟡 (Commented)

Test 🟢

Run_test

@lucianogorza
Copy link
Contributor

CR: 🟢

Test 🟢

image

@github-actions
Copy link
Contributor

Code coverage (Jest) % values
Statements 11.84% ( 4091 / 34529 )
Branches 8.01% ( 1867 / 23301 )
Functions 11.36% ( 938 / 8257 )
Lines 12.03% ( 3976 / 33029 )

@Machi3mfl Machi3mfl merged commit 8b76f24 into feat/5763-global-vulnerabilities-dashboard Sep 29, 2023
2 checks passed
@Machi3mfl Machi3mfl deleted the feat/5763-use-search-bar-services branch September 29, 2023 21:49
jbiset pushed a commit that referenced this pull request Oct 17, 2023
* Add search bar hooks

* Rename searchbar hook

* Add unit test to use search bar configuration hook

* Fix some unit test titles

* Remove console.log

* Solve requested changes

* Fix request changes and hook filename
Machi3mfl added a commit that referenced this pull request Oct 25, 2023
…d plugins (#5966)

* Add useDashboardConfiguration and unit test hook

* Changed how the initial hook configuration is set

* Create dashboard using embedded visualizations by value.

* [Vulnerabilities dashboards] Add search bar services (#5960)

* Add search bar hooks

* Rename searchbar hook

* Add unit test to use search bar configuration hook

* Fix some unit test titles

* Remove console.log

* Solve requested changes

* Fix request changes and hook filename

* [Vulnerabilities dashboards] Fix wrong agent.id filters loaded in search bar by default (#5970)

Remove agent id filter in searchbar

* Recommended filters are added and communication problems between the dashboard and the searchbar are solved

* Update Vulnerability detector dashboard filters visualization and VULNERABILITIES_INDEX_PATTERN_ID constant

* Change KPI dashboard and fix bad request

* Separates filter panels from dashboard panels

* Add Accumulation of the most detected vulnerabilities visualization and change

---------

Co-authored-by: Maximiliano Ibarra <[email protected]>
asteriscos pushed a commit that referenced this pull request Nov 3, 2023
…5896)

* Added plugins dependencies

* Add new inventories tabs scaffolding

* Refactor arquitecture

* Add searchbar folder

* Add useDashboardConfiguration hook for configuring vulnerability dashboards (#5947)

* Add useDashboardConfiguration and unit test hook

* Changed how the initial hook configuration is set

* [Vulnerabilities dashboards] Add search bar services (#5960)

* Add search bar hooks

* Rename searchbar hook

* Add unit test to use search bar configuration hook

* Fix some unit test titles

* Remove console.log

* Solve requested changes

* Fix request changes and hook filename

* [Vulnerabilities dashboards] Fix wrong agent.id filters loaded in search bar by default (#5970)

Remove agent id filter in searchbar

* Change new vulnerabilities inventory table (#6047)

* Add data grid hook

* Add doc viewer component and hook

* Add ui utils components

* Add new vuls inventory component

* Add vuls inventory in module rendering

* Add full height container

* Add inventory table columns

* Remove columns fields filter by keyword type

* Feat/5894 vulnerabilities dashboard create the dashboard tab using osd plugins (#5966)

* Add useDashboardConfiguration and unit test hook

* Changed how the initial hook configuration is set

* Create dashboard using embedded visualizations by value.

* [Vulnerabilities dashboards] Add search bar services (#5960)

* Add search bar hooks

* Rename searchbar hook

* Add unit test to use search bar configuration hook

* Fix some unit test titles

* Remove console.log

* Solve requested changes

* Fix request changes and hook filename

* [Vulnerabilities dashboards] Fix wrong agent.id filters loaded in search bar by default (#5970)

Remove agent id filter in searchbar

* Recommended filters are added and communication problems between the dashboard and the searchbar are solved

* Update Vulnerability detector dashboard filters visualization and VULNERABILITIES_INDEX_PATTERN_ID constant

* Change KPI dashboard and fix bad request

* Separates filter panels from dashboard panels

* Add Accumulation of the most detected vulnerabilities visualization and change

---------

Co-authored-by: Maximiliano Ibarra <[email protected]>

* Fix default filters on usesearchbar configuration

* [Vulnerabilities dashboards] Fix vulnerability dashboard filters (#6065)

Fix vulnerability dashboard filters

* Remove date picker from searchbar on vuls inventory tab

* Remove date picker from searchbar and open vs close visualization on vuls dashboard tab

* Change Accumulation of the most detected vulnerabilities chart

* Add data grid csv export

* Add error management and export csv calls pagination

* Remove unused hook

* Update CHANGELOG

* Fix CHANGELOG

* Remove explore agent in header

---------

Co-authored-by: Julio César Biset <[email protected]>
Co-authored-by: jbiset <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Vulnerabilities dashboards] Add search bar services/hooks
3 participants