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

[SIEM] Fix Detections page breadcrumbs #55173

Merged

Conversation

patrykkopycinski
Copy link
Contributor

@patrykkopycinski patrykkopycinski commented Jan 17, 2020

Summary

PXzXZMOOGv

#55127 has to go first

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@patrykkopycinski patrykkopycinski added Team:SIEM v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v7.6.0 labels Jan 17, 2020
@patrykkopycinski patrykkopycinski self-assigned this Jan 17, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/siem (Team:SIEM)

@patrykkopycinski patrykkopycinski force-pushed the fix/detections-breadcrumbs branch from 33460a7 to 4a78bb8 Compare January 17, 2020 18:15
@patrykkopycinski patrykkopycinski changed the title [SIEM[ Fix Detections page breadcrumbs [SIEM Fix Detections page breadcrumbs Jan 17, 2020
@patrykkopycinski patrykkopycinski changed the title [SIEM Fix Detections page breadcrumbs [SIEM] Fix Detections page breadcrumbs Jan 17, 2020
…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
@XavierM
Copy link
Contributor

XavierM commented Jan 21, 2020

image

I think that we need to add create's route in the breadcrumb too

if (tabPath === 'alerts') {
return {
text: i18nDetections.ALERT,
href: `${getDetectionEngineTabUrl(tabPath)}${search && search[0] ? search[0] : ''}`,
Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

and isRuleCreatePage ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

@@ -19,6 +20,7 @@ export const SpyRouteComponent = memo<SpyRouteProps & { location: H.Location }>(
match: {
params: { pageName, detailName, tabName, flowTarget },
},
state,
Copy link
Contributor

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>;
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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 ?? '' }} />

Copy link
Contributor Author

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

Copy link
Contributor

@XavierM XavierM left a 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.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:SIEM v7.6.0 v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants