@@ -27,6 +27,8 @@ import { i18n } from '@kbn/i18n';
2727import { FormattedMessage } from '@kbn/i18n/react' ;
2828import { createStructuredSelector } from 'reselect' ;
2929import { useDispatch } from 'react-redux' ;
30+ import { EuiContextMenuItemProps } from '@elastic/eui/src/components/context_menu/context_menu_item' ;
31+ import { NavigateToAppOptions } from 'kibana/public' ;
3032import { EndpointDetailsFlyout } from './details' ;
3133import * as selectors from '../store/selectors' ;
3234import { useEndpointSelector } from './hooks' ;
@@ -397,21 +399,21 @@ export const EndpointList = () => {
397399 return (
398400 < TableRowActions
399401 items = { [
400- < EuiContextMenuItem icon = "logoSecurity" key = "hostDetailsLink" >
401- < LinkToApp
402- data-test-subj = "hostLink "
403- appId = "securitySolution "
404- appPath = { `hosts/ ${ item . metadata . host . hostname } ` }
405- href = { ` ${ services ?. application ?. getUrlForApp ( 'securitySolution' ) } /hosts/ ${
406- item . metadata . host . hostname
407- } ` }
408- >
409- < FormattedMessage
410- id = "xpack.securitySolution.endpoint.list.actions.hostDetails"
411- defaultMessage = "View Host Details "
412- />
413- </ LinkToApp >
414- </ EuiContextMenuItem > ,
402+ < EuiContextMenuItemNavByRouter
403+ data-test-subj = "hostLink"
404+ icon = "logoSecurity "
405+ key = "hostDetailsLink "
406+ navigateAppId = "securitySolution"
407+ navigateOptions = { { path : `hosts/ ${ item . metadata . host . hostname } ` } }
408+ href = { ` ${ services ?. application ?. getUrlForApp ( 'securitySolution' ) } /hosts/ ${
409+ item . metadata . host . hostname
410+ } ` }
411+ >
412+ < FormattedMessage
413+ id = "xpack.securitySolution.endpoint.list.actions.hostDetails "
414+ defaultMessage = "View Host Details"
415+ / >
416+ </ EuiContextMenuItemNavByRouter > ,
415417 < EuiContextMenuItem icon = "logoObservability" key = "agentConfigLink" >
416418 < LinkToApp
417419 data-test-subj = "agentPolicyLink"
@@ -563,3 +565,20 @@ export const EndpointList = () => {
563565 </ AdministrationListPage >
564566 ) ;
565567} ;
568+
569+ const EuiContextMenuItemNavByRouter = memo <
570+ Omit < EuiContextMenuItemProps , 'onClick' > & {
571+ navigateAppId : string ;
572+ navigateOptions : NavigateToAppOptions ;
573+ children : React . ReactNode ;
574+ }
575+ > ( ( { navigateAppId, navigateOptions, children, ...otherMenuItemProps } ) => {
576+ const handleOnClick = useNavigateToAppEventHandler ( navigateAppId , navigateOptions ) ;
577+
578+ return (
579+ < EuiContextMenuItem { ...otherMenuItemProps } onClick = { handleOnClick } >
580+ { children }
581+ </ EuiContextMenuItem >
582+ ) ;
583+ } ) ;
584+ EuiContextMenuItemNavByRouter . displayName = 'EuiContextMenuItemNavByRouter' ;
0 commit comments