[Security Solution][Expandable flyout] - add onClose to the API to let developers know when the expandable flyout is being closed #183553
+50
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an
onClose
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.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 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.
Will help
https://github.com/elastic/security-team/issues/7670 and #179520
Checklist