-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Security Solution][Expandable flyout] - add onClose to the API to let developers know when the expandable flyout is being closed #183553
Conversation
Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations) |
@christineweng @logeekal @lgestc I opened this new PR in favor of this other one so we can focus only on the It will be easier to discuss the rxjs Observable vs Event approach |
e2908f2
to
70265bf
Compare
…t developers know when the expandable flyout is being closed
…PI to let developers know when the expandable flyout is being closed" This reverts commit 15d2fdc.
…ose callback outside the package
70265bf
to
01b2bdd
Compare
Ok after talking to @lgestc more, he convinced me to implement the simplest way possible. The package won't contain any custom code, we just propagate the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
61d4ffa
to
fe64131
Compare
fe64131
to
1763fc5
Compare
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Summary
This PR propagates the
onClose
callback fromEuiFlyout
outside of the package, to allow application's code to respond to the flyout being closed.Will help
https://github.com/elastic/security-team/issues/7670 and #179520
Checklist
Previous implementation
This PR adds anonClose
property to thekbn-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.ApproachThis 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 Timelinememory
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.