Skip to content

Commit e9d4aae

Browse files
committed
Add descriptions to ingest processors E-J
1 parent ba9ad8d commit e9d4aae

7 files changed

Lines changed: 75 additions & 49 deletions

File tree

x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/processor_type_field.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui';
77
import { i18n } from '@kbn/i18n';
8-
import React, { FunctionComponent } from 'react';
8+
import React, { FunctionComponent, ReactNode } from 'react';
99
import { flow } from 'fp-ts/lib/function';
1010
import { map } from 'fp-ts/lib/Array';
1111

@@ -68,13 +68,18 @@ export const ProcessorTypeField: FunctionComponent<Props> = ({ initialType }) =>
6868
<UseField<string> config={typeConfig} defaultValue={initialType} path="type">
6969
{(typeField) => {
7070
let selectedOptions: ProcessorTypeAndLabel[];
71+
let description: string | ReactNode = '';
72+
7173
if (typeField.value?.length) {
7274
const type = typeField.value;
73-
const descriptor = getProcessorDescriptor(type);
74-
selectedOptions = descriptor
75-
? [{ label: descriptor.label, value: type }]
76-
: // If there is no label for this processor type, just use the type as the label
77-
[{ label: type, value: type }];
75+
const processorDescriptor = getProcessorDescriptor(type);
76+
if (processorDescriptor) {
77+
description = processorDescriptor.description || '';
78+
selectedOptions = [{ label: processorDescriptor.label, value: type }];
79+
} else {
80+
// If there is no label for this processor type, just use the type as the label
81+
selectedOptions = [{ label: type, value: type }];
82+
}
7883
} else {
7984
selectedOptions = [];
8085
}
@@ -102,9 +107,7 @@ export const ProcessorTypeField: FunctionComponent<Props> = ({ initialType }) =>
102107
<EuiFormRow
103108
label={typeField.label}
104109
labelAppend={typeField.labelAppend}
105-
helpText={
106-
typeof typeField.helpText === 'function' ? typeField.helpText() : typeField.helpText
107-
}
110+
helpText={typeof description === 'function' ? description() : description}
108111
error={error}
109112
isInvalid={isInvalid}
110113
fullWidth

x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ const fieldsConfig: FieldsConfig = {
2121
helpText: i18n.translate(
2222
'xpack.ingestPipelines.pipelineEditor.commonFields.targetFieldHelpText',
2323
{
24-
defaultMessage:
25-
'The field to assign the joined value to. If empty, the field is updated in-place.',
24+
defaultMessage: 'Output field. If empty, the input field is updated in place.',
2625
}
2726
),
2827
},

x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,7 @@ export const Gsub: FunctionComponent = () => {
8787

8888
<UseField config={fieldsConfig.replacement} component={Field} path="fields.replacement" />
8989

90-
<TargetField
91-
helpText={
92-
<FormattedMessage
93-
id="xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldHelpText"
94-
defaultMessage="Field used to contain updated text. Defaults to {field}."
95-
values={{
96-
field: <EuiCode>{'field'}</EuiCode>,
97-
}}
98-
/>
99-
}
100-
/>
90+
<TargetField />
10191

10292
<IgnoreMissingField />
10393
</>

x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,7 @@ export const HtmlStrip: FunctionComponent = () => {
2323
)}
2424
/>
2525

26-
<TargetField
27-
helpText={
28-
<FormattedMessage
29-
id="xpack.ingestPipelines.pipelineEditor.htmlStripForm.targetFieldHelpText"
30-
defaultMessage="Field used to contain stripped text. Defaults to {field}."
31-
values={{ field: <EuiCode>{'field'}</EuiCode> }}
32-
/>
33-
}
34-
/>
26+
<TargetField />
3527

3628
<IgnoreMissingField />
3729
</>

x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,7 @@ export const Join: FunctionComponent = () => {
5555

5656
<UseField config={fieldsConfig.separator} component={Field} path="fields.separator" />
5757

58-
<TargetField
59-
helpText={
60-
<FormattedMessage
61-
id="xpack.ingestPipelines.pipelineEditor.joinForm.targetFieldHelpText"
62-
defaultMessage="Field used to contain the joined value. Defaults to {field}."
63-
values={{
64-
field: <EuiCode>{'field'}</EuiCode>,
65-
}}
66-
/>
67-
}
68-
/>
58+
<TargetField />
6959
</>
7060
);
7161
};

x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ export const Json: FunctionComponent = () => {
6565
)}
6666
/>
6767

68-
<TargetField
69-
helpText={i18n.translate(
70-
'xpack.ingestPipelines.pipelineEditor.jsonForm.targetFieldHelpText',
71-
{ defaultMessage: 'Field used to contain the JSON object.' }
72-
)}
73-
/>
68+
<TargetField />
7469

7570
<UseField
7671
config={fieldsConfig.add_to_root}

x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
*/
66

77
import { i18n } from '@kbn/i18n';
8-
import { FunctionComponent } from 'react';
8+
import React, { FunctionComponent, ReactNode } from 'react';
9+
import { FormattedMessage } from '@kbn/i18n/react';
10+
import { EuiCode, EuiLink } from '@elastic/eui';
911

1012
import {
1113
Append,
@@ -40,6 +42,7 @@ interface FieldDescriptor {
4042
* A sentence case label that can be displayed to users
4143
*/
4244
label: string;
45+
description?: string | ReactNode;
4346
}
4447

4548
type MapProcessorTypeToDescriptor = Record<string, FieldDescriptor>;
@@ -121,69 +124,123 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = {
121124
label: i18n.translate('xpack.ingestPipelines.processors.label.enrich', {
122125
defaultMessage: 'Enrich',
123126
}),
127+
description: () => (
128+
<FormattedMessage
129+
id="xpack.ingestPipelines.processors.description.enrich"
130+
defaultMessage="Adds enrich data to incoming documents based on an {enrichPolicyLink}."
131+
values={{
132+
enrichPolicyLink: (
133+
<EuiLink external target="_blank" href={esDocUrl + '/ingest-enriching-data.html'}>
134+
{'enrich policy'}
135+
</EuiLink>
136+
),
137+
}}
138+
/>
139+
),
124140
},
125141
fail: {
126142
FieldsComponent: Fail,
127143
docLinkPath: '/fail-processor.html',
128144
label: i18n.translate('xpack.ingestPipelines.processors.label.fail', {
129145
defaultMessage: 'Fail',
130146
}),
147+
description: i18n.translate('xpack.ingestPipelines.processors.description.fail', {
148+
defaultMessage:
149+
'Returns a custom error message on failure. Often used to notify requesters of required conditions.',
150+
}),
131151
},
132152
foreach: {
133153
FieldsComponent: Foreach,
134154
docLinkPath: '/foreach-processor.html',
135155
label: i18n.translate('xpack.ingestPipelines.processors.label.foreach', {
136156
defaultMessage: 'Foreach',
137157
}),
158+
description: i18n.translate('xpack.ingestPipelines.processors.description.foreach', {
159+
defaultMessage: 'Applies an ingest processor to each value in an array.',
160+
}),
138161
},
139162
geoip: {
140163
FieldsComponent: GeoIP,
141164
docLinkPath: '/geoip-processor.html',
142165
label: i18n.translate('xpack.ingestPipelines.processors.label.geoip', {
143166
defaultMessage: 'GeoIP',
144167
}),
168+
description: i18n.translate('xpack.ingestPipelines.processors.description.geoip', {
169+
defaultMessage:
170+
'Adds geo data based on an IP address. Uses geo data from a Maxmind database file.',
171+
}),
145172
},
146173
grok: {
147174
FieldsComponent: Grok,
148175
docLinkPath: '/grok-processor.html',
149176
label: i18n.translate('xpack.ingestPipelines.processors.label.grok', {
150177
defaultMessage: 'Grok',
151178
}),
179+
description: () => (
180+
<FormattedMessage
181+
id="xpack.ingestPipelines.processors.description.grok"
182+
defaultMessage="Uses {grokLink} expressions to extract matches from a field.."
183+
values={{
184+
grokLink: (
185+
<EuiLink external target="_blank" href={esDocUrl + '/grok-processor.html'}>
186+
{'grok'}
187+
</EuiLink>
188+
),
189+
}}
190+
/>
191+
),
152192
},
153193
gsub: {
154194
FieldsComponent: Gsub,
155195
docLinkPath: '/gsub-processor.html',
156196
label: i18n.translate('xpack.ingestPipelines.processors.label.gsub', {
157197
defaultMessage: 'Gsub',
158198
}),
199+
description: i18n.translate('xpack.ingestPipelines.processors.description.gsub', {
200+
defaultMessage: 'Uses a regular expression to replace field substrings.',
201+
}),
159202
},
160203
html_strip: {
161204
FieldsComponent: HtmlStrip,
162205
docLinkPath: '/htmlstrip-processor.html',
163206
label: i18n.translate('xpack.ingestPipelines.processors.label.htmlStrip', {
164207
defaultMessage: 'HTML strip',
165208
}),
209+
description: i18n.translate('xpack.ingestPipelines.processors.description.htmlStrip', {
210+
defaultMessage: 'Removes HTML tags from a field.',
211+
}),
166212
},
167213
inference: {
168214
FieldsComponent: Inference,
169215
docLinkPath: '/inference-processor.html',
170216
label: i18n.translate('xpack.ingestPipelines.processors.label.inference', {
171217
defaultMessage: 'Inference',
172218
}),
219+
description: i18n.translate('xpack.ingestPipelines.processors.description.inference', {
220+
defaultMessage:
221+
'Uses a pre-trained data frame analytics model to infer against incoming data.',
222+
}),
173223
},
174224
join: {
175225
FieldsComponent: Join,
176226
docLinkPath: '/join-processor.html',
177227
label: i18n.translate('xpack.ingestPipelines.processors.label.join', {
178228
defaultMessage: 'Join',
179229
}),
230+
description: i18n.translate('xpack.ingestPipelines.processors.description.join', {
231+
defaultMessage:
232+
'Joins array elements into a string. Inserts a separator between each element.',
233+
}),
180234
},
181235
json: {
182236
FieldsComponent: Json,
183237
docLinkPath: '/json-processor.html',
184238
label: i18n.translate('xpack.ingestPipelines.processors.label.json', {
185239
defaultMessage: 'JSON',
186240
}),
241+
description: i18n.translate('xpack.ingestPipelines.processors.description.json', {
242+
defaultMessage: 'Creates a JSON object from a compatible string.',
243+
}),
187244
},
188245
kv: {
189246
FieldsComponent: undefined, // TODO: Implement

0 commit comments

Comments
 (0)