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][Rule details] - Updates rule details page to allow tabs to be a part of url #139592

Merged
merged 20 commits into from Aug 31, 2022

Conversation

yctercero
Copy link
Contributor

@yctercero yctercero commented Aug 26, 2022

Summary

Similar to how the Hosts page maintains the tab state in the URL, recreating that in the rule details page. This is in anticipation of some of the exceptions UI changes being worked on where this would create a better user experience.

  • Existing urls that do not contain the tabName param default to the Alerts tab (this is exactly what happens now, so no change in functionality now)
  • Sample url: /app/security/rules/id/fbfc7b80-2551-11ed-ac93-0fcc3d73cc25/rule_exceptions
  • Tab name also shows up in the breadcrumb

Screen Shot 2022-08-26 at 1 05 08 PM

Testing

  • Navigate to a rule details url from prior to this change (or just make sure that it doesn't include a tab name) - rule should load with the Alerts tab active
  • Select the exceptions tab. Refresh page - exceptions tab should remain active
  • Breadcrumbs should be updated as you change tabs
  • Selecting to filter by alert id from the execution results tab properly updates the selected tab to Alerts and applies expected filter

Checklist

@yctercero yctercero added release_note:enhancement Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Security Solution Platform Security Solution Platform Team v8.5.0 labels Aug 26, 2022
@yctercero yctercero self-assigned this Aug 26, 2022
@yctercero yctercero requested review from a team as code owners August 26, 2022 20:08
@yctercero yctercero requested a review from xcrzx August 26, 2022 20:08
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@yctercero yctercero requested a review from a team as a code owner August 27, 2022 18:05
@yctercero yctercero added the ci:cloud-redeploy Always create a new Cloud deployment label Aug 29, 2022
@yctercero
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@xcrzx xcrzx left a comment

Choose a reason for hiding this comment

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

Thanks, @yctercero, for addressing all the comments 🙌

Tested locally and found one last thing. Rule IDs are becoming a part of APM transaction names:

Screenshot 2022-08-30 at 20 05 00

Rule IDs are high cardinality fields and should not be propagated to the execution context. Otherwise, it would be very hard to analyze APM transactions as similar pages wouldn't be appropriately grouped. To fix that, please apply the following diff, it replaces rule IDs with the :detailName placeholder:

diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx
index fedeb9a1e9c..4dd6f6c9e92 100644
--- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx
+++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/details/index.tsx
@@ -805,7 +805,7 @@ const RuleDetailsPageComponent: React.FC<DetectionEngineComponentProps> = ({
             </Display>
             <StyledMinHeightTabContainer>
               <Switch>
-                <Route path={`/rules/id/${ruleId}/:tabName(${RuleDetailTabs.alerts})`}>
+                <Route path={`/rules/id/:detailName/:tabName(${RuleDetailTabs.alerts})`}>
                   <>
                     <EuiFlexGroup alignItems="center" justifyContent="spaceBetween">
                       <EuiFlexItem grow={false}>
@@ -855,7 +855,7 @@ const RuleDetailsPageComponent: React.FC<DetectionEngineComponentProps> = ({
                     )}
                   </>
                 </Route>
-                <Route path={`/rules/id/${ruleId}/:tabName(${RuleDetailTabs.exceptions})`}>
+                <Route path={`/rules/id/:detailName/:tabName(${RuleDetailTabs.exceptions})`}>
                   <ExceptionsViewer
                     ruleId={ruleId ?? ''}
                     ruleName={rule?.name ?? ''}
@@ -867,10 +867,10 @@ const RuleDetailsPageComponent: React.FC<DetectionEngineComponentProps> = ({
                     onRuleChange={refreshRule}
                   />
                 </Route>
-                <Route path={`/rules/id/${ruleId}/:tabName(${RuleDetailTabs.executionResults})`}>
+                <Route path={`/rules/id/:detailName/:tabName(${RuleDetailTabs.executionResults})`}>
                   <ExecutionLogTable ruleId={ruleId} selectAlertsTab={navigateToAlertsTab} />
                 </Route>
-                <Route path={`/rules/id/${ruleId}/:tabName(${RuleDetailTabs.executionEvents})`}>
+                <Route path={`/rules/id/:detailName/:tabName(${RuleDetailTabs.executionEvents})`}>
                   <ExecutionEventsTable ruleId={ruleId} />
                 </Route>
               </Switch>

@yctercero
Copy link
Contributor Author

@elasticmachine merge upstream

@yctercero yctercero enabled auto-merge (squash) August 30, 2022 22:05
@yctercero
Copy link
Contributor Author

@elasticmachine merge upstream

@yctercero
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

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

LGTM! branch tested, all looks good 🚀

Copy link
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

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

🎉 Awesome work! LGTM! 🚀

@yctercero
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

kibana-ci commented Aug 31, 2022

💚 Build Succeeded

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 5.7MB 6.4MB ⚠️ +700.8KB

History

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

cc @yctercero

@yctercero yctercero merged commit 082a362 into elastic:main Aug 31, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Aug 31, 2022
@yctercero yctercero deleted the rule_details_tabs branch August 31, 2022 20:41
Mpdreamz pushed a commit to Mpdreamz/kibana that referenced this pull request Sep 6, 2022
…w tabs to be a part of url (elastic#139592)

## Summary

Similar to how the Hosts page maintains the tab state in the URL, recreating that in the rule details page. This is in anticipation of some of the exceptions UI changes being worked on where this would create a better user experience.
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 ci:cloud-redeploy Always create a new Cloud deployment release_note:enhancement Team:Security Solution Platform Security Solution Platform Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants