Skip to content

Commit

Permalink
[Ingest Pipelines] Add descriptions for ingest processors A-D (#75975)
Browse files Browse the repository at this point in the history
* Fixing formatting issues identified by Prettier, part 2.

* Fixing helpText labels.

* Adding {value} object for dissect processor.

* Incorporating reviewer feedback.

* fix dropdown not rendering

* Fixing typo.

* add support for FormattedMessage in help text

* fix TS

* Updating some strings and trying to add code formatting.

* fix formatted message

* Editing some field descriptions.

* Apply suggestions from code review

Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>

* Trying to add EuiLink, plus edits.

* fix help text for dissect processor

* Incorporating reviewer feedback.

* Trying to add another EUI element, plus edits.

* fix date_index_name description text

* Minor edit.

* Fixing linter error.

* Removing FunctionComponent, which was not read and caused build errors.

Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>
  • Loading branch information
4 people authored Sep 4, 2020
1 parent db67eb0 commit 6d4e772
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ const fieldsConfig: FieldsConfig = {
defaultMessage: 'Value',
}),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.appendForm.valueFieldHelpText', {
defaultMessage: 'The value to be appended by this processor.',
defaultMessage: 'Values to append.',
}),
validations: [
{
validator: emptyField(
i18n.translate('xpack.ingestPipelines.pipelineEditor.appendForm.valueRequiredError', {
defaultMessage: 'A value to set is required.',
defaultMessage: 'A value is required.',
})
),
},
Expand All @@ -47,7 +47,7 @@ export const Append: FunctionComponent = () => {
<>
<FieldNameField
helpText={i18n.translate('xpack.ingestPipelines.pipelineEditor.appendForm.fieldHelpText', {
defaultMessage: 'The field to be appended to.',
defaultMessage: 'Field to append values to.',
})}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export const Bytes: FunctionComponent = () => {
<FieldNameField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.bytesForm.fieldNameHelpText',
{ defaultMessage: 'The field to convert.' }
{
defaultMessage:
'Field to convert. If the field contains an array, each array value is converted.',
}
)}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
*/

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

import {
FIELD_TYPES,
Expand Down Expand Up @@ -34,12 +36,15 @@ const fieldsConfig: FieldsConfig = {
defaultMessage: 'Error distance',
}
),
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.circleForm.errorDistanceHelpText',
{
defaultMessage:
'The difference between the resulting inscribed distance from center to side and the circle’s radius (measured in meters for geo_shape, unit-less for shape).',
}
helpText: () => (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.circleForm.errorDistanceHelpText"
defaultMessage="Difference between the side of the inscribed shape to the encompassing circle. Determines the accuracy of the output polygon. Measured in meters for {geo_shape}, but uses no units for {shape}."
values={{
geo_shape: <EuiCode>{'geo_shape'}</EuiCode>,
shape: <EuiCode>{'shape'}</EuiCode>,
}}
/>
),
validations: [
{
Expand All @@ -66,7 +71,7 @@ const fieldsConfig: FieldsConfig = {
}),
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.circleForm.shapeTypeFieldHelpText',
{ defaultMessage: 'Which field mapping type is to be used.' }
{ defaultMessage: 'Field mapping type to use when processing the output polygon.' }
),
validations: [
{
Expand All @@ -86,7 +91,7 @@ export const Circle: FunctionComponent = () => {
<FieldNameField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.circleForm.fieldNameHelpText',
{ defaultMessage: 'The string-valued field to trim whitespace from.' }
{ defaultMessage: 'Field to convert.' }
)}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ifConfig: FieldConfig = {
defaultMessage: 'Condition (optional)',
}),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.commonFields.ifFieldHelpText', {
defaultMessage: 'Conditionally execute this processor.',
defaultMessage: 'Conditionally run this processor.',
}),
type: FIELD_TYPES.TEXT,
};
Expand All @@ -50,7 +50,7 @@ const tagConfig: FieldConfig = {
defaultMessage: 'Tag (optional)',
}),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.commonFields.tagFieldHelpText', {
defaultMessage: 'An identifier for this processor. Useful for debugging and metrics.',
defaultMessage: 'Identifier for the processor. Useful for debugging and metrics.',
}),
type: FIELD_TYPES.TEXT,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import { EuiComboBox, EuiComboBoxOptionOption, EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React, { FunctionComponent } from 'react';
import React, { FunctionComponent, ReactNode } from 'react';
import { flow } from 'fp-ts/lib/function';
import { map } from 'fp-ts/lib/Array';

Expand Down Expand Up @@ -68,13 +68,18 @@ export const ProcessorTypeField: FunctionComponent<Props> = ({ initialType }) =>
<UseField<string> config={typeConfig} defaultValue={initialType} path="type">
{(typeField) => {
let selectedOptions: ProcessorTypeAndLabel[];
let description: string | ReactNode = '';

if (typeField.value?.length) {
const type = typeField.value;
const descriptor = getProcessorDescriptor(type);
selectedOptions = descriptor
? [{ label: descriptor.label, value: type }]
: // If there is no label for this processor type, just use the type as the label
[{ label: type, value: type }];
const processorDescriptor = getProcessorDescriptor(type);
if (processorDescriptor) {
description = processorDescriptor.description || '';
selectedOptions = [{ label: processorDescriptor.label, value: type }];
} else {
// If there is no label for this processor type, just use the type as the label
selectedOptions = [{ label: type, value: type }];
}
} else {
selectedOptions = [];
}
Expand Down Expand Up @@ -102,9 +107,7 @@ export const ProcessorTypeField: FunctionComponent<Props> = ({ initialType }) =>
<EuiFormRow
label={typeField.label}
labelAppend={typeField.labelAppend}
helpText={
typeof typeField.helpText === 'function' ? typeField.helpText() : typeField.helpText
}
helpText={typeof description === 'function' ? description() : description}
error={error}
isInvalid={isInvalid}
fullWidth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const fieldsConfig: FieldsConfig = {
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.commonFields.targetFieldHelpText',
{
defaultMessage: 'Field to assign the value to. If empty, the field is updated in-place.',
defaultMessage: 'Output field. If empty, the input field is updated in place.',
}
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const fieldsConfig: FieldsConfig = {
defaultMessage: 'Type',
}),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.convertForm.typeFieldHelpText', {
defaultMessage: 'The type to convert the existing value to.',
defaultMessage: 'Field data type for the output.',
}),
validations: [
{
Expand All @@ -50,7 +50,7 @@ export const Convert: FunctionComponent = () => {
<FieldNameField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.convertForm.fieldNameHelpText',
{ defaultMessage: 'The field whose value is to be converted.' }
{ defaultMessage: 'Field to convert.' }
)}
/>

Expand Down Expand Up @@ -115,14 +115,7 @@ export const Convert: FunctionComponent = () => {
path="fields.type"
/>

<TargetField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.convertForm.targetFieldHelpText',
{
defaultMessage: 'The field to assign the converted value to.',
}
)}
/>
<TargetField />

<IgnoreMissingField />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const isStringLengthOne: ValidationFunc = ({ value }) => {
message: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.convertForm.separatorLengthError',
{
defaultMessage: 'A separator value must be 1 character.',
defaultMessage: 'Must be a single character.',
}
),
}
Expand All @@ -52,7 +52,7 @@ const fieldsConfig: FieldsConfig = {
defaultMessage: 'Target fields',
}),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.csvForm.targetFieldsHelpText', {
defaultMessage: 'The array of fields to assign extracted values to.',
defaultMessage: 'Output fields. Extracted values are mapped to these fields.',
}),
validations: [
{
Expand Down Expand Up @@ -83,7 +83,7 @@ const fieldsConfig: FieldsConfig = {
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.convertForm.separatorHelpText"
defaultMessage="Separator used in CSV, has to be single character string. Default value is {value}."
defaultMessage="Delimiter used in the CSV data. Defaults to {value}."
values={{ value: <EuiCode inline>{','}</EuiCode> }}
/>
),
Expand All @@ -102,7 +102,7 @@ const fieldsConfig: FieldsConfig = {
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.convertForm.quoteHelpText"
defaultMessage="Quote used in CSV, has to be single character string. Default value is {value}."
defaultMessage="Escape character used in the CSV data. Defaults to {value}."
values={{ value: <EuiCode inline>{'"'}</EuiCode> }}
/>
),
Expand All @@ -115,7 +115,7 @@ const fieldsConfig: FieldsConfig = {
defaultMessage: 'Trim',
}),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.csvForm.trimFieldHelpText', {
defaultMessage: 'Trim whitespaces in unquoted fields',
defaultMessage: 'Remove whitespaces in unquoted CSV data.',
}),
},
empty_value: {
Expand All @@ -127,7 +127,7 @@ const fieldsConfig: FieldsConfig = {
'xpack.ingestPipelines.pipelineEditor.convertForm.emptyValueFieldHelpText',
{
defaultMessage:
'Value used to fill empty fields, empty fields will be skipped if this is not provided.',
'Used to fill empty fields. If no value is provided, empty fields are skipped.',
}
),
},
Expand All @@ -138,7 +138,7 @@ export const CSV: FunctionComponent = () => {
<>
<FieldNameField
helpText={i18n.translate('xpack.ingestPipelines.pipelineEditor.csvForm.fieldNameHelpText', {
defaultMessage: 'The field to extract data from.',
defaultMessage: 'Field containing CSV data.',
})}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const fieldsConfig: FieldsConfig = {
}),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.dateForm.formatsFieldHelpText', {
defaultMessage:
'An array of the expected date formats. Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N.',
'Expected date formats. Provided formats are applied sequentially. Accepts a Java time pattern, ISO8601, UNIX, UNIX_MS, or TAI64N formats.',
}),
validations: [
{
Expand All @@ -59,7 +59,7 @@ const fieldsConfig: FieldsConfig = {
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.dateForm.timezoneHelpText"
defaultMessage="The timezone to use when parsing the date. Default value is {timezone}."
defaultMessage="Timezone for the date. Defaults to {timezone}."
values={{ timezone: <EuiCode inline>{'UTC'}</EuiCode> }}
/>
),
Expand All @@ -73,7 +73,7 @@ const fieldsConfig: FieldsConfig = {
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.dateForm.localeHelpText"
defaultMessage="The locale to use when parsing the date, relevant when parsing month names or week days. Default value is {timezone}."
defaultMessage="Locale for the date. Useful when parsing month or day names. Defaults to {timezone}."
values={{ timezone: <EuiCode inline>{'ENGLISH'}</EuiCode> }}
/>
),
Expand All @@ -89,7 +89,7 @@ export const DateProcessor: FunctionComponent = () => {
<FieldNameField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.dateForm.fieldNameHelpText',
{ defaultMessage: 'The field to get the date from.' }
{ defaultMessage: 'Field to convert.' }
)}
/>

Expand All @@ -99,7 +99,7 @@ export const DateProcessor: FunctionComponent = () => {
helpText={
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.dateForm.targetFieldHelpText"
defaultMessage="The field that will hold the parsed date. Default field is {defaultField}."
defaultMessage="Output field. If empty, the input field is updated in place. Defaults to {defaultField}."
values={{
defaultField: <EuiCode inline>{'@timestamp'}</EuiCode>,
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ const fieldsConfig: FieldsConfig = {
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.dateIndexNameForm.dateRoundingFieldHelpText',
{
defaultMessage: 'How to round the date when formatting the date into the index name.',
defaultMessage:
'Time period used to round the date when formatting the date into the index name.',
}
),
validations: [
Expand Down Expand Up @@ -64,7 +65,7 @@ const fieldsConfig: FieldsConfig = {
),
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.dateIndexNameForm.indexNamePrefixFieldHelpText',
{ defaultMessage: 'A prefix of the index name to be prepended before the printed date.' }
{ defaultMessage: 'Prefix to add before the printed date in the index name.' }
),
},
index_name_format: {
Expand All @@ -79,7 +80,7 @@ const fieldsConfig: FieldsConfig = {
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.dateIndexNameForm.indexNameFormatFieldHelpText"
defaultMessage="The format to be used when printing the parsed date into the index name. Default value is {value}."
defaultMessage="Date format used to print the parsed date into the index name. Defaults to {value}."
values={{ value: <EuiCode inline>{'yyyy-MM-dd'}</EuiCode> }}
/>
),
Expand All @@ -99,7 +100,7 @@ const fieldsConfig: FieldsConfig = {
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.dateIndexNameForm.dateFormatsHelpText"
defaultMessage="An array of the expected date formats for parsing dates / timestamps in the document being preprocessed. Can be a java time pattern or one of the following formats: ISO8601, UNIX, UNIX_MS, or TAI64N. Default value is {value}."
defaultMessage="Expected date formats. Provided formats are applied sequentially. Accepts a Java time pattern, ISO8601, UNIX, UNIX_MS, or TAI64N formats. Defaults to {value}."
values={{ value: <EuiCode inline>{"yyyy-MM-dd'T'HH:mm:ss.SSSXX"}</EuiCode> }}
/>
),
Expand All @@ -116,7 +117,7 @@ const fieldsConfig: FieldsConfig = {
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.dateIndexNameForm.timezoneHelpText"
defaultMessage="The timezone to use when parsing the date and when date math index supports resolves expressions into concrete index names. Default value is {timezone}."
defaultMessage="Timezone used when parsing the date and constructing the index name expression. Defaults to {timezone}."
values={{ timezone: <EuiCode inline>{'UTC'}</EuiCode> }}
/>
),
Expand All @@ -133,7 +134,7 @@ const fieldsConfig: FieldsConfig = {
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.dateIndexForm.localeHelpText"
defaultMessage="The locale to use when parsing the date from the document being preprocessed, relevant when parsing month names or week days. Default value is {locale}."
defaultMessage="Locale to use when parsing the date. Useful when parsing month or day names. Defaults to {locale}."
values={{ locale: <EuiCode inline>{'ENGLISH'}</EuiCode> }}
/>
),
Expand All @@ -149,7 +150,7 @@ export const DateIndexName: FunctionComponent = () => {
<FieldNameField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.dateIndexNameForm.fieldNameHelpText',
{ defaultMessage: 'The field to get the date or timestamp from.' }
{ defaultMessage: 'Field containing the date or timestamp.' }
)}
/>

Expand Down
Loading

0 comments on commit 6d4e772

Please sign in to comment.