From fc2332f50f815f39ffa38f606ca4c98cbf29d2a3 Mon Sep 17 00:00:00 2001 From: Pablo Machado Date: Wed, 12 Oct 2022 10:49:29 +0200 Subject: [PATCH] Update EA page anomalies link to scroll down to the anomalies table (#143085) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../entity_analytics/anomalies/index.tsx | 4 ++- .../entity_analytics/header/index.tsx | 26 +++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/index.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/index.tsx index 2d8491879d060..d88ad343eab3c 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/anomalies/index.tsx @@ -37,6 +37,8 @@ const TABLE_SORTING = { }, } as const; +export const ENTITY_ANALYTICS_ANOMALIES_PANEL = 'entity_analytics_anomalies'; + export const EntityAnalyticsAnomalies = () => { const { services: { ml, http }, @@ -86,7 +88,7 @@ export const EntityAnalyticsAnomalies = () => { }, [getSecuritySolutionLinkProps]); return ( - + eui.euiColorDanger}; @@ -74,10 +73,6 @@ export const EntityAnalyticsHeader = () => { const getSecuritySolutionLinkProps = useGetSecuritySolutionLinkProps(); const isPlatinumOrTrialLicense = useMlCapabilities().isPlatinumOrTrialLicense; - const { - services: { ml, http }, - } = useKibana(); - const [goToHostRiskTabFilteredByCritical, hostRiskTabUrl] = useMemo(() => { const { onClick, href } = getSecuritySolutionLinkProps({ deepLinkId: SecurityPageName.hosts, @@ -151,9 +146,14 @@ export const EntityAnalyticsHeader = () => { [data, areJobsEnabled] ); - const jobsUrl = useMlHref(ml, http.basePath.get(), { - page: ML_PAGES.ANOMALY_DETECTION_JOBS_MANAGE, - }); + const scrollToAnomalies = useCallback(() => { + const element = document.querySelector( + `[data-test-subj="${ENTITY_ANALYTICS_ANOMALIES_PANEL}"]` + ); + if (element) { + element.scrollIntoView({ behavior: 'smooth' }); + } + }, []); return ( @@ -211,9 +211,9 @@ export const EntityAnalyticsHeader = () => { - + {i18n.ANOMALIES} - +