Skip to content

Commit

Permalink
[ML] Use documentation link service in more ML pages (#87389) (#87906)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl authored Jan 11, 2021
1 parent fb93a94 commit 5b078e2
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 34 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
}),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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',
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
},
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ const props = {
addDanger: () => {},
},
},
docLinks: {
ELASTIC_WEBSITE_URL: 'https://www.elastic.co/',
DOC_LINK_VERSION: 'jest-metadata-mock-branch',
},
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit 5b078e2

Please sign in to comment.