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

Generate URL with predefined filters #6745

Merged
merged 17 commits into from
Jun 7, 2024
Merged

Conversation

Machi3mfl
Copy link
Member

@Machi3mfl Machi3mfl commented Jun 4, 2024

Description

This PR adds a new behavior to create filters, add to the URL with the correct format and using it in a redirect link.

Closes #6739

Tasks

  •  Create a method to make easier the generation of object filters

Different filter operators based on the OSD search bar

Screenshot 2024-06-05 at 13 14 48

When the field is type number exists the IS BETWEEN and IS NOT BETWEEN operator

Screenshot 2024-06-06 at 11 18 00
// Examples

// "IS" Filter
const isFilter = PatternDataSourceFilterManager.createFilter(FILTER_OPERATOR.IS, 'agent.id','1','my-index');

// "IS NOT" Filter
const isNotFilter = PatternDataSourceFilterManager.createFilter(FILTER_OPERATOR.IS_NOT, ,'agent.id','1','my-index');

// "EXISTS" Filter
const existsFilter = PatternDataSourceFilterManager.createFilter(FILTER_OPERATOR.EXISTS, ,'agent.id','1','my-index');

// "DOES NOT EXIST" Filter
const doesNotExist = PatternDataSourceFilterManager.createFilter(FILTER_OPERATOR.DOESN_NOT_EXISTS,'agent.id','1','my-index');

// "IS ONE OF" Filter
const isOneOfFilter = PatternDataSourceFilterManager.createFilter(FILTER_OPERATOR.IS_ONE_OF','agent.id',['1'],'my-index');

// "IS NOT ONE OF" Filter
 const isNotOneOfFilter = PatternDataSourceFilterManager.createFilter(FILTER_OPERATOR.IS_NOT_ONE_OF,'agent.id',['1'],'my-index');

 const isBetweenFilter = PatternDataSourceFilterManager.createFilter(FILTER_OPERATOR.IS_BETWEEN,'agent.id',[1,2],'my-index');

 const isBetweenFilter = PatternDataSourceFilterManager.createFilter(FILTER_OPERATOR.IS_NOT_BETWEEN,'agent.id',[1,2],'my-index');
  • Create a method to transform a filter object to a URL filter format
  • Add unit tests

Screenshot 2024-06-06 at 12 00 24

  • Add method to create type range filter
  • Add rule stats links

Tests

Rule info redirect link to threat hunting with rule.id filter

Screen.Recording.2024-06-05.at.13.13.33.mov

Overview LAST 24 HOURS ALERTS kpis redirect to discover with rule.level is between filter

Screen.Recording.2024-06-06.at.12.56.24.mov

View in rules redirects in Flyout discover rule tab

Screen.Recording.2024-06-07.at.07.38.53.mov

Agent redirects in Techniques flyout discover table

Screen.Recording.2024-06-07.at.09.26.25.mov

Compliance visualization items redirect

Screen.Recording.2024-06-07.at.08.27.22.mov

Agent detail SCA: Lastest scans Policy table

Not show the URL at the left bottom screen because is a on click event

Screen.Recording.2024-06-07.at.08.39.02.mov

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 Machi3mfl linked an issue Jun 4, 2024 that may be closed by this pull request
@JuanGarriuz JuanGarriuz self-requested a review June 6, 2024 07:18
@asteriscos
Copy link
Member

Test 🟢

Rule info redirect link to threat hunting with rule.id filter

Peek 2024-06-07 17-13

Overview LAST 24 HOURS ALERTS kpis redirect to discover with rule.level is between filter

Peek 2024-06-07 17-13

View in rules redirects in Flyout discover rule tab

Peek 2024-06-07 17-22

Agent redirects in Techniques flyout discover table

Peek 2024-06-07 17-28

Compliance visualization items redirect

Peek 2024-06-07 17-38

Agent detail SCA: Lastest scans Policy table

Not show the URL at the left bottom screen because is a on click event

Peek 2024-06-07 17-36

Copy link
Contributor

github-actions bot commented Jun 7, 2024

Wazuh Core plugin code coverage (Jest) test % values
Statements 45.96% ( 399 / 868 )
Branches 41.97% ( 157 / 374 )
Functions 44.01% ( 136 / 309 )
Lines 46.16% ( 397 / 860 )

Copy link
Contributor

github-actions bot commented Jun 7, 2024

Wazuh Check Updates plugin code coverage (Jest) test % values
Statements 76.44% ( 172 / 225 )
Branches 58.65% ( 61 / 104 )
Functions 61.7% ( 29 / 47 )
Lines 76.44% ( 172 / 225 )

Copy link
Member

@asteriscos asteriscos 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: 🟢

Copy link
Contributor

github-actions bot commented Jun 7, 2024

Main plugin code coverage (Jest) test % values
Statements 11.38% ( 3897 / 34239 )
Branches 7.63% ( 1721 / 22554 )
Functions 10.67% ( 894 / 8375 )
Lines 11.54% ( 3794 / 32869 )

@asteriscos asteriscos merged commit 8bd040f into 4.9.0 Jun 7, 2024
4 checks passed
@asteriscos asteriscos deleted the feat/6739-generate-url-filters branch June 7, 2024 16:17
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.

Generate URL with predefined filters
3 participants