diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/job_config_error_callout/job_config_error_callout.tsx b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/job_config_error_callout/job_config_error_callout.tsx index 9b9e1258db503..959f2d18d99fe 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/job_config_error_callout/job_config_error_callout.tsx +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/job_config_error_callout/job_config_error_callout.tsx @@ -4,13 +4,14 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { FC } from 'react'; +import React, { FC, useMemo } from 'react'; import { EuiCallOut, EuiLink, EuiPanel, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { ExplorationTitle } from '../exploration_title'; +import { useMlKibana } from '../../../../../contexts/kibana'; const jobConfigErrorTitle = i18n.translate('xpack.ml.dataframe.analytics.jobConfig.errorTitle', { defaultMessage: 'Unable to fetch results. An error occurred loading the job configuration data.', @@ -31,6 +32,11 @@ export const JobConfigErrorCallout: FC = ({ jobConfigErrorMessage, title, }) => { + const { + services: { + application: { getUrlForApp }, + }, + } = useMlKibana(); const containsIndexPatternLink = typeof jobCapsServiceErrorMessage === 'string' && jobCapsServiceErrorMessage.includes('locate that index-pattern') && @@ -39,9 +45,16 @@ export const JobConfigErrorCallout: FC = ({ const message = (

{jobConfigErrorMessage ? jobConfigErrorMessage : jobCapsServiceErrorMessage}

); + const newIndexPatternUrl = useMemo( + () => + getUrlForApp('management', { + path: 'kibana/indexPatterns', + }), + [] + ); const calloutBody = containsIndexPatternLink ? ( - + {message} ) : (