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

[Security Solution][Expandable flyout] - add onClose to the API to let developers know when the expandable flyout is being closed #183553

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PhilippeOberti
Copy link
Contributor

Summary

This PR adds an onClose property to the kbn-expandable-flyout package. Until now, there was not any way to know when the expandable flyout was being closed. This was due to the fact that the expandable flyout is a wrapper of the EUI flyout, and has its own api.

Approach

This approach implements an rxjs observable that the kbn-expandable-flyout package provides through its API. The observable is triggered every time the flyout closes. Components can listen to the observable and run the code they need.
Because there can be multiple flyouts open at the same time, the observable emits the id of the flyout. It its current state within Security Solution, only 3 options here can be emitted:

  • flyout for the expandable flyouts open on the alerts page, the cases page or the explore pages (host/user...)
  • timelineFlyout for the expandable flyout from a Timeline
  • memory for the expandable flyouts opened in memory mode (like the one on the rule creation page)

Notes:

One downside of this approach is we're running the risk to have developer forgetting to unsubscribe from the observable and therefore introducing memory leaks...
An alternative approach PR will be open shortly to investigate using Events instead of Observables.

Will help
https://github.com/elastic/security-team/issues/7670 and #179520

Checklist

…t developers know when the expandable flyout is being closed
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations)

@PhilippeOberti
Copy link
Contributor Author

@christineweng @logeekal @lgestc I opened this new PR in favor of this other one so we can focus only on the onClose API exposed by the kbn-expandable-flyout.

It will be easier to discuss the rxjs Observable vs Event approach

@kibana-ci
Copy link
Collaborator

kibana-ci commented May 15, 2024

💔 Build Failed

Failed CI Steps

Metrics [docs]

Async chunks

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

id before after diff
securitySolution 15.1MB 15.1MB +260.0B
Unknown metric groups

API count

id before after diff
@kbn/expandable-flyout 38 39 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants