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

Replace search bar on Modules > Integrity monitoring > Inventory #5444

Merged
merged 118 commits into from
Aug 11, 2023

Conversation

Desvelao
Copy link
Member

@Desvelao Desvelao commented May 15, 2023

Description

This pull request replaces the search bar and table components with TableWzAPI on Modules/Integrity monitoring/Inventory.

Affected sections:

  • Modules > Integrity monitoring > Inventory > Files
  • Modules > Integrity monitoring > Inventory > Registry

It depends on #5442

Issues Resolved

#4312

Evidence

image
image

Table - Modules > Integrity monitoring > Inventory > Files
Suggestions:

field get distinct values searchable searchable term
file GET /syscheck/{agent_id}?distinct=truelimit=30&select={field}&sort=+{field}&q=type=registry;{field}~{currentValue}
gid GET /syscheck/{agent_id}?distinct=truelimit=30&select={field}&sort=+{field}&q=type=registry;{field}~{currentValue}
gname GET /syscheck/{agent_id}?distinct=truelimit=30&select={field}&sort=+{field}&q={type=registry;field}~{currentValue}
mtime GET /syscheck/{agent_id}?distinct=truelimit=30&select={field}&sort=+{field}&q=type=registry;{field}~{currentValue}
size GET /syscheck/{agent_id}?distinct=truelimit=30&select={field}&sort=+{field}&q=type=registry;{field}~{currentValue}
uname GET /syscheck/{agent_id}?distinct=truelimit=30&select={field}&sort=+{field}&q={type=registry;field}~{currentValue}
uid GET /syscheck/{agent_id}?distinct=truelimit=30&select={field}&sort=+{field}&q=type=registry;{field}~{currentValue}

Table - Modules > Integrity monitoring > Inventory > Registry
Suggestions:

field get distinct values searchable searchable term
file GET /syscheck/{agent_id}?distinct=truelimit=30&select={field}&sort=+{field}&q=type=registry;{field}~{currentValue}
mtime GET /syscheck/{agent_id}?distinct=truelimit=30&select={field}&sort=+{field}&q=type=registry;{field}~{currentValue}

Test

Use a Wazuh manager

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

Test Chrome Firefox Safari
Modules > Integrity monitoring > Inventory > Files: For each suggested field, check the value suggestion display results or at least doesn't break
Modules > Integrity monitoring > Inventory > Files: Using a value suggested should allow to run the search
Modules > Integrity monitoring > Inventory > Files: Type a term and run the search should search in each displayed field
Modules > Integrity monitoring > Inventory > Files: Type a simple field search and this should returns the expected results
Modules > Integrity monitoring > Inventory > Files: Type a complex field search and this should returns the expected results
Modules > Integrity monitoring > Inventory > Files: Clicking on the Refresh button should refresh the data
Modules > Integrity monitoring > Inventory > Files: Clicking on the Export formatted button should refresh export the data to CSV
Modules > Integrity monitoring > Inventory > Registry: For each suggested field, check the value suggestion display results or at least doesn't break
Modules > Integrity monitoring > Inventory > Registry: Using a value suggested should allow to run the search
Modules > Integrity monitoring > Inventory > Registry: Type a term and run the search should search in each displayed field
Modules > Integrity monitoring > Inventory > Registry: Type a simple field search and this should returns the expected results
Modules > Integrity monitoring > Inventory > Registry: Type a complex field search and this should returns the expected results
Modules > Integrity monitoring > Inventory > Registry: Clicking on the Refresh button should refresh the data
Modules > Integrity monitoring > Inventory > Registry: Clicking on the Export formatted button should refresh export the data to CSV

Details

⚫ Modules > Integrity monitoring > Inventory > Files: For each suggested field, check the value suggestion display results or at least doesn't break

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Files: Using a value suggested should allow to run the search

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Files: Type a term and run the search should search in each displayed field

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Files: Type a simple field search and this should returns the expected results

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Files: Type a complex field search and this should returns the expected results

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Files: Clicking on the Refresh button should refresh the data

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Files: Clicking on the Export formatted button should refresh export the data to CSV

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Registry: For each suggested field, check the value suggestion display results or at least doesn't break

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Registry: Using a value suggested should allow to run the search

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Registry: Type a term and run the search should search in each displayed field

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Registry: Type a simple field search and this should returns the expected results

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Registry: Type a complex field search and this should returns the expected results

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Registry: Clicking on the Refresh button should refresh the data

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

⚫ Modules > Integrity monitoring > Inventory > Registry: Clicking on the Export formatted button should refresh export the data to CSV

Chrome - ⚫

Firefox - ⚫

Safari - ⚫

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

Desvelao and others added 30 commits February 16, 2023 12:50
Features:
- Supports multiple query languages
- Decouple the business logic of query languages of the search bar
  component
- Ability of query language to interact with the search bar

Query language implementations
- AQL: custom implementation of the Wazuh Query Language. Include
  suggestions.
- UIQL: simple implementation (as another example)
…ression used in the Wazuh manager API

- Change the implementation of AQL query language to use the regular
  expression decomposition defined in the Wazuh manager API
- Adapt the tests for the tokenizer and getting the suggestions
- Enchance documentation of search bar
- Add documentation of AQL query language
- Add more fields and values for the use example in Agents section
- Add description to the query language select input
…using the Search suggestion in AQL

- Fixes a problem hidding the suggestion popover when using the Search
  suggestion in AQL
- Fixes a problem of input text with undefined value
- Minor fixes
  - Remove `syntax` property of SearchBar component
  - Add disableFocusTrap property to the custom EuiSuggestInput component to be
    forwarded to the EuiInputPopover
  - Replace the inputRef by a reference instead of a state and pass as
    a parameter in the query language run function
  - Move the rebuiding of input text when using some suggestion that changes
    the input to be done when a related suggestion was clicked instead
    of any suggestion (exclude Search).
implemenation

- Add the ability to update the input of the search bar in the example
  implementation
- Enhance the component documentation
- (AQL) Add the fields and an open operator group when there is no input text
link of query language displayed in the popover
- AQL enhancements:
  - documentation:
    - Enhance some descriptions
    - Enhance input processing
    - Remove intermetiate interface of EuiSuggestItem
  - Remove the intermediate interface of EuiSuggestItem. Now it is
    managed in the internal of query language instead of be built by the
    suggestion handler
  - Display suggestions when the input text is empty
  - Add the unifiedQuery field to the query language output
  - Adapt tests

- Search Bar component:
  - Enhance documentation
- Remove UIQL
- Add HAQL query language that is a high-level implementation of AQL
  - Add the query language interface
  - Add tests for tokenizer, get suggestions and
    transformSpecificQLToUnifiedQL method
  - Add documentation about the language
    - Syntax
    - Options
    - Workflow
- Add tests to HAQL and AQL query languages
- Fix suggestions for HAQL when typing as first element a value entity.
  Now there are no suggestions because the field and operator_compare
  are missing.
- Enhance documentation of HAQL and AQL
- Removed unnecesary returns of suggestion handler in the example
  implementation of search bar on Agents section
- Rename query language HAQL to WQL
- Update tests
- Remove AQL usage from the implementation in the agents section
- Add more use cases to the test of WQL query language
- Replace some literals by constants in the WQL query language
  implementation
- WQL
  - add implicit query mode to WQL
  - enhance query language documentation
  - renamed transformUnifiedQuery to transformUQLToQL
  - now wraps the user input if this is defined and there a implicit
    query string
  - fix a problem with the value suggestions if there is a previous
    conjunction
    - add tests cases
  - update tests
- AQL
  - enhance query language documentation
  - renamed transformUnifiedQuery to transformUQLToQL
  - add warning about the query language implementation is not updated
    to the last changes in the search bar component
  - update tests

- Search Bar
  - renamed transformUnifiedQuery to transformUQLToQL
- Set a width for the syntax options popover
- Unify the description in the suggestions of WQL example implementation
- Update tests
- Fix minor bugs in the WQL example implementation in Agents
- WQL
  - Enhance documentation
  - Add partial and "expanded" input validation
  - Add tests
…feat/4312-poc-search-bar-component-multiple-query-language-api-query-language-implementation
Fix an error when the last token in the input was a value and used
a value suggestion whose label contains whitespaces, the value was
not wrapped with quotes.
…uery-language-api-query-language-implementation
…uery-language-api-query-language-implementation
…earch term fields changed

- Search bar:
  - Add a dependency to run the query language output
  - Adapt search bar documentation to the changes
- WQL
  - Create a new parameter called `options`
  - Moved the `implicitFilter` and `searchTerm` settings to `options`
  - Update tests
  - Update documentation
@Tostti
Copy link
Member

Tostti commented Aug 9, 2023

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

Test Chrome Firefox Safari
Modules > Integrity monitoring > Inventory > Files: For each suggested field, check the value suggestion display results or at least doesn't break 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Using a value suggested should allow to run the search 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Type a term and run the search should search in each displayed field 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Type a simple field search and this should returns the expected results 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Type a complex field search and this should returns the expected results 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Clicking on the Refresh button should refresh the data 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Clicking on the Export formatted button should refresh export the data to CSV 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: For each suggested field, check the value suggestion display results or at least doesn't break 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Using a value suggested should allow to run the search 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Type a term and run the search should search in each displayed field 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Type a simple field search and this should returns the expected results 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Type a complex field search and this should returns the expected results 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Clicking on the Refresh button should refresh the data 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Clicking on the Export formatted button should refresh export the data to CSV 🟢 🟢

Details

🟢 Modules > Integrity monitoring > Inventory > Files: For each suggested field, check the value suggestion display results or at least doesn't break

Chrome - 🟢

image
image
image
image
image
image
image

Firefox - 🟢
image
image
image
image
image
image
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Using a value suggested should allow to run the search

Chrome - 🟢
image
image
image
image
image
image
image

Firefox - 🟡
image
image
image
image
image
image
image

The suggested mtime value includes a different format than the allowed. The query works fine if the format is manually changed
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Type a term and run the search should search in each displayed field

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Type a simple field search and this should returns the expected results

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Type a complex field search and this should returns the expected results

Chrome - green_circle:
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Clicking on the Refresh button should refresh the data

Chrome - 🟢

Firefox - 🟢

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Clicking on the Export formatted button should refresh export the data to CSV

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: For each suggested field, check the value suggestion display results or at least doesn't break

Chrome - 🟢
image
image

Firefox - 🟢
image
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Using a value suggested should allow to run the search

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Type a term and run the search should search in each displayed field

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Type a simple field search and this should returns the expected results

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Type a complex field search and this should returns the expected results

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Clicking on the Refresh button should refresh the data

Chrome - 🟢

Firefox - 🟢

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Clicking on the Export formatted button should refresh export the data to CSV

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

@Tostti Tostti requested review from Tostti and lucianogorza August 9, 2023 13:20
@lucianogorza
Copy link
Contributor

lucianogorza commented Aug 9, 2023

Legend:
⚫: none
🟢: pass
🟡: warning
🔴: fail
⚪: not applicable

UI

Test Chrome Firefox Safari
Modules > Integrity monitoring > Inventory > Files: For each suggested field, check the value suggestion display results or at least doesn't break 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Using a value suggested should allow to run the search 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Type a term and run the search should search in each displayed field 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Type a simple field search and this should returns the expected results 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Type a complex field search and this should returns the expected results 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Clicking on the Refresh button should refresh the data 🟢 🟢
Modules > Integrity monitoring > Inventory > Files: Clicking on the Export formatted button should refresh export the data to CSV 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: For each suggested field, check the value suggestion display results or at least doesn't break 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Using a value suggested should allow to run the search 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Type a term and run the search should search in each displayed field 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Type a simple field search and this should returns the expected results 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Type a complex field search and this should returns the expected results 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Clicking on the Refresh button should refresh the data 🟢 🟢
Modules > Integrity monitoring > Inventory > Registry: Clicking on the Export formatted button should refresh export the data to CSV 🟢 🟢

Details

🟢 Modules > Integrity monitoring > Inventory > Files: For each suggested field, check the value suggestion display results or at least doesn't break

Chrome - 🟢
image
image
image
image
image
image
image
image

Firefox - 🟢
image
image
image
image
image
image
image
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Using a value suggested should allow to run the search

Chrome - 🟢
image
image
image
image
image
image
image

Firefox - 🟢
image
image
image
image
image
image
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Type a term and run the search should search in each displayed field

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Type a simple field search and this should returns the expected results

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Type a complex field search and this should returns the expected results

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Clicking on the Refresh button should refresh the data

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Files: Clicking on the Export formatted button should refresh export the data to CSV

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: For each suggested field, check the value suggestion display results or at least doesn't break

Chrome - 🟢
image
image

Firefox - 🟢
image
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Using a value suggested should allow to run the search

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Type a term and run the search should search in each displayed field

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Type a simple field search and this should returns the expected results

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Type a complex field search and this should returns the expected results

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Clicking on the Refresh button should refresh the data

Chrome - 🟢

Firefox - 🟢

Safari - ⚫

🟢 Modules > Integrity monitoring > Inventory > Registry: Clicking on the Export formatted button should refresh export the data to CSV

Chrome - 🟢
image

Firefox - 🟢
image

Safari - ⚫

Copy link
Contributor

@lucianogorza lucianogorza left a comment

Choose a reason for hiding this comment

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

image

The list contains no entries, but the title of the tab shows a different number. The cause seems to be that the initial filter must be "type=registry_key" and not "type=registry_file".

Tostti
Tostti previously approved these changes Aug 10, 2023
Copy link
Member

@Tostti Tostti left a comment

Choose a reason for hiding this comment

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

TEST:✔️
CR:✔️

LGTM

Tostti
Tostti previously approved these changes Aug 10, 2023
lucianogorza
lucianogorza previously approved these changes Aug 10, 2023
Copy link
Contributor

@lucianogorza lucianogorza left a comment

Choose a reason for hiding this comment

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

TEST:✔️
CR:✔️

LGTM

…o feat/4312-search-bar-replace-modules-im-inventory
@Desvelao Desvelao dismissed stale reviews from lucianogorza and Tostti via 8591e1e August 11, 2023 13:34
@Desvelao Desvelao merged commit a628371 into 4.6.0 Aug 11, 2023
@Desvelao Desvelao deleted the feat/4312-search-bar-replace-modules-im-inventory branch August 11, 2023 13:35
@github-actions
Copy link
Contributor

Code coverage (Jest) % values
Statements 11.34% ( 3962 / 34923 )
Branches 7.49% ( 1775 / 23693 )
Functions 10.66% ( 896 / 8398 )
Lines 11.52% ( 3849 / 33404 )

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.

New search bar component
3 participants