Update more doc links for ingest pipelines app (#112767)

This commit is contained in:
Lisa Cawley 2021-09-23 09:29:02 -07:00 committed by GitHub
parent 3124f47fa7
commit acf6a0296c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 33 deletions

View file

@ -426,6 +426,7 @@ export class DocLinksService {
fail: `${ELASTICSEARCH_DOCS}fail-processor.html`,
foreach: `${ELASTICSEARCH_DOCS}foreach-processor.html`,
geoIp: `${ELASTICSEARCH_DOCS}geoip-processor.html`,
geoMatch: `${ELASTICSEARCH_DOCS}geo-match-enrich-policy-type.html`,
grok: `${ELASTICSEARCH_DOCS}grok-processor.html`,
gsub: `${ELASTICSEARCH_DOCS}gsub-processor.html`,
htmlString: `${ELASTICSEARCH_DOCS}htmlstrip-processor.html`,

View file

@ -42,11 +42,7 @@ const getFieldsConfig = (esDocUrl: string): Record<string, FieldConfig> => {
defaultMessage="Pattern used to dissect the specified field. The pattern is defined by the parts of the string to discard. Use a {keyModifier} to alter the dissection behavior."
values={{
keyModifier: (
<EuiLink
target="_blank"
external
href={esDocUrl + '/dissect-processor.html#dissect-key-modifiers'}
>
<EuiLink target="_blank" external href={esDocUrl}>
{i18n.translate(
'xpack.ingestPipelines.pipelineEditor.dissectForm.patternFieldHelpText.dissectProcessorLink',
{
@ -97,7 +93,7 @@ const getFieldsConfig = (esDocUrl: string): Record<string, FieldConfig> => {
export const Dissect: FunctionComponent = () => {
const { services } = useKibana();
const fieldsConfig = getFieldsConfig(services.documentation.getEsDocsBasePath());
const fieldsConfig = getFieldsConfig(services.documentation.getDissectKeyModifiersUrl());
return (
<>

View file

@ -139,7 +139,6 @@ const fieldsConfig: FieldsConfig = {
export const Enrich: FunctionComponent = () => {
const { services } = useKibana();
const esDocUrl = services.documentation.getEsDocsBasePath();
return (
<>
<FieldNameField
@ -161,7 +160,11 @@ export const Enrich: FunctionComponent = () => {
defaultMessage="Name of the {enrichPolicyLink}."
values={{
enrichPolicyLink: (
<EuiLink external target="_blank" href={esDocUrl + '/ingest-enriching-data.html'}>
<EuiLink
external
target="_blank"
href={services.documentation.getEnrichDataUrl()}
>
{i18n.translate(
'xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText.enrichPolicyLink',
{ defaultMessage: 'enrich policy' }
@ -206,11 +209,7 @@ export const Enrich: FunctionComponent = () => {
defaultMessage="Operator used to match the geo-shape of incoming documents to enrich documents. Only used for {geoMatchPolicyLink}."
values={{
geoMatchPolicyLink: (
<EuiLink
external
target="_blank"
href={esDocUrl + '/enrich-policy-definition.html'}
>
<EuiLink external target="_blank" href={services.documentation.getGeoMatchUrl()}>
{i18n.translate(
'xpack.ingestPipelines.pipelineEditor.enrichForm.shapeRelationFieldHelpText.geoMatchPoliciesLink',
{ defaultMessage: 'geo-match enrich policies' }

View file

@ -28,14 +28,12 @@ const { emptyField, isJsonField } = fieldValidators;
const INFERENCE_CONFIG_DOCS = {
regression: {
path: 'inference-processor.html#inference-processor-regression-opt',
linkLabel: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.inferenceForm.inferenceConfigField.regressionLinkLabel',
{ defaultMessage: 'regression' }
),
},
classification: {
path: 'inference-processor.html#inference-processor-classification-opt',
linkLabel: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.inferenceForm.inferenceConfigField.classificationLinkLabel',
{ defaultMessage: 'classification' }
@ -43,27 +41,22 @@ const INFERENCE_CONFIG_DOCS = {
},
};
const getInferenceConfigHelpText = (esDocsBasePath: string): React.ReactNode => {
const getInferenceConfigHelpText = (
regressionDocsLink: string,
classificationDocsLink: string
): React.ReactNode => {
return (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.inferenceForm.inferenceConfigurationHelpText"
defaultMessage="Contains the inference type and its options. There are two types: {regression} and {classification}."
values={{
regression: (
<EuiLink
external
target="_blank"
href={`${esDocsBasePath}/${INFERENCE_CONFIG_DOCS.regression.path}`}
>
<EuiLink external target="_blank" href={regressionDocsLink}>
{INFERENCE_CONFIG_DOCS.regression.linkLabel}
</EuiLink>
),
classification: (
<EuiLink
external
target="_blank"
href={`${esDocsBasePath}/${INFERENCE_CONFIG_DOCS.classification.path}`}
>
<EuiLink external target="_blank" href={classificationDocsLink}>
{INFERENCE_CONFIG_DOCS.classification.linkLabel}
</EuiLink>
),
@ -158,7 +151,8 @@ const fieldsConfig: FieldsConfig = {
export const Inference: FunctionComponent = () => {
const { services } = useKibana();
const esDocUrl = services.documentation.getEsDocsBasePath();
const regressionDocsLink = services.documentation.getRegressionUrl();
const classificationDocsLink = services.documentation.getClassificationUrl();
return (
<>
<UseField config={fieldsConfig.model_id} component={Field} path="fields.model_id" />
@ -188,7 +182,7 @@ export const Inference: FunctionComponent = () => {
<UseField
config={{
...fieldsConfig.inference_config,
helpText: getInferenceConfigHelpText(esDocUrl),
helpText: getInferenceConfigHelpText(regressionDocsLink, classificationDocsLink),
}}
component={XJsonEditor}
componentProps={{

View file

@ -179,7 +179,7 @@ export const DocumentsTab: FunctionComponent<Props> = ({
values={{
learnMoreLink: (
<EuiLink
href={`${services.documentation.getEsDocsBasePath()}/simulate-pipeline-api.html`}
href={services.documentation.getSimulatePipelineApiUrl()}
target="_blank"
external
>

View file

@ -13,16 +13,28 @@ export class DocumentationService {
private processorsUrl: string = '';
private handlingFailureUrl: string = '';
private putPipelineApiUrl: string = '';
private simulatePipelineApiUrl: string = '';
private enrichDataUrl: string = '';
private geoMatchUrl: string = '';
private dissectKeyModifiersUrl: string = '';
private classificationUrl: string = '';
private regressionUrl: string = '';
public setup(docLinks: DocLinksStart): void {
const { DOC_LINK_VERSION, ELASTIC_WEBSITE_URL, links } = docLinks;
const docsBase = `${ELASTIC_WEBSITE_URL}guide/en`;
this.esDocBasePath = `${docsBase}/elasticsearch/reference/${DOC_LINK_VERSION}`;
this.ingestNodeUrl = `${links.ingest.pipelines}`;
this.processorsUrl = `${links.ingest.processors}`;
this.handlingFailureUrl = `${links.ingest.pipelineFailure}`;
this.putPipelineApiUrl = `${links.apis.createPipeline}`;
this.ingestNodeUrl = links.ingest.pipelines;
this.processorsUrl = links.ingest.processors;
this.handlingFailureUrl = links.ingest.pipelineFailure;
this.putPipelineApiUrl = links.apis.createPipeline;
this.simulatePipelineApiUrl = links.apis.simulatePipeline;
this.enrichDataUrl = links.ingest.enrich;
this.geoMatchUrl = links.ingest.geoMatch;
this.dissectKeyModifiersUrl = links.ingest.dissectKeyModifiers;
this.classificationUrl = links.ingest.inferenceClassification;
this.regressionUrl = links.ingest.inferenceRegression;
}
public getEsDocsBasePath() {
@ -44,6 +56,30 @@ export class DocumentationService {
public getPutPipelineApiUrl() {
return this.putPipelineApiUrl;
}
public getSimulatePipelineApiUrl() {
return this.simulatePipelineApiUrl;
}
public getEnrichDataUrl() {
return this.enrichDataUrl;
}
public getGeoMatchUrl() {
return this.geoMatchUrl;
}
public getDissectKeyModifiersUrl() {
return this.dissectKeyModifiersUrl;
}
public getClassificationUrl() {
return this.classificationUrl;
}
public getRegressionUrl() {
return this.regressionUrl;
}
}
export const documentationService = new DocumentationService();