Skip to content

Commit

Permalink
address copy feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Aug 20, 2020
1 parent 70cc6f7 commit 1ad0f2e
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { FunctionComponent } from 'react';
import { EuiHorizontalRule, EuiSpacer } from '@elastic/eui';
import { EuiHorizontalRule } from '@elastic/eui';

import { FormDataProvider } from '../../../../../shared_imports';
import { ProcessorInternal } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,6 @@ const targetFieldValidator: ValidationConfig = {
),
};

const getEnrichPolicyNameFieldHelpText = (esDocUrl: string) => {
return (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText"
defaultMessage="Name of the {enrichPolicyLink}."
values={{
enrichPolicyLink: (
<EuiLink external target="_blank" href={esDocUrl + '/ingest-enriching-data.html'}>
{i18n.translate(
'xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText.enrichPolicyLink',
{ defaultMessage: 'enrich policy' }
)}
</EuiLink>
),
}}
/>
);
};

const fieldsConfig: FieldsConfig = {
/* Required fields config */
policy_name: {
Expand All @@ -90,7 +71,7 @@ const fieldsConfig: FieldsConfig = {
i18n.translate(
'xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameRequiredError',
{
defaultMessage: 'A policy name value is required.',
defaultMessage: 'A value is required.',
}
)
),
Expand All @@ -110,8 +91,7 @@ const fieldsConfig: FieldsConfig = {
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.enrichForm.overrideFieldHelpText',
{
defaultMessage:
'Whether this processor will update fields with a pre-existing non-null-valued field. When set to false, such fields will not be overridden.',
defaultMessage: 'If true, the processor can overwrite pre-existing field values.',
}
),
},
Expand All @@ -125,13 +105,13 @@ const fieldsConfig: FieldsConfig = {
return n === 1 ? undefined : n;
},
label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.maxMatchesFieldLabel', {
defaultMessage: 'Max matches (optional)',
defaultMessage: 'Maximum matches (optional)',
}),
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.enrichForm.maxMatchesFieldHelpText',
{
defaultMessage:
'The maximum number of matched documents to include under the configured target field. The target_field will be turned into a json array if max_matches is higher than 1, otherwise target_field will become a json object. Accepts numbers 1 up to 128.',
'Number of matching enrich documents to include in the target field. Accepts 1–128.',
}
),
validations: [
Expand All @@ -156,13 +136,6 @@ const fieldsConfig: FieldsConfig = {
defaultMessage: 'Shape relation (optional)',
}
),
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.enrichForm.shapeRelationFieldHelpText',
{
defaultMessage:
'A spatial relation operator used to match the geo_shape of incoming documents to documents in the enrich index. This option is only used for geo_match enrich policy types.',
}
),
},
};

Expand All @@ -176,15 +149,30 @@ export const Enrich: FunctionComponent = () => {
'xpack.ingestPipelines.pipelineEditor.enrichForm.fieldNameHelpText',
{
defaultMessage:
'The field in the input document that matches the policy field used to retrieve the enrichment data.',
'Field used to match incoming documents to enrich documents. Field values are compared to the match field set in the enrich policy.',
}
)}
/>

<UseField
config={{
...fieldsConfig.policy_name,
helpText: getEnrichPolicyNameFieldHelpText(esDocUrl),
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText"
defaultMessage="Name of the {enrichPolicyLink}."
values={{
enrichPolicyLink: (
<EuiLink external target="_blank" href={esDocUrl + '/ingest-enriching-data.html'}>
{i18n.translate(
'xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText.enrichPolicyLink',
{ defaultMessage: 'enrich policy' }
)}
</EuiLink>
),
}}
/>
),
}}
component={Field}
path="fields.policy_name"
Expand All @@ -197,7 +185,7 @@ export const Enrich: FunctionComponent = () => {
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.enrichForm.targetFieldHelpText',
{
defaultMessage: 'Field added to incoming documents to contain enrich data.',
defaultMessage: 'Field used to contain enrich data.',
}
)}
validations={[targetFieldValidator]}
Expand All @@ -212,7 +200,29 @@ export const Enrich: FunctionComponent = () => {
/>

<UseField
config={fieldsConfig.shape_relation}
config={{
...fieldsConfig.shape_relation,
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.enrichForm.shapeRelationFieldHelpText"
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'}
>
{i18n.translate(
'xpack.ingestPipelines.pipelineEditor.enrichForm.shapeRelationFieldHelpText.geoMatchPoliciesLink',
{ defaultMessage: 'geo-match enrich policies' }
)}
</EuiLink>
),
}}
/>
),
}}
component={SelectField}
componentProps={{
euiFieldProps: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const fieldsConfig: FieldsConfig = {
defaultMessage: 'Message',
}),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.failForm.messageHelpText', {
defaultMessage: 'The error message thrown by the processor.',
defaultMessage: 'Error message returned by the processor.',
}),
validations: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const fieldsConfig: FieldsConfig = {
defaultMessage: 'Processor',
}),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.foreachForm.processorHelpText', {
defaultMessage: 'The processor to execute against each field value.',
defaultMessage: 'Ingest processor to run on each array value.',
}),
validations: [
{
Expand All @@ -41,7 +41,7 @@ const fieldsConfig: FieldsConfig = {
i18n.translate(
'xpack.ingestPipelines.pipelineEditor.failForm.processorInvalidJsonError',
{
defaultMessage: 'Invalid JSON.',
defaultMessage: 'Invalid JSON',
}
)
),
Expand All @@ -56,7 +56,7 @@ export const Foreach: FunctionComponent = () => {
<FieldNameField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.failForm.fieldNameHelpText',
{ defaultMessage: 'The array field.' }
{ defaultMessage: 'Field containing array values.' }
)}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ const fieldsConfig: FieldsConfig = {
helpText: (
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.geoIPForm.databaseFileHelpText"
defaultMessage="The database filename in the geoip config directory. The default value is {databaseFile}."
values={{ databaseFile: <EuiCode inline>{'GeoLite2-City.mmdb'}</EuiCode> }}
defaultMessage="GeoIP2 database file in the {ingestGeoIP} configuration directory. Defaults to {databaseFile}."
values={{
databaseFile: <EuiCode inline>{'GeoLite2-City.mmdb'}</EuiCode>,
ingestGeoIP: <EuiCode inline>{'ingest-geoip'}</EuiCode>,
}}
/>
),
},
Expand All @@ -49,7 +52,7 @@ const fieldsConfig: FieldsConfig = {
'xpack.ingestPipelines.pipelineEditor.geoIPForm.propertiesFieldHelpText',
{
defaultMessage:
'Controls what properties are added to the target field. Values depend on what is available from the database file.',
'Properties added to the target field. Valid properties depend on the database file used.',
}
),
},
Expand All @@ -62,6 +65,13 @@ const fieldsConfig: FieldsConfig = {
label: i18n.translate('xpack.ingestPipelines.pipelineEditor.geoIPForm.firstOnlyFieldLabel', {
defaultMessage: 'First only',
}),
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.geoIPForm.firstOnlyFieldHelpText',
{
defaultMessage:
'If true, the first matching geo data is used, even if the field contains an array.',
}
),
},
};

Expand All @@ -70,17 +80,16 @@ export const GeoIP: FunctionComponent = () => {
<>
<FieldNameField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.grokForm.fieldNameHelpText',
{ defaultMessage: 'The array field.' }
'xpack.ingestPipelines.pipelineEditor.geoIPForm.fieldNameHelpText',
{ defaultMessage: 'Field containing an IP address for the geographical lookup.' }
)}
/>

<TargetField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.geoIPForm.targetFieldHelpText',
{
defaultMessage:
'The field that will hold the geographical information looked up from the Maxmind database.',
defaultMessage: 'Field used to contain geo data properties',
}
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ const fieldsConfig: FieldsConfig = {
}),
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.grokForm.patternsHelpText', {
defaultMessage:
'An ordered list of grok expressions to match and extract named captures with. Returns on the first expression in the list that matches.',
'Grok expressions used to match and extract named capture groups. Uses the first matching expression.',
}),
validations: [
{
validator: emptyField(
i18n.translate(
'xpack.ingestPipelines.pipelineEditor.grokForm.patternsValueRequiredError',
{ defaultMessage: 'A value for patterns is required.' }
{ defaultMessage: 'A value is required.' }
)
),
},
Expand Down Expand Up @@ -87,35 +87,10 @@ const fieldsConfig: FieldsConfig = {
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.grokForm.traceMatchFieldHelpText',
{
defaultMessage: 'Whether to insert pattern match metadata.',
defaultMessage: 'If true, include metadata about the matching expression in the document.',
}
),
},

properties: {
type: FIELD_TYPES.COMBO_BOX,
deserializer: to.arrayOfStrings,
label: i18n.translate('xpack.ingestPipelines.pipelineEditor.grokForm.propertiesFieldLabel', {
defaultMessage: 'Properties (optional)',
}),
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.grokForm.propertiesFieldHelpText',
{
defaultMessage:
'Controls what properties are added to the target field. Values depend on what is available from the database file.',
}
),
},

first_only: {
type: FIELD_TYPES.TOGGLE,
defaultValue: true,
deserializer: to.booleanOrUndef,
serializer: from.defaultBoolToUndef(true),
label: i18n.translate('xpack.ingestPipelines.pipelineEditor.grokForm.firstOnlyFieldLabel', {
defaultMessage: 'First only',
}),
},
};

export const Grok: FunctionComponent = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

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

import { FIELD_TYPES, fieldValidators, UseField, Field } from '../../../../../../shared_imports';

Expand All @@ -27,13 +29,13 @@ const fieldsConfig: FieldsConfig = {
}),
deserializer: String,
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.patternFieldHelpText', {
defaultMessage: 'The pattern to be replaced.',
defaultMessage: 'Regular expression used to match text.',
}),
validations: [
{
validator: emptyField(
i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.patternRequiredError', {
defaultMessage: 'A pattern value is required.',
defaultMessage: 'A value is required.',
})
),
},
Expand All @@ -47,13 +49,13 @@ const fieldsConfig: FieldsConfig = {
}),
helpText: i18n.translate(
'xpack.ingestPipelines.pipelineEditor.gsubForm.replacementFieldHelpText',
{ defaultMessage: 'The string to replace the matching patterns with.' }
{ defaultMessage: 'Replacement text for matches.' }
),
validations: [
{
validator: emptyField(
i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.replacementRequiredError', {
defaultMessage: 'A replacement value is required.',
defaultMessage: 'A value is required.',
})
),
},
Expand All @@ -67,7 +69,7 @@ export const Gsub: FunctionComponent = () => {
<FieldNameField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.gsubForm.fieldNameHelpText',
{ defaultMessage: 'The field to apply the replacement to.' }
{ defaultMessage: 'Field to search for matches.' }
)}
/>

Expand All @@ -86,12 +88,15 @@ export const Gsub: FunctionComponent = () => {
<UseField config={fieldsConfig.replacement} component={Field} path="fields.replacement" />

<TargetField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldHelpText',
{
defaultMessage: 'The field to assign the converted value to.',
}
)}
helpText={
<FormattedMessage
id="xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldHelpText"
defaultMessage="Field used to contain updated text. Defaults to {field}."
values={{
field: <EuiCode>{'field'}</EuiCode>,
}}
/>
}
/>

<IgnoreMissingField />
Expand Down
Loading

0 comments on commit 1ad0f2e

Please sign in to comment.