Skip to content

[Security Solution] Use new expandable flyout in alert preview#167902

Merged
christineweng merged 9 commits intoelastic:mainfrom
christineweng:flyout-create-rule
Nov 27, 2023
Merged

[Security Solution] Use new expandable flyout in alert preview#167902
christineweng merged 9 commits intoelastic:mainfrom
christineweng:flyout-create-rule

Conversation

@christineweng
Copy link
Contributor

@christineweng christineweng commented Oct 3, 2023

Summary

This PR updates the alert preview in Create rule -> Rule preview to use the new expandable alert flyout:

  • Switched timeline wrapper to be visible on create rule page. This allows us to keep all the timeline navigation in the new expandable alert flyout
  • Disabled alert specific components, when flyout is open in create rule:
    • Alert status is not shown
    • Rule summary preview is disabled
    • Title link to rule details page is removed
    • Exclude filter in/filter out hover actions in highlighted fields
    • New placeholder text for investigation guide and response: we should not show link to documentation when user is setting up a rule

With feature flag on:

Screen.Recording.2023-11-16.at.4.21.26.PM.mov

How to test

  • Add xpack.securitySolution.enableExperimental: ['expandableFlyoutInCreateRuleEnabled' ] to kibana.yml.dev
  • Go to Rules page -> Detection rules (SIEM) => Create rule
  • Pick a rule type and populate the query, click Continue
  • On the right hand side, click Refresh, some alerts should appear in the table
  • Click expand on a row

Checklist

@christineweng christineweng force-pushed the flyout-create-rule branch 2 times, most recently from 18bd6ec to 5336e4c Compare October 26, 2023 20:11
@christineweng christineweng changed the title set up multi-panel [Security Solution] Use new expandable flyout in alert preview Oct 26, 2023
@christineweng christineweng self-assigned this Oct 26, 2023
@christineweng christineweng added backport:skip This PR does not require backporting Team:Threat Hunting Security Solution Threat Hunting Team release_note:feature Makes this part of the condensed release notes Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team v8.12.0 ci:cloud-deploy Create or update a Cloud deployment labels Oct 26, 2023
@christineweng christineweng force-pushed the flyout-create-rule branch 5 times, most recently from 4db2e3d to f609e3d Compare October 31, 2023 20:54
@christineweng christineweng marked this pull request as ready for review November 2, 2023 16:37
@christineweng christineweng requested review from a team as code owners November 2, 2023 16:37
@elasticmachine
Copy link
Contributor

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

@christineweng christineweng removed the ci:cloud-deploy Create or update a Cloud deployment label Nov 2, 2023
Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

Left a few comments. The code looks good overall and the UI behaves how I'm expecting.

I think this would be a good candidate for some Cypress tests? I haven't checked if the rule page already has some, but it could be worth spending some time looking at this?

Copy link
Contributor

@nikitaindik nikitaindik left a comment

Choose a reason for hiding this comment

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

Thanks @christineweng for adding this neat feature! I checked the code and tested it manually. Couple of things I noticed.

  1. Would it make sense not to render sections and tabs unavailable in alert flyout? For example, the "Response" collapsible section or investigation guide in the Investigation section / left panel tab. This might make the flyout a little less complex visually.

  2. Nit: The title of the flyout says "Preview Rule" which feels a bit technical. Kind of exposes the fact that we are creating a one-off rule under the hood to generate alerts (as I understand). Maybe we can hide the title or change it to something like "Alert Details" or "Alert Preview"? What do you think?

  3. Minor: If you reload a page with the flyout open, the flyout will still be displayed after reloading. This might be a little confusing because index patterns and query are reset after reload. Does it happen because we store the flyout state in the URL? If yes, do we need to store it there for the preview flyout?
    Also, if you navigate back to the rule management or rule details page with the flyout open, the flyout will still be displayed. The alert preview opened from the rule details page behaves the same, so must be a common issue.

@PhilippeOberti
Copy link
Contributor

Hey @nikitaindik thanks for these comments, let me answer them as Christine is on PTO this week

  1. Would it make sense not to render sections and tabs unavailable in alert flyout? For example, the "Response" collapsible section or investigation guide in the Investigation section / left panel tab. This might make the flyout a little less complex visually.

We had discussions back and forth with product and UIUX and we ended up deciding to keep the flyout identical but just with the sections disabled, instead of hiding things. The 2 reasons were:

  • slightly less code changes doing it this way
  • keep consistency so that the user knows all the functionality that will be available when used on an actual alert
  1. Nit: The title of the flyout says "Preview Rule" which feels a bit technical. Kind of exposes the fact that we are creating a one-off rule under the hood to generate alerts (as I understand). Maybe we can hide the title or change it to something like "Alert Details" or "Alert Preview"? What do you think?

I can see that using Alert Preview would make more sense here. Let me confirm this with product and UIUX!

  1. Minor: If you reload a page with the flyout open, the flyout will still be displayed after reloading. This might be a little confusing because index patterns and query are reset after reload. Does it happen because we store the flyout state in the URL? If yes, do we need to store it there for the preview flyout?

Good point! This is a feature that we built in, but maybe it doesn't make sense for this preview alerts. Let us check on that!

Also, if you navigate back to the rule management or rule details page with the flyout open, the flyout will still be displayed. The alert preview opened from the rule details page behaves the same, so must be a common issue.

Yeah this is probably also related to the point above, we'll check on that as well, thanks!

@PhilippeOberti
Copy link
Contributor

@christineweng Now that the header redesign PR is merged, we're showing the rule link again, which I think in this creation rule case we should not. Clicking on the link navigates to a page for a rule that doesn't exist yet. I feel like we should have a UI similar to Event details (black text no link)
Screenshot 2023-11-10 at 10 31 33 AM

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

I reviewed the code again after the last commit. Everything looks good. Let's discuss this comment and that one when you come back from PTO!

@yctercero
Copy link
Contributor

Thanks so much for all the work here, @christineweng !

Haven't looked at the code, but played around with it and just have a couple UX questions/comments. There seem to be a couple areas where the user can click and get taken away from the rule creation flow. I don't think we should include any links that would take the user away from this flow.

  • There are some areas in the flyout that allow you to click the rule name Preview rule that navigates the user away from rule creation to the rule details page that doesn't load as the rule doesn't yet exist
Screenshot 2023-11-10 at 10 35 57 AM
  • I see a bunch of calls fetch a rule that doesn't exist. I didn't trace where it's coming from but is happening when I have the flyout open.
Screenshot 2023-11-10 at 10 37 31 AM
  • There are some areas that still contain the filter in/out
Screenshot 2023-11-10 at 10 38 42 AM
  • The timeline persists even after moving away from rule creation and this could be a bit confusing as it is referencing data that is no longer persisted (the preview index cleans up frequently). I worry about it getting confusing carrying over preview investigations into actual investigation flows.

I am happy to hop on a zoom next week with @paulewing and others to sort out some of these questions!

@christineweng
Copy link
Contributor Author

@yctercero thank you for the comments! I did some research and added some notes/observations below.

  • There are some areas in the flyout that allow you to click the rule name Preview rule that navigates the user away from rule creation to the rule details page that doesn't load as the rule doesn't yet exist
Screenshot 2023-11-10 at 10 35 57 AM

Great catch! I think session viewer (from the screenshot in your comments) and the new title (from @PhilippeOberti's comment) are the only two places I found a rule details link, let me know if I miss anything

image

  • I see a bunch of calls fetch a rule that doesn't exist. I didn't trace where it's coming from but is happening when I have the flyout open.
Screenshot 2023-11-10 at 10 37 31 AM

The 404's are coming from useRuleWithFallback here. Similar failed requests appear in the old flyout as well, the same hook is used here. I don't think we can avoid using that hook though, since we still need the highlighted fields.

image

  • There are some areas that still contain the filter in/out
Screenshot 2023-11-10 at 10 38 42 AM

That is correct, the component in the screenshot is owned by a different team, to introduce the preview logic there is more involved and make sense to do it in a separate PR. I'll confirm with product & UIUX if that's something we should prioritize

  • The timeline persists even after moving away from rule creation and this could be a bit confusing as it is referencing data that is no longer persisted (the preview index cleans up frequently). I worry about it getting confusing carrying over preview investigations into actual investigation flows.

I am happy to hop on a zoom next week with @paulewing and others to sort out some of these questions!

  • Regarding the preview index: my understanding is the preview index is purposely hidden in timeline, i.e. we cannot query by a preview alert id. Any add to timeline actions only add value pairs to timeline, so cleaning up the preview index shouldn't impact these interactions?

@christineweng
Copy link
Contributor Author

christineweng commented Nov 16, 2023

@nikitaindik Thank you for the review! There are some effort on the url sync in parallel, so I put this feature behind a feature flag until the other PR is merged. Please see answer to your feedback below.

  1. Would it make sense not to render sections and tabs unavailable in alert flyout? For example, the "Response" collapsible section or investigation guide in the Investigation section / left panel tab. This might make the flyout a little less complex visually.

See @PhilippeOberti's response here let me know if you have more questions/concerns

  1. Nit: The title of the flyout says "Preview Rule" which feels a bit technical. Kind of exposes the fact that we are creating a one-off rule under the hood to generate alerts (as I understand). Maybe we can hide the title or change it to something like "Alert Details" or "Alert Preview"? What do you think?

Great point, I talked to @paulewing and the guidance was to go with the existing Preview rule, to stay consistent with how it is currently shown. It will be a quick change once we chat with docs :)

  1. Minor: If you reload a page with the flyout open, the flyout will still be displayed after reloading. This might be a little confusing because index patterns and query are reset after reload. Does it happen because we store the flyout state in the URL? If yes, do we need to store it there for the preview flyout?
    Also, if you navigate back to the rule management or rule details page with the flyout open, the flyout will still be displayed. The alert preview opened from the rule details page behaves the same, so must be a common issue.

currently there is a PR in progress to revamp how we do url and store the flyout state in the url history. Having correct history should fix the second behavior (going back and flyout still shows up). Regarding the refresh, I added a to-do to check that it works properly before turning on the feature flag.

@christineweng
Copy link
Contributor Author

christineweng commented Nov 16, 2023

@yctercero @nikitaindik @PhilippeOberti just to bring to your attention, while the new flyout in preview is behind a feature flag, making timeline visible is not behind a feature flag. but the old flyout does not have any timeline hover actions, so it won't interact with it.

Some of your comments are not addressed in this PR either because there is on-going work from other team members, or makes more sense to do a separate PR. they are being tracked in the issue. If you have questions or concerns related to timeline in create rule, feel free to post here and I can add to the tracking :)

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

change LGTM, tested the feature flag, thanks for putting it in place!

Copy link
Contributor

@nikitaindik nikitaindik left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the feedback. Approved!

Will refresh with main now to rerun the build.

@kibanamachine kibanamachine requested a review from a team November 23, 2023 11:29
Copy link
Member

@sphilipse sphilipse left a comment

Choose a reason for hiding this comment

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

approving for CI auto-commit

@kibana-ci
Copy link

💛 Build succeeded, but was flaky

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 12.8MB 12.8MB +3.8KB
serverlessSearch 369.1KB 369.2KB +147.0B
total +3.9KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolution 65.3KB 65.4KB +39.0B

History

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

cc @christineweng

@christineweng christineweng merged commit f5648d9 into elastic:main Nov 27, 2023
@PhilippeOberti PhilippeOberti added this to the 8.12 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes Team:Threat Hunting:Investigations Security Solution Threat Hunting Investigations Team Team:Threat Hunting Security Solution Threat Hunting Team v8.12.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants