[ML] Update broken job config callout error (#75481)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
3201efe797
commit
958296c5c2
|
@ -4,13 +4,14 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* 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 { EuiCallOut, EuiLink, EuiPanel, EuiSpacer } from '@elastic/eui';
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
|
||||||
import { ExplorationTitle } from '../exploration_title';
|
import { ExplorationTitle } from '../exploration_title';
|
||||||
|
import { useMlKibana } from '../../../../../contexts/kibana';
|
||||||
|
|
||||||
const jobConfigErrorTitle = i18n.translate('xpack.ml.dataframe.analytics.jobConfig.errorTitle', {
|
const jobConfigErrorTitle = i18n.translate('xpack.ml.dataframe.analytics.jobConfig.errorTitle', {
|
||||||
defaultMessage: 'Unable to fetch results. An error occurred loading the job configuration data.',
|
defaultMessage: 'Unable to fetch results. An error occurred loading the job configuration data.',
|
||||||
|
@ -31,6 +32,11 @@ export const JobConfigErrorCallout: FC<Props> = ({
|
||||||
jobConfigErrorMessage,
|
jobConfigErrorMessage,
|
||||||
title,
|
title,
|
||||||
}) => {
|
}) => {
|
||||||
|
const {
|
||||||
|
services: {
|
||||||
|
application: { getUrlForApp },
|
||||||
|
},
|
||||||
|
} = useMlKibana();
|
||||||
const containsIndexPatternLink =
|
const containsIndexPatternLink =
|
||||||
typeof jobCapsServiceErrorMessage === 'string' &&
|
typeof jobCapsServiceErrorMessage === 'string' &&
|
||||||
jobCapsServiceErrorMessage.includes('locate that index-pattern') &&
|
jobCapsServiceErrorMessage.includes('locate that index-pattern') &&
|
||||||
|
@ -39,9 +45,16 @@ export const JobConfigErrorCallout: FC<Props> = ({
|
||||||
const message = (
|
const message = (
|
||||||
<p>{jobConfigErrorMessage ? jobConfigErrorMessage : jobCapsServiceErrorMessage}</p>
|
<p>{jobConfigErrorMessage ? jobConfigErrorMessage : jobCapsServiceErrorMessage}</p>
|
||||||
);
|
);
|
||||||
|
const newIndexPatternUrl = useMemo(
|
||||||
|
() =>
|
||||||
|
getUrlForApp('management', {
|
||||||
|
path: 'kibana/indexPatterns',
|
||||||
|
}),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
const calloutBody = containsIndexPatternLink ? (
|
const calloutBody = containsIndexPatternLink ? (
|
||||||
<EuiLink href="management/kibana/indexPatterns" target="_blank">
|
<EuiLink href={newIndexPatternUrl} target="_blank">
|
||||||
{message}
|
{message}
|
||||||
</EuiLink>
|
</EuiLink>
|
||||||
) : (
|
) : (
|
||||||
|
|
Loading…
Reference in a new issue