-
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 link on overview page #60348
Conversation
Pinging @elastic/siem (Team:SIEM) |
@@ -113,42 +108,13 @@ export const getTitle = ( | |||
return navTabs[pageName] != null ? navTabs[pageName].name : ''; | |||
}; | |||
|
|||
export const getCurrentLocation = ( |
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.
FYI -> It was not used @stephmilovic told me and when I went in this files, I had to delete it ;)
export const makeMapStateToProps = () => { | ||
const getInputsSelector = inputsSelectors.inputsSelector(); | ||
const getGlobalQuerySelector = inputsSelectors.globalQuerySelector(); | ||
const getGlobalFiltersQuerySelector = inputsSelectors.globalFiltersQuerySelector(); | ||
const getGlobalSavedQuerySelector = inputsSelectors.globalSavedQuerySelector(); | ||
const getTimelines = timelineSelectors.getTimelines(); | ||
const mapStateToProps = (state: State, { pageName, detailName }: UrlStateContainerPropTypes) => { | ||
const mapStateToProps = (state: 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.
pageName
and detailName
are not used in the function
export const getDetectionEngineAlertUrl = () => | ||
`${baseDetectionEngineUrl}/${DetectionEngineTab.alerts}`; | ||
export const getDetectionEngineUrl = (search?: string) => | ||
`${baseDetectionEngineUrl}${search != null ? `?${search}` : ''}`; |
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.
Consider creating a utility function for ${search != null ?
?${search} : ''}
, because there are six instances of it in this PR, and likely additional instances in the future
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.
I'm not sure if it's possible / valid to change the type signatures of the functions that take (search?: string)
to something like (search: string | null)
, but an advantage of such a change is the type checker would force the caller to always handle this case by passing search
or an explicit null
when search
should not be provided.
For example, making this parameter non-optional makes the type checker flag the following code in x-pack/legacy/plugins/siem/public/pages/detection_engine/rules/index.tsx
:
<DetectionEngineHeaderPage
backOptions={{
href: getDetectionEngineUrl(),
text: i18n.BACK_TO_DETECTION_ENGINE,
}}
title={i18n.PAGE_TITLE}
>
- If the above code really should be passing
search
, then the type checker just found a bug - If the above code is a valid case to not pass
search
, we would be forced to explicitly passnull
, which feels OK to me - Making
search
non-optional also causes the type checker to flaggetBreadcrumbs
inx-pack/legacy/plugins/siem/public/pages/detection_engine/rules/utils.ts
because it uses a slight variation of the "search checking pattern", where in this case it's usingsearch[0]
instead:
${!isEmpty(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.
That's why I did it like that because I just wanted to focus this PR on the overview page. Also, I remember that we made a decision that we did not want the breadcrumb to follow the url state for some reason. (maybe we can discuss it in one of our meetings)
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.
but I mean you are correct, we should have a follow-up PRs to get all link through the app corrected and discussed breadcrumb.
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.
It looks like all breadcrumbs have the URL state, so that resolved the question above. I will go over in another PR to make everything following the same pattern. so the breadcrumb's URL can be also simplified from this PR.
x-pack/legacy/plugins/siem/public/components/link_to/helpers.test.ts
Outdated
Show resolved
Hide resolved
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.
Thanks for fixing #60076 @XavierM! 🙏
Desk tested:
- via the repro steps steps in the issue
- the following buttons and links:
View signals
,View alerts
,View events
,View hosts
,View network
,View all timelines
- using both single-click and "middle-click / open-in-new-tab"-style navigation
- in the following browsers: Chrome
80.0.3987.132
, Firefox74.0
, and Safari13.0.5
LGTM 🚀 🔗
💛 Build succeeded, but was flaky
Test FailuresKibana Pipeline / kibana-xpack-agent / sets the flyout button background to euiColorSuccess with a 10% alpha channel when the user starts dragging a host, but is not hovering over the flyout button.timeline flyout button sets the flyout button background to euiColorSuccess with a 10% alpha channel when the user starts dragging a host, but is not hovering over the flyout buttonStandard Out
Stack Trace
History
To update your PR or re-run it, just comment with: |
* Fix link on overview page * no needs of useMemo * clean up * review I * review II * review III
* master: [SIEM] Adds 'Closes one signal when more than one opened signals are selected' test again (elastic#60380) [SIEM][Detections Engine] - Add rule markdown field to rule create, detail, and edit flows (elastic#60108) [Fleet] Add config revision to fleet agents (elastic#60292) Allow kbn-config-schema to ignore unknown keys (elastic#59560) [ML] Functional tests - disable df analytics clone tests skip flaky suite (elastic#58643) (elastic#58991) [FTR] Add support for --include and --exclude files via tags (elastic#60123) [SIEM] Fix link on overview page (elastic#60348) skip flaky test (elastic#60369) [Endpoint] Adds take action dropdown and tests to alert details flyout (elastic#59242) [Lens] Simplify state management from visualization (elastic#58279) Changing default type to start and allowing it to be configured by the event category (elastic#60323) [ML] Adds the class_assignment_objective to classification (elastic#60358)
* master: (51 commits) do not update cell background if is label cell (elastic#60308) FTR configurable test users (elastic#52431) [Reporting] Wholesale moves client to newest-platform (elastic#58945) [Ingest] Support `show_user` package registry flag (elastic#60338) [SIEM] Adds 'Closes one signal when more than one opened signals are selected' test again (elastic#60380) [SIEM][Detections Engine] - Add rule markdown field to rule create, detail, and edit flows (elastic#60108) [Fleet] Add config revision to fleet agents (elastic#60292) Allow kbn-config-schema to ignore unknown keys (elastic#59560) [ML] Functional tests - disable df analytics clone tests skip flaky suite (elastic#58643) (elastic#58991) [FTR] Add support for --include and --exclude files via tags (elastic#60123) [SIEM] Fix link on overview page (elastic#60348) skip flaky test (elastic#60369) [Endpoint] Adds take action dropdown and tests to alert details flyout (elastic#59242) [Lens] Simplify state management from visualization (elastic#58279) Changing default type to start and allowing it to be configured by the event category (elastic#60323) [ML] Adds the class_assignment_objective to classification (elastic#60358) [TSVB] fix text color when using custom background color (elastic#60261) Fix import to timefilter from in TSVB (elastic#60296) [NP] Get rid of usage redirectWhenMissing service (elastic#59777) ...
* alerting/view-in-app: (53 commits) fixed typo handle optional alerting plugin do not update cell background if is label cell (elastic#60308) FTR configurable test users (elastic#52431) [Reporting] Wholesale moves client to newest-platform (elastic#58945) [Ingest] Support `show_user` package registry flag (elastic#60338) [SIEM] Adds 'Closes one signal when more than one opened signals are selected' test again (elastic#60380) [SIEM][Detections Engine] - Add rule markdown field to rule create, detail, and edit flows (elastic#60108) [Fleet] Add config revision to fleet agents (elastic#60292) Allow kbn-config-schema to ignore unknown keys (elastic#59560) [ML] Functional tests - disable df analytics clone tests skip flaky suite (elastic#58643) (elastic#58991) [FTR] Add support for --include and --exclude files via tags (elastic#60123) [SIEM] Fix link on overview page (elastic#60348) skip flaky test (elastic#60369) [Endpoint] Adds take action dropdown and tests to alert details flyout (elastic#59242) [Lens] Simplify state management from visualization (elastic#58279) Changing default type to start and allowing it to be configured by the event category (elastic#60323) [ML] Adds the class_assignment_objective to classification (elastic#60358) [TSVB] fix text color when using custom background color (elastic#60261) ...
Summary
We were missing the query parameters on all links of the overview pages.
Checklist
Delete any items that are not applicable to this PR.
[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials[ ] Unit or functional tests were updated or added to match the most common scenarios[ ] This was checked for keyboard-only and screenreader accessibility[ ] This renders correctly on smaller devices using a responsive layout. (You can test this in your browser[ ] This was checked for cross-browser compatibility, including a check against IE11For maintainers
[ ] This was checked for breaking API changes and was labeled appropriately