Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] DF Analytics results: add index-pattern management link to 'click here' error prompt #72470

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React, { FC } from 'react';

import { EuiCallOut, EuiPanel, EuiSpacer } from '@elastic/eui';
import { EuiCallOut, EuiLink, EuiPanel, EuiSpacer } from '@elastic/eui';

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

Expand All @@ -31,6 +31,23 @@ export const JobConfigErrorCallout: FC<Props> = ({
jobConfigErrorMessage,
title,
}) => {
const containsIndexPatternLink =
typeof jobCapsServiceErrorMessage === 'string' &&
jobCapsServiceErrorMessage.includes('locate that index-pattern') &&
jobCapsServiceErrorMessage.includes('click here to re-create');

const message = (
<p>{jobConfigErrorMessage ? jobConfigErrorMessage : jobCapsServiceErrorMessage}</p>
);

const calloutBody = containsIndexPatternLink ? (
<EuiLink href="management/kibana/indexPatterns" target="_blank">
{message}
</EuiLink>
) : (
message
);

return (
<EuiPanel grow={false}>
<ExplorationTitle title={title} />
Expand All @@ -40,7 +57,7 @@ export const JobConfigErrorCallout: FC<Props> = ({
color="danger"
iconType="cross"
>
<p>{jobConfigErrorMessage ? jobConfigErrorMessage : jobCapsServiceErrorMessage}</p>
{calloutBody}
</EuiCallOut>
</EuiPanel>
);
Expand Down