Skip to content

Commit d5f34c8

Browse files
add index-pattern link when error contains 'click here' text (#72470) (#72495)
1 parent 049ed89 commit d5f34c8

File tree

1 file changed

+19
-2
lines changed
  • x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/job_config_error_callout

1 file changed

+19
-2
lines changed

x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/job_config_error_callout/job_config_error_callout.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import React, { FC } from 'react';
88

9-
import { EuiCallOut, EuiPanel, EuiSpacer } from '@elastic/eui';
9+
import { EuiCallOut, EuiLink, EuiPanel, EuiSpacer } from '@elastic/eui';
1010

1111
import { i18n } from '@kbn/i18n';
1212

@@ -31,6 +31,23 @@ export const JobConfigErrorCallout: FC<Props> = ({
3131
jobConfigErrorMessage,
3232
title,
3333
}) => {
34+
const containsIndexPatternLink =
35+
typeof jobCapsServiceErrorMessage === 'string' &&
36+
jobCapsServiceErrorMessage.includes('locate that index-pattern') &&
37+
jobCapsServiceErrorMessage.includes('click here to re-create');
38+
39+
const message = (
40+
<p>{jobConfigErrorMessage ? jobConfigErrorMessage : jobCapsServiceErrorMessage}</p>
41+
);
42+
43+
const calloutBody = containsIndexPatternLink ? (
44+
<EuiLink href="management/kibana/indexPatterns" target="_blank">
45+
{message}
46+
</EuiLink>
47+
) : (
48+
message
49+
);
50+
3451
return (
3552
<EuiPanel grow={false}>
3653
<ExplorationTitle title={title} />
@@ -40,7 +57,7 @@ export const JobConfigErrorCallout: FC<Props> = ({
4057
color="danger"
4158
iconType="cross"
4259
>
43-
<p>{jobConfigErrorMessage ? jobConfigErrorMessage : jobCapsServiceErrorMessage}</p>
60+
{calloutBody}
4461
</EuiCallOut>
4562
</EuiPanel>
4663
);

0 commit comments

Comments
 (0)