-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SIEM] Fix Detections page breadcrumbs #55173
[SIEM] Fix Detections page breadcrumbs #55173
Conversation
Pinging @elastic/siem (Team:SIEM) |
33460a7
to
4a78bb8
Compare
…s-breadcrumbs # Conflicts: # x-pack/legacy/plugins/siem/public/components/link_to/redirect_to_detection_engine.tsx # x-pack/legacy/plugins/siem/public/pages/detection_engine/detection_engine.tsx # x-pack/legacy/plugins/siem/public/pages/detection_engine/index.tsx # x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/details/index.tsx
if (tabPath === 'alerts') { | ||
return { | ||
text: i18nDetections.ALERT, | ||
href: `${getDetectionEngineTabUrl(tabPath)}${search && search[0] ? search[0] : ''}`, |
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.
nit we can use isEmpty(search)? '' : search[0]
]; | ||
} | ||
|
||
if (isRuleEditPage(params.pathName) && params.detailName && params.state?.ruleName) { |
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.
and isRuleCreatePage
;)
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.
@@ -19,6 +20,7 @@ export const SpyRouteComponent = memo<SpyRouteProps & { location: H.Location }>( | |||
match: { | |||
params: { pageName, detailName, tabName, flowTarget }, | |||
}, | |||
state, |
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.
good idea to add a state here
@@ -55,4 +59,6 @@ export type SpyRouteProps = RouteComponentProps<{ | |||
tabName: HostsTableType | undefined; | |||
search: string; | |||
flowTarget: FlowTarget | undefined; | |||
}>; | |||
}> & { | |||
state?: Record<string, string | undefined>; |
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.
is it a good idea to allow a Record with key string with an undefined value. I feel like if the value is undefined we should not add the key in the object.
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.
https://github.com/elastic/kibana/pull/55173/files/9ac7b15d9bd942c3ddf040ece037cd980b9ea000#diff-f0513e4cfb90441e54375f10a9f0157aR350
in case we didn't allow for undefined then in a case like this we would have to have additional logic to don't pass anything or if only one of the values would be undefined then we would need to filter those keys out, so I think it will be easier to work with to allow undefined values
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.
or we can just do that <SpyRoute state={{ ruleName: rule?.name ?? 'unknown' }} />
|| <SpyRoute state={{ ruleName: rule?.name ?? '' }} />
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.
yeah, but then we need to have additional logic to handle empty strings or 'unknown' string case
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, thank you for adding the breadcrumbs for detections.
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
Summary
#55127 has to go first
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers