Skip to content

Commit

Permalink
[7.x] [ML] Update broken job config callout error (elastic#75481) (el…
Browse files Browse the repository at this point in the history
…astic#75617)

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
qn895 and elasticmachine authored Aug 21, 2020
1 parent 81f1bdf commit e3644b2
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand All @@ -31,6 +32,11 @@ export const JobConfigErrorCallout: FC<Props> = ({
jobConfigErrorMessage,
title,
}) => {
const {
services: {
application: { getUrlForApp },
},
} = useMlKibana();
const containsIndexPatternLink =
typeof jobCapsServiceErrorMessage === 'string' &&
jobCapsServiceErrorMessage.includes('locate that index-pattern') &&
Expand All @@ -39,9 +45,16 @@ export const JobConfigErrorCallout: FC<Props> = ({
const message = (
<p>{jobConfigErrorMessage ? jobConfigErrorMessage : jobCapsServiceErrorMessage}</p>
);
const newIndexPatternUrl = useMemo(
() =>
getUrlForApp('management', {
path: 'kibana/indexPatterns',
}),
[]
);

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

0 comments on commit e3644b2

Please sign in to comment.