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

[Ingest Pipelines] Add doc links to processor types #69279

Merged
Merged
Show file tree
Hide file tree
Changes from 5 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 @@ -128,8 +128,7 @@ export const PipelineFormFields: React.FunctionComponent<Props> = ({
return (
<PipelineProcessorsEditor
onFlyoutOpen={onEditorFlyoutOpen}
learnMoreAboutProcessorsUrl={services.documentation.getProcessorsUrl()}
learnMoreAboutOnFailureProcessorsUrl={services.documentation.getHandlingFailureUrl()}
esDocsBasePath={services.documentation.getEsDocsBasePath()}
isTestButtonDisabled={isTestButtonDisabled}
onTestPipelineClick={onTestPipelineClick}
onUpdate={onProcessorsUpdate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ describe('Pipeline Editor', () => {
onUpdate,
isTestButtonDisabled: false,
onTestPipelineClick: jest.fn(),
learnMoreAboutProcessorsUrl: 'test',
learnMoreAboutOnFailureProcessorsUrl: 'test',
esDocsBasePath: 'test',
});

const {
Expand All @@ -56,8 +55,7 @@ describe('Pipeline Editor', () => {
onUpdate: jest.fn(),
isTestButtonDisabled: false,
onTestPipelineClick: jest.fn(),
learnMoreAboutProcessorsUrl: 'test',
learnMoreAboutOnFailureProcessorsUrl: 'test',
esDocsBasePath: 'test',
});

expect(exists('pipelineEditorOnFailureTree')).toBe(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { SettingsFormFlyout, OnSubmitHandler } from './settings_form_flyout';

export { ProcessorSettingsForm, ProcessorSettingsFromOnSubmitArg } from './processor_settings_form';
export {
ProcessorSettingsForm,
ProcessorSettingsFromOnSubmitArg,
OnSubmitHandler,
} from './processor_settings_form';

export { ProcessorsTree, ProcessorInfo, OnActionHandler } from './processors_tree';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export const OnFailureProcessorsTitle: FunctionComponent = () => {
defaultMessage="The processors used to pre-process documents before indexing. {learnMoreLink}"
values={{
learnMoreLink: (
<EuiLink href={links.learnMoreAboutOnFailureProcessorsUrl} target="_blank">
<EuiLink
href={links.esDocsBasePath + '/handling-failure-in-pipelines.html'}
target="_blank"
>
{i18n.translate(
'xpack.ingestPipelines.pipelineEditor.onFailureProcessorsDocumentationLink',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
export {
ProcessorSettingsForm,
ProcessorSettingsFromOnSubmitArg,
OnSubmitHandler,
} from './processor_settings_form.container';
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React, { FunctionComponent } from 'react';
import { EuiButtonEmpty } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

interface Props {
processorLabel: string;
docLink: string;
}

export const LearnMoreFormButton: FunctionComponent<Props> = ({ processorLabel, docLink }) => {
jloleysens marked this conversation as resolved.
Show resolved Hide resolved
return (
<EuiButtonEmpty size="s" flush="right" href={docLink} target="_blank" iconType="help">
{i18n.translate(
'xpack.ingestPipelines.pipelineEditor.settingsForm.learnMoreLabelLink.processor',
{ defaultMessage: '{processorLabel} documentation', values: { processorLabel } }
)}
</EuiButtonEmpty>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,270 @@
* you may not use this file except in compliance with the Elastic License.
*/

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

// import { SetProcessor } from './processors/set';
// import { Gsub } from './processors/gsub';

const mapProcessorTypeToForm = {
append: undefined, // TODO: Implement
bytes: undefined, // TODO: Implement
circle: undefined, // TODO: Implement
convert: undefined, // TODO: Implement
csv: undefined, // TODO: Implement
date: undefined, // TODO: Implement
date_index_name: undefined, // TODO: Implement
dissect: undefined, // TODO: Implement
dot_expander: undefined, // TODO: Implement
drop: undefined, // TODO: Implement
enrich: undefined, // TODO: Implement
fail: undefined, // TODO: Implement
foreach: undefined, // TODO: Implement
geoip: undefined, // TODO: Implement
grok: undefined, // TODO: Implement
html_strip: undefined, // TODO: Implement
inference: undefined, // TODO: Implement
join: undefined, // TODO: Implement
json: undefined, // TODO: Implement
kv: undefined, // TODO: Implement
lowercase: undefined, // TODO: Implement
pipeline: undefined, // TODO: Implement
remove: undefined, // TODO: Implement
rename: undefined, // TODO: Implement
script: undefined, // TODO: Implement
set_security_user: undefined, // TODO: Implement
split: undefined, // TODO: Implement
sort: undefined, // TODO: Implement
trim: undefined, // TODO: Implement
uppercase: undefined, // TODO: Implement
urldecode: undefined, // TODO: Implement
user_agent: undefined, // TODO: Implement

gsub: undefined,
set: undefined,
interface FieldsFormDescriptor {
FieldsComponent?: FunctionComponent;
docLinkPath: string;
/**
* A sentence case label that can be displayed to users
*/
label: string;
}

const mapProcessorTypeToFormOrDocPath: Record<string, FieldsFormDescriptor> = {
jloleysens marked this conversation as resolved.
Show resolved Hide resolved
append: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/append-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.append', {
defaultMessage: 'Append',
}),
},
bytes: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/bytes-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.bytes', {
defaultMessage: 'Bytes',
}),
},
circle: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/ingest-circle-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.circle', {
defaultMessage: 'Circle',
}),
},
convert: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/convert-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.convert', {
defaultMessage: 'Convert',
}),
},
csv: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/csv-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.csv', {
defaultMessage: 'CSV',
}),
},
date: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/date-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.date', {
defaultMessage: 'Date',
}),
},
date_index_name: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/date-index-name-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.dateIndexName', {
defaultMessage: 'Date Index Name',
}),
},
dissect: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/dissect-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.dissect', {
defaultMessage: 'Dissect',
}),
},
dot_expander: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/dot-expand-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.dotExpander', {
defaultMessage: 'Dot Expander',
}),
},
drop: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/drop-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.drop', {
defaultMessage: 'Drop',
}),
},
enrich: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/enrich-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.enrich', {
defaultMessage: 'Enrich',
}),
},
fail: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/fail-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.fail', {
defaultMessage: 'Fail',
}),
},
foreach: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/foreach-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.foreach', {
defaultMessage: 'Foreach',
}),
},
geoip: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/geoip-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.geoip', {
defaultMessage: 'GeoIP',
}),
},
gsub: {
FieldsComponent: undefined,
docLinkPath: '/gsub-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.gsub', {
defaultMessage: 'Gsub',
}),
},
html_strip: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/htmlstrip-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.htmlStrip', {
defaultMessage: 'HTML Strip',
}),
},
inference: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/inference-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.inference', {
defaultMessage: 'Inference',
}),
},
join: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/join-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.join', {
defaultMessage: 'Join',
}),
},
json: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/json-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.json', {
defaultMessage: 'JSON',
}),
},
kv: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/kv-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.kv', {
defaultMessage: 'KV',
}),
},
lowercase: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/lowercase-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.lowercase', {
defaultMessage: 'Lowercase',
}),
},
pipeline: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/pipeline-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.pipeline', {
defaultMessage: 'Pipeline',
}),
},
remove: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/remove-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.remove', {
defaultMessage: 'Remove',
}),
},
rename: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/rename-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.rename', {
defaultMessage: 'Rename',
}),
},
script: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/script-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.script', {
defaultMessage: 'Script',
}),
},
set_security_user: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/ingest-node-set-security-user-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.setSecurityUser', {
defaultMessage: 'Set Security User',
}),
},
split: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/split-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.split', {
defaultMessage: 'Split',
}),
},
sort: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/sort-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.sort', {
defaultMessage: 'Sort',
}),
},
trim: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/trim-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.trim', {
defaultMessage: 'Trim',
}),
},
uppercase: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/uppercase-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.uppercase', {
defaultMessage: 'Uppercase',
}),
},
urldecode: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/urldecode-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.urldecode', {
defaultMessage: 'URL Decode',
}),
},
user_agent: {
FieldsComponent: undefined, // TODO: Implement
docLinkPath: '/user-agent-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.userAgent', {
defaultMessage: 'User Agent',
}),
},

// --- The below processor descriptors have components implemented ---
set: {
FieldsComponent: undefined,
docLinkPath: '/set-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.set', {
defaultMessage: 'Set',
}),
},
grok: {
FieldsComponent: undefined,
docLinkPath: '/grok-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.grok', {
defaultMessage: 'Grok',
}),
},
};

export const types = Object.keys(mapProcessorTypeToForm);
export const types = Object.keys(mapProcessorTypeToFormOrDocPath).sort();

export type ProcessorType = keyof typeof mapProcessorTypeToForm;
export type ProcessorType = keyof typeof mapProcessorTypeToFormOrDocPath;

export const getProcessorForm = (type: ProcessorType | string): FunctionComponent | undefined => {
return mapProcessorTypeToForm[type as ProcessorType];
export const getProcessorFormDescriptor = (
type: ProcessorType | string
): FieldsFormDescriptor | undefined => {
return mapProcessorTypeToFormOrDocPath[type as ProcessorType];
};
Loading