From b63e1df920dcb535f306048f04f35face8ee2d21 Mon Sep 17 00:00:00 2001 From: cauemarcondes Date: Tue, 22 Dec 2020 17:04:16 +0100 Subject: [PATCH] fixing ML links --- .../shared/Links/MachineLearningLinks/MLManageJobsLink.tsx | 3 ++- .../shared/Links/MachineLearningLinks/MLSingleMetricLink.tsx | 3 ++- .../components/shared/charts/transaction_charts/ml_header.tsx | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLManageJobsLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLManageJobsLink.tsx index 3406ce0b1e9d2..d58e27536628b 100644 --- a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLManageJobsLink.tsx +++ b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLManageJobsLink.tsx @@ -34,7 +34,8 @@ export function MLManageJobsLink({ children, external }: Props) { rangeFrom = 'now-1h', rangeTo = 'now', refreshInterval = timePickerRefreshIntervalDefaults.value, - refreshPaused = timePickerRefreshIntervalDefaults.pause, + // defaults it to true to avoid infinite loop when refreshInterval is "0" + refreshPaused = true, } = urlParams; const mlADLink = useMlHref(ml, core.http.basePath.get(), { diff --git a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLSingleMetricLink.tsx b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLSingleMetricLink.tsx index 098a150e3269c..d2ae8ed25aaa3 100644 --- a/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLSingleMetricLink.tsx +++ b/x-pack/plugins/apm/public/components/shared/Links/MachineLearningLinks/MLSingleMetricLink.tsx @@ -63,7 +63,8 @@ export function useSingleMetricHref({ rangeFrom = 'now-1h', rangeTo = 'now', refreshInterval = timePickerRefreshIntervalDefaults.value, - refreshPaused = timePickerRefreshIntervalDefaults.pause, + // defaults it to true to avoid infinite loop when refreshInterval is "0" + refreshPaused = true, } = urlParams; const entities = diff --git a/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/ml_header.tsx b/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/ml_header.tsx index d125af70268cb..33dcbf02ccda7 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/ml_header.tsx +++ b/x-pack/plugins/apm/public/components/shared/charts/transaction_charts/ml_header.tsx @@ -10,6 +10,7 @@ import { isEmpty } from 'lodash'; import React from 'react'; import { useParams } from 'react-router-dom'; import styled from 'styled-components'; +import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context'; import { useUrlParams } from '../../../../context/url_params_context/use_url_params'; import { MLSingleMetricLink } from '../../Links/MachineLearningLinks/MLSingleMetricLink'; @@ -33,12 +34,13 @@ const ShiftedEuiText = styled(EuiText)` export function MLHeader({ hasValidMlLicense, mlJobId }: Props) { const { serviceName } = useParams<{ serviceName?: string }>(); const { urlParams } = useUrlParams(); + const { transactionType } = useApmServiceContext(); if (!hasValidMlLicense || !mlJobId) { return null; } - const { kuery, transactionType } = urlParams; + const { kuery } = urlParams; const hasKuery = !isEmpty(kuery); const icon = hasKuery ? (