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

Implement Asset Inventory filters #207094

Merged
merged 2 commits into from
Feb 11, 2025
Merged

Conversation

albertoblaz
Copy link
Contributor

@albertoblaz albertoblaz commented Jan 17, 2025

Summary

Closes #201710.

Implements filters section for Asset Inventory reusing FilterGroup component from @kbn/alerts-ui-shared package.

Screenshot

Screenshot 2025-01-17 at 16 21 55

Definition of done

  • Add multiple dropdown filters labelled:
    • Type - filter by asset.category
    • Criticality - filter by asset.criticality
    • Tags - filter by asset.tags.name
    • Name - filter TBD
  • Ensure each dropdown allows users to select multiple options to filter the inventory data.
  • Add a button or dropdown labeled "More filters" that exposes advanced filtering options, including "Reset control" and "Edit control".
  • Verify if the FilterGroup component from packages/kbn-alerts-ui-shared can be reused to wrap the required functionalities.
    • It can be reused, but the detection engine uses AlertFilterControls instead, which is a higher-level alternative. And that's what I did in Asset Inventory too
  • Ensure the filters are functional on the front-end and can interact with placeholder data.

Out of scope

  • Backend data filtering logic
  • Implementation of the actual data fetching based on filters

How to test

Follow the "how to test" instructions written on this PR:

Checklist

  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

Risks

No risks at all.

@albertoblaz albertoblaz added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:Cloud Security Cloud Security team related labels Jan 17, 2025
@albertoblaz albertoblaz self-assigned this Jan 17, 2025
@albertoblaz albertoblaz force-pushed the asset-inv-filters branch 3 times, most recently from cbed18c to 5301e40 Compare January 20, 2025 16:52

const setFilterControlsUrlState = useCallback(
(newFilterControls: FilterControlConfig[]) => {
urlStorage.set(URL_PARAM_KEY.pageFilter, newFilterControls);
Copy link
Contributor

@opauloh opauloh Jan 27, 2025

Choose a reason for hiding this comment

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

I think we are going to have a conflict with the Alerts page if we reuse the same key URL_PARAM_KEY.pageFilter, it seems we are going to need to create our own key for assetInventoryPage on https://github.com/elastic/kibana/blob/da25d13a2ac5be97216e202bf5d6bda6ff920b3b/x-pack/solutions/security/plugins/security_solution/public/common/hooks/use_url_state.ts

@albertoblaz albertoblaz force-pushed the asset-inv-filters branch 2 times, most recently from 082b98d to 0a0e705 Compare January 31, 2025 11:40
Comment on lines +24 to +27
const SECURITY_ASSET_INVENTORY_DATA_VIEW = {
id: 'asset-inventory-logs-default',
name: 'asset-inventory-logs',
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: This is temporary and will be deleted in the follow-up PR that integrates the UI with the backend

},
{
title: 'Name',
fieldName: 'asset.name', // TODO this is TBD
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Question: @opauloh do we know if this eventually asset.name or agent.name or any other value?

Copy link
Contributor

@opauloh opauloh Jan 31, 2025

Choose a reason for hiding this comment

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

cc @tinnytintin10, I also asked if it should be entity.name here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I set it to 'entity.name' I get "Bad Request".

Leaving it for now as 'asset.name' until further change.

Comment on lines 51 to 60
// TODO Remove dataView prop when integrating with backend (fetched from hook)
dataView: DataView;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure of keeping as is because dataView is fetched by the parent (AllAssets).

@albertoblaz albertoblaz requested a review from opauloh January 31, 2025 12:21
@albertoblaz albertoblaz marked this pull request as ready for review January 31, 2025 12:21
@albertoblaz albertoblaz requested review from a team as code owners January 31, 2025 12:21
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

},
{
title: 'Name',
fieldName: 'asset.name', // TODO this is TBD
Copy link
Contributor

@opauloh opauloh Jan 31, 2025

Choose a reason for hiding this comment

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

cc @tinnytintin10, I also asked if it should be entity.name here.

Copy link
Contributor

@seanrathier seanrathier left a comment

Choose a reason for hiding this comment

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

I left a few comments for consideration. We should try a and separate the business login from our components.

@albertoblaz
Copy link
Contributor Author

@elasticmachine merge upstream

@albertoblaz albertoblaz enabled auto-merge (squash) February 11, 2025 11:24
Copy link
Contributor

@seanrathier seanrathier left a comment

Choose a reason for hiding this comment

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

Approving my requests and questions.

@albertoblaz albertoblaz enabled auto-merge (squash) February 11, 2025 18:58
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
securitySolution 6697 6700 +3

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 21.4MB 21.4MB +3.3KB
Unknown metric groups

References to deprecated APIs

id before after diff
securitySolution 357 358 +1

History

cc @albertoblaz

Copy link
Contributor

@opauloh opauloh left a comment

Choose a reason for hiding this comment

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

🚀

@albertoblaz albertoblaz merged commit 00388ed into elastic:main Feb 11, 2025
9 checks passed
@albertoblaz albertoblaz deleted the asset-inv-filters branch February 12, 2025 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Filters Section
5 participants