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

Search bar related to Wazuh server data does not display the external filters when reapplied #7124

Closed
Desvelao opened this issue Oct 24, 2024 · 2 comments · Fixed by #7185
Closed
Assignees
Labels
level/task Task issue type/bug Bug issue

Comments

@Desvelao
Copy link
Member

Desvelao commented Oct 24, 2024

Wazuh Rev Browser
4.10.x xyzw Chrome, Firefox, Safari, etc

Description
The search bar of tables related to the Wazuh server could not display the filters that were applied externally. See the Steps to reproduce for more information about the use case.

TableWzAPI component

Steps to reproduce

  1. Apply an external filter
  2. Use the search bar to apply a new filter
  3. Apply the same external filter of step 1 (using the external interaction, do not use the search bar)
Peek.2024-10-23.14-42.mp4

Expected Result

  1. The search bar should display the current filter applied

Actual Result

  1. The search bar does not display the current filter applied in the commented use case
@asteriscos asteriscos added type/bug Bug issue level/task Task issue labels Oct 28, 2024
@JuanGarriuz JuanGarriuz self-assigned this Nov 29, 2024
@JuanGarriuz
Copy link
Member

Research

input is correctly set to the filter we added the first time

image

When clear the search-bar input work as expected

image

2º time it fail

image

@JuanGarriuz
Copy link
Member

JuanGarriuz commented Dec 2, 2024

Update 02/12

In charge rest.input render on SearchBar component has no value.

plugins/main/public/components/search-bar/index.tsx

image

On filter added rest.input work correctly, changes to the expected value filter.

image

When I delete the filter on search-bar this code tracks the new filter, but rest.input are not managed:

  // Handler on change the input field text
  const onChangeInput = event => setInput(event.target.value);

image

It means that the useEffect that we are using doesn't get the conditional requirements to run up. When the rest.input doesn't change it can't do anything.

  useEffect(() => {
    var _searchBarQueryLangua3, _searchBarQueryLangua4, _searchBarQueryLangua5;
    // React to external changes and set the internal input text. Use the `transformInput` of
    // the query language in use
    rest.input && ((_searchBarQueryLangua3 = searchBarQueryLanguages[queryLanguage.id]) === null || _searchBarQueryLangua3 === void 0 ? void 0 : _searchBarQueryLangua3.transformInput) && setInput((_searchBarQueryLangua4 = searchBarQueryLanguages[queryLanguage.id]) === null || _searchBarQueryLangua4 === void 0 || (_searchBarQueryLangua5 = _searchBarQueryLangua4.transformInput) === null || _searchBarQueryLangua5 === void 0 ? void 0 : _searchBarQueryLangua5.call(_searchBarQueryLangua4, rest.input, {
      configuration: queryLanguage.configuration,
      parameters: selectedQueryLanguageParameters
    }));
  }, [rest.input]);

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue type/bug Bug issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants