[ML] Use documentation link service in more ML pages (#87389)

This commit is contained in:
Lisa Cawley 2021-01-11 11:39:04 -08:00 committed by GitHub
parent ff8d30bc6c
commit a9797999a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 32 additions and 34 deletions

View file

@ -96,7 +96,7 @@ exports[`RuleEditorFlyout renders the flyout after adding a condition to a rule
values={
Object {
"learnMoreLink": <EuiLink
href="https://www.elastic.co/guide/en/machine-learning/jest-metadata-mock-branch/ml-rules.html"
href="jest-metadata-mock-url"
target="_blank"
>
<FormattedMessage
@ -355,7 +355,7 @@ exports[`RuleEditorFlyout renders the flyout after setting the rule to edit 1`]
values={
Object {
"learnMoreLink": <EuiLink
href="https://www.elastic.co/guide/en/machine-learning/jest-metadata-mock-branch/ml-rules.html"
href="jest-metadata-mock-url"
target="_blank"
>
<FormattedMessage
@ -600,7 +600,7 @@ exports[`RuleEditorFlyout renders the flyout for creating a rule with conditions
values={
Object {
"learnMoreLink": <EuiLink
href="https://www.elastic.co/guide/en/machine-learning/jest-metadata-mock-branch/ml-rules.html"
href="jest-metadata-mock-url"
target="_blank"
>
<FormattedMessage

View file

@ -479,8 +479,7 @@ class RuleEditorFlyoutUI extends Component {
};
render() {
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = this.props.kibana.services.docLinks;
const docsUrl = `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-rules.html`;
const docsUrl = this.props.kibana.services.docLinks.links.ml.customRules;
const {
isFlyoutVisible,
job,

View file

@ -86,8 +86,11 @@ function prepareTest() {
kibana: {
services: {
docLinks: {
ELASTIC_WEBSITE_URL: 'https://www.elastic.co/',
DOC_LINK_VERSION: 'jest-metadata-mock-branch',
links: {
ml: {
customRules: 'jest-metadata-mock-url',
},
},
},
},
},

View file

@ -309,8 +309,7 @@ export class ValidateJobUI extends Component {
};
render() {
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = getDocLinks();
const jobTipsUrl = `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/create-jobs.html#job-tips`;
const jobTipsUrl = getDocLinks().links.ml.anomalyDetectionJobTips;
// only set to false if really false and not another falsy value, so it defaults to true.
const fill = this.props.fill === false ? false : true;
// default to false if not explicitly set to true

View file

@ -11,8 +11,11 @@ import { ValidateJob } from './validate_job_view';
jest.mock('../../util/dependency_cache', () => ({
getDocLinks: () => ({
ELASTIC_WEBSITE_URL: 'https://www.elastic.co/',
DOC_LINK_VERSION: 'jest-metadata-mock-branch',
links: {
ml: {
anomalyDetectionJobTips: 'jest-metadata-mock-url',
},
},
}),
}));

View file

@ -43,8 +43,7 @@ export const DetailsStepForm: FC<CreateAnalyticsStepProps> = ({
const {
services: { docLinks, notifications },
} = useMlKibana();
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const createIndexLink = docLinks.links.apis.createIndex;
const { setFormState } = actions;
const { form, cloneJob, hasSwitchedToEditor, isJobCreated } = state;
const {
@ -240,10 +239,7 @@ export const DetailsStepForm: FC<CreateAnalyticsStepProps> = ({
}
)}
<br />
<EuiLink
href={`${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/indices-create-index.html#indices-create-index`}
target="_blank"
>
<EuiLink href={createIndexLink} target="_blank">
{i18n.translate(
'xpack.ml.dataframe.stepDetailsForm.destinationIndexInvalidErrorLink',
{

View file

@ -84,7 +84,7 @@ exports[`Overrides render overrides 1`] = `
size="xs"
>
<EuiLink
href="https://www.elastic.co/guide/en/elasticsearch/reference/jest-metadata-mock-branch/search-aggregations-bucket-daterange-aggregation.html#date-format-pattern"
href="jest-metadata-mock-url"
target="_blank"
>
See more on accepted formats

View file

@ -268,8 +268,7 @@ class OverridesUI extends Component {
const fieldOptions = getSortedFields(fields);
const timestampFormatErrorsList = [this.customTimestampFormatErrors, timestampFormatError];
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = this.props.kibana.services.docLinks;
const docsUrl = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/search-aggregations-bucket-daterange-aggregation.html#date-format-pattern`;
const docsUrl = this.props.kibana.services.docLinks.links.aggs.date_format_pattern;
const timestampFormatHelp = (
<EuiText size="xs">

View file

@ -26,8 +26,11 @@ function getProps() {
kibana: {
services: {
docLinks: {
ELASTIC_WEBSITE_URL: 'https://www.elastic.co/',
DOC_LINK_VERSION: 'jest-metadata-mock-branch',
links: {
aggs: {
date_format_pattern: 'jest-metadata-mock-url',
},
},
},
},
},

View file

@ -90,7 +90,7 @@ exports[`CalendarListsHeader renders header 1`] = `
Object {
"br": <br />,
"learnMoreLink": <EuiLink
href="https://www.elastic.co/guide/en/machine-learning/jest-metadata-mock-branch/ml-calendars.html"
href="jest-metadata-mock-url"
target="_blank"
>
<FormattedMessage

View file

@ -117,10 +117,6 @@ const props = {
addDanger: () => {},
},
},
docLinks: {
ELASTIC_WEBSITE_URL: 'https://www.elastic.co/',
DOC_LINK_VERSION: 'jest-metadata-mock-branch',
},
},
},
};

View file

@ -26,9 +26,7 @@ import {
import { withKibana } from '../../../../../../../../src/plugins/kibana_react/public';
function CalendarsListHeaderUI({ totalCount, refreshCalendars, kibana }) {
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = kibana.services.docLinks;
const docsUrl = `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-calendars.html`;
const docsUrl = kibana.services.docLinks.links.ml.calendars;
return (
<React.Fragment>
<EuiFlexGroup justifyContent="spaceBetween" alignItems="baseline">

View file

@ -24,8 +24,11 @@ describe('CalendarListsHeader', () => {
kibana: {
services: {
docLinks: {
ELASTIC_WEBSITE_URL: 'https://www.elastic.co/',
DOC_LINK_VERSION: 'jest-metadata-mock-branch',
links: {
ml: {
calendars: 'jest-metadata-mock-url',
},
},
},
},
},

View file

@ -26,8 +26,7 @@ import {
import { withKibana } from '../../../../../../../../src/plugins/kibana_react/public';
function FilterListsHeaderUI({ totalCount, refreshFilterLists, kibana }) {
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = kibana.services.docLinks;
const docsUrl = `${ELASTIC_WEBSITE_URL}guide/en/machine-learning/${DOC_LINK_VERSION}/ml-rules.html`;
const docsUrl = kibana.services.docLinks.links.ml.customRules;
return (
<React.Fragment>
<EuiFlexGroup justifyContent="spaceBetween" alignItems="baseline">