From fa0e7952124f8eb972d391bd5a858d9da94d0c55 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 13 Aug 2020 12:16:56 +0200 Subject: [PATCH 01/21] Added the enrich processor form (big one) --- .../processors/enrich.tsx | 227 ++++++++++++++++++ .../manage_processor_form/processors/index.ts | 1 + .../shared/map_processor_type_to_form.tsx | 3 +- 3 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx new file mode 100644 index 00000000000000..1af5fc02bf9b99 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -0,0 +1,227 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { + FIELD_TYPES, + fieldValidators, + UseField, + Field, + ToggleField, + NumericField, + SelectField, +} from '../../../../../../shared_imports'; + +import { FieldNameField } from './common_fields/field_name_field'; +import { IgnoreMissingField } from './common_fields/ignore_missing_field'; +import { FieldsConfig } from './shared'; + +const { emptyField, numberSmallerThanField, numberGreaterThanField } = fieldValidators; + +const maxMatchesValidators = { + max: numberSmallerThanField({ + than: 128, + allowEquality: true, + message: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.enrichForm.maxMatchesMaxNumberError', + { defaultMessage: 'This number must be less than 128.' } + ), + }), + min: numberGreaterThanField({ + than: 0, + allowEquality: false, + message: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.enrichForm.maxMatchesMinNumberError', + { defaultMessage: 'This number must be greater than 0.' } + ), + }), +}; + +const fieldsConfig: FieldsConfig = { + policy_name: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameFieldLabel', { + defaultMessage: 'Policy name', + }), + helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText', { + defaultMessage: 'The name of the enrich policy to use.', + }), + validations: [ + { + validator: emptyField( + i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameRequiredError', + { + defaultMessage: 'A field value is required.', + } + ) + ), + }, + ], + }, + + target_field: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.targetFieldLabel', { + defaultMessage: 'Target field', + }), + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.enrichForm.targetFieldHelpText', + { + defaultMessage: 'Field added to incoming documents to contain enrich data.', + } + ), + validations: [ + { + validator: emptyField( + i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.enrichForm.targetFieldRequiredError', + { + defaultMessage: 'A target field value is required.', + } + ) + ), + }, + ], + }, + + override: { + type: FIELD_TYPES.TOGGLE, + defaultValue: true, + serializer: (v) => (v === true ? undefined : v), + deserializer: (v) => (typeof v === 'boolean' ? v : undefined), + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.overrideFieldLabel', { + defaultMessage: 'Override', + }), + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.enrichForm.overrideFieldHelpText', + { + defaultMessage: + 'Whether this processor will update fields with pre-existing non-null-valued field. When set to false, such fields will not be overridden.', + } + ), + }, + + max_matches: { + type: FIELD_TYPES.NUMBER, + defaultValue: 1, + deserializer: (v) => (typeof v === 'number' && !isNaN(v) ? v : 1), + serializer: (v) => { + const n = parseInt(v, 10); + return n === 1 ? undefined : n; + }, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.maxMatchesFieldLabel', { + defaultMessage: 'Max matches', + }), + 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', + } + ), + validations: [ + { + validator: (v) => { + if (v.value /* value is a string here */) { + return maxMatchesValidators.max(v) ?? maxMatchesValidators.min(v); + } + }, + }, + ], + }, + + shape_relation: { + type: FIELD_TYPES.SELECT, + defaultValue: 'INTERSECTS', + deserializer: String, + serializer: (v) => (v === 'INTERSECTS' ? undefined : v), + label: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.enrichForm.shapeRelationFieldLabel', + { + defaultMessage: 'Shape relation', + } + ), + 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.', + } + ), + }, +}; + +export const Enrich: FunctionComponent = () => { + return ( + <> + + + + + + + + + + + + + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts index 6996deb2d861c5..f3a054ea3e85b1 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts @@ -14,3 +14,4 @@ export { DateIndexName } from './date_index_name'; export { Dissect } from './dissect'; export { DotExpander } from './dot_expander'; export { Drop } from './drop'; +export { Enrich } from './enrich'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index 502045084b24de..aa43a98bc0b7b3 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -18,6 +18,7 @@ import { Dissect, DotExpander, Drop, + Enrich, } from '../manage_processor_form/processors'; // import { SetProcessor } from './processors/set'; @@ -106,7 +107,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }), }, enrich: { - FieldsComponent: undefined, // TODO: Implement + FieldsComponent: Enrich, docLinkPath: '/enrich-processor.html', label: i18n.translate('xpack.ingestPipelines.processors.label.enrich', { defaultMessage: 'Enrich', From 3c9ad7a3dad718cf63ee9fea7184a783f142a565 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 13 Aug 2020 12:32:47 +0200 Subject: [PATCH 02/21] added fail processor form --- .../manage_processor_form/processors/fail.tsx | 44 +++++++++++++++++++ .../manage_processor_form/processors/index.ts | 1 + .../shared/map_processor_type_to_form.tsx | 3 +- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx new file mode 100644 index 00000000000000..8d53aaa75e29bd --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx @@ -0,0 +1,44 @@ +/* + * 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 { i18n } from '@kbn/i18n'; + +import { FIELD_TYPES, fieldValidators, UseField, Field } from '../../../../../../shared_imports'; + +import { FieldsConfig } from './shared'; + +const { emptyField } = fieldValidators; + +const fieldsConfig: FieldsConfig = { + message: { + type: FIELD_TYPES.TEXT, + deserializer: String, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.failForm.messageFieldLabel', { + defaultMessage: 'Message', + }), + helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.failForm.messageHelpText', { + defaultMessage: 'The error message thrown by the processor', + }), + validations: [ + { + validator: emptyField( + i18n.translate('xpack.ingestPipelines.pipelineEditor.failForm.valueRequiredError', { + defaultMessage: 'A message is required.', + }) + ), + }, + ], + }, +}; + +export const Fail: FunctionComponent = () => { + return ( + <> + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts index f3a054ea3e85b1..c61fdef30de01e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts @@ -15,3 +15,4 @@ export { Dissect } from './dissect'; export { DotExpander } from './dot_expander'; export { Drop } from './drop'; export { Enrich } from './enrich'; +export { Fail } from './fail'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index aa43a98bc0b7b3..d967e6732c3c3b 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -19,6 +19,7 @@ import { DotExpander, Drop, Enrich, + Fail, } from '../manage_processor_form/processors'; // import { SetProcessor } from './processors/set'; @@ -114,7 +115,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }), }, fail: { - FieldsComponent: undefined, // TODO: Implement + FieldsComponent: Fail, docLinkPath: '/fail-processor.html', label: i18n.translate('xpack.ingestPipelines.processors.label.fail', { defaultMessage: 'Fail', From 9ce24cecfcaa1c09b5c00d61ed8d5f871ee78002 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 13 Aug 2020 12:54:28 +0200 Subject: [PATCH 03/21] Added foreach processor form --- .../common_fields/common_processor_fields.tsx | 2 +- .../processors/foreach.tsx | 80 +++++++++++++++++++ .../manage_processor_form/processors/index.ts | 1 + .../shared/map_processor_type_to_form.tsx | 3 +- 4 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx index 7ae7b82c31a43e..3b39ee4ed14cbe 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx @@ -62,7 +62,7 @@ export const CommonProcessorFields: FunctionComponent = () => { component={TextEditor} componentProps={{ editorProps: { - language: 'painless', + languageId: 'painless', height: 75, options: { minimap: { enabled: false } }, }, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx new file mode 100644 index 00000000000000..216822bd10a0e6 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx @@ -0,0 +1,80 @@ +/* + * 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 { i18n } from '@kbn/i18n'; + +import { FIELD_TYPES, fieldValidators, UseField } from '../../../../../../shared_imports'; + +import { XJsonEditor } from '../field_components'; + +import { FieldNameField } from './common_fields/field_name_field'; +import { FieldsConfig } from './shared'; + +const { emptyField, isJsonField } = fieldValidators; + +const fieldsConfig: FieldsConfig = { + processor: { + type: FIELD_TYPES.TEXT, + deserializer: (v) => (v ? JSON.stringify(v, null, 2) : '{}'), + serializer: JSON.parse, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.foreachForm.processorFieldLabel', { + defaultMessage: 'Processor', + }), + helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.foreachForm.processorHelpText', { + defaultMessage: 'The processor to execute against each field value.', + }), + validations: [ + { + validator: emptyField( + i18n.translate('xpack.ingestPipelines.pipelineEditor.failForm.processorRequiredError', { + defaultMessage: 'A processor is required.', + }) + ), + }, + { + validator: isJsonField( + i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.failForm.processorInvalidJsonError', + { + defaultMessage: 'Invalid JSON.', + } + ) + ), + }, + ], + }, +}; + +export const Foreach: FunctionComponent = () => { + return ( + <> + + + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts index c61fdef30de01e..9dbc4fc5d4f63e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts @@ -16,3 +16,4 @@ export { DotExpander } from './dot_expander'; export { Drop } from './drop'; export { Enrich } from './enrich'; export { Fail } from './fail'; +export { Foreach } from './foreach'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index d967e6732c3c3b..d844f18f84bc02 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -20,6 +20,7 @@ import { Drop, Enrich, Fail, + Foreach, } from '../manage_processor_form/processors'; // import { SetProcessor } from './processors/set'; @@ -122,7 +123,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }), }, foreach: { - FieldsComponent: undefined, // TODO: Implement + FieldsComponent: Foreach, docLinkPath: '/foreach-processor.html', label: i18n.translate('xpack.ingestPipelines.processors.label.foreach', { defaultMessage: 'Foreach', From 02fbb2b1b49cddbbfdd42b0049f9f729b898ef72 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 13 Aug 2020 14:56:31 +0200 Subject: [PATCH 04/21] Added geoip processor form and refactored some deserialization --- .../processors/append.tsx | 4 +- .../common_fields/common_processor_fields.tsx | 3 +- .../common_fields/ignore_missing_field.tsx | 4 +- .../manage_processor_form/processors/csv.tsx | 8 +- .../manage_processor_form/processors/date.tsx | 6 +- .../processors/date_index_name.tsx | 6 +- .../processors/enrich.tsx | 4 +- .../processors/geoip.tsx | 101 ++++++++++++++++++ .../manage_processor_form/processors/index.ts | 1 + .../processors/shared.ts | 15 ++- .../shared/map_processor_type_to_form.tsx | 3 +- 11 files changed, 132 insertions(+), 23 deletions(-) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/append.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/append.tsx index 8eb484b56bafe0..09d0981adf1c29 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/append.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/append.tsx @@ -14,7 +14,7 @@ import { ComboBoxField, } from '../../../../../../shared_imports'; -import { FieldsConfig } from './shared'; +import { FieldsConfig, to } from './shared'; import { FieldNameField } from './common_fields/field_name_field'; const { emptyField } = fieldValidators; @@ -22,7 +22,7 @@ const { emptyField } = fieldValidators; const fieldsConfig: FieldsConfig = { value: { type: FIELD_TYPES.COMBO_BOX, - deserializer: (v) => (Array.isArray(v) ? v : [String(v)]), + deserializer: to.arrayOfStrings, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.appendForm.valueFieldLabel', { defaultMessage: 'Value', }), diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx index 3b39ee4ed14cbe..5ac43bd251bc3d 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx @@ -16,11 +16,12 @@ import { } from '../../../../../../../shared_imports'; import { TextEditor } from '../../field_components'; +import { to } from '../shared'; const ignoreFailureConfig: FieldConfig = { defaultValue: false, serializer: (v) => (v === false ? undefined : v), - deserializer: (v) => (typeof v === 'boolean' ? v : undefined), + deserializer: to.booleanOrUndef, label: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.commonFields.ignoreFailureFieldLabel', { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx index 08eb0a425ef338..c5abd3dd559589 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx @@ -7,14 +7,14 @@ import React, { FunctionComponent } from 'react'; import { i18n } from '@kbn/i18n'; import { FIELD_TYPES, UseField, ToggleField } from '../../../../../../../shared_imports'; -import { FieldsConfig } from '../shared'; +import { FieldsConfig, to } from '../shared'; export const fieldsConfig: FieldsConfig = { ignore_missing: { type: FIELD_TYPES.TOGGLE, defaultValue: false, serializer: (v) => (v === false ? undefined : v), - deserializer: (v) => (typeof v === 'boolean' ? v : undefined), + deserializer: to.maybeBoolean, label: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.commonFields.ignoreMissingFieldLabel', { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/csv.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/csv.tsx index 3ac0179ca02a69..835177dd861d56 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/csv.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/csv.tsx @@ -23,7 +23,7 @@ import { FieldsConfig } from './shared'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; import { FieldNameField } from './common_fields/field_name_field'; -import { isArrayOfStrings } from './shared'; +import { to } from './shared'; const { minLengthField } = fieldValidators; @@ -47,9 +47,7 @@ const fieldsConfig: FieldsConfig = { /* Required fields config */ target_fields: { type: FIELD_TYPES.COMBO_BOX, - deserializer: (v) => { - return isArrayOfStrings(v) ? v : []; - }, + deserializer: to.arrayOfStrings, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.csvForm.targetFieldsFieldLabel', { defaultMessage: 'Target fields', }), @@ -112,7 +110,7 @@ const fieldsConfig: FieldsConfig = { trim: { type: FIELD_TYPES.TOGGLE, defaultValue: false, - deserializer: (v) => (typeof v === 'boolean' ? v : undefined), + deserializer: to.booleanOrUndef, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.csvForm.trimFieldLabel', { defaultMessage: 'Trim', }), diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx index 424e84058ac3fc..05357ba38f20e3 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx @@ -17,7 +17,7 @@ import { ComboBoxField, } from '../../../../../../shared_imports'; -import { FieldsConfig, isArrayOfStrings } from './shared'; +import { FieldsConfig, to } from './shared'; import { FieldNameField } from './common_fields/field_name_field'; const { minLengthField } = fieldValidators; @@ -26,9 +26,7 @@ const fieldsConfig: FieldsConfig = { /* Required fields config */ formats: { type: FIELD_TYPES.COMBO_BOX, - deserializer: (v) => { - return isArrayOfStrings(v) ? v : []; - }, + deserializer: to.arrayOfStrings, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.dateForm.formatsFieldLabel', { defaultMessage: 'Formats', }), diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date_index_name.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date_index_name.tsx index 387c9ff4e0b46a..2a278a251c30f0 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date_index_name.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date_index_name.tsx @@ -18,7 +18,7 @@ import { SelectField, } from '../../../../../../shared_imports'; -import { FieldsConfig, isArrayOfStrings } from './shared'; +import { FieldsConfig, to } from './shared'; import { FieldNameField } from './common_fields/field_name_field'; const { emptyField } = fieldValidators; @@ -89,9 +89,7 @@ const fieldsConfig: FieldsConfig = { serializer: (v: string[]) => { return v.length ? v : undefined; }, - deserializer: (v) => { - return isArrayOfStrings(v) ? v : []; - }, + deserializer: to.arrayOfStrings, label: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.dateIndexNameForm.dateFormatsFieldLabel', { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index 1af5fc02bf9b99..14a734c624fd62 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -18,7 +18,7 @@ import { import { FieldNameField } from './common_fields/field_name_field'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; -import { FieldsConfig } from './shared'; +import { FieldsConfig, to } from './shared'; const { emptyField, numberSmallerThanField, numberGreaterThanField } = fieldValidators; @@ -93,7 +93,7 @@ const fieldsConfig: FieldsConfig = { type: FIELD_TYPES.TOGGLE, defaultValue: true, serializer: (v) => (v === true ? undefined : v), - deserializer: (v) => (typeof v === 'boolean' ? v : undefined), + deserializer: to.booleanOrUndef, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.overrideFieldLabel', { defaultMessage: 'Override', }), diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx new file mode 100644 index 00000000000000..31951dd7828ab0 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx @@ -0,0 +1,101 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiCode } from '@elastic/eui'; + +import { + FIELD_TYPES, + UseField, + Field, + ComboBoxField, + ToggleField, +} from '../../../../../../shared_imports'; + +import { FieldNameField } from './common_fields/field_name_field'; +import { IgnoreMissingField } from './common_fields/ignore_missing_field'; +import { FieldsConfig, to } from './shared'; + +const fieldsConfig: FieldsConfig = { + target_field: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.geoIPForm.targetFieldLabel', { + defaultMessage: 'Target field (optional)', + }), + helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.geoIPForm.targetFieldHelpText', { + defaultMessage: + 'The field that will hold the geographical information looked up from the Maxmind database.', + }), + }, + database_file: { + type: FIELD_TYPES.TEXT, + serializer: (v) => (v === 'GeoLite2-City.mmdb' ? undefined : v), + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.geoIPForm.databaseFileLabel', { + defaultMessage: 'Database file (optional)', + }), + helpText: ( + {'GeoLite2-City.mmdb'} }} + /> + ), + }, + + properties: { + type: FIELD_TYPES.COMBO_BOX, + deserializer: to.arrayOfStrings, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.geoIPForm.propertiesFieldLabel', { + defaultMessage: 'Properties (optional)', + }), + helpText: i18n.translate( + '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.', + } + ), + }, + + first_only: { + type: FIELD_TYPES.TOGGLE, + defaultValue: true, + serializer: (v) => (v === true ? undefined : v), + deserializer: to.booleanOrUndef, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.geoIPForm.firstOnlyFieldLabel', { + defaultMessage: 'First only', + }), + }, +}; + +export const GeoIP: FunctionComponent = () => { + return ( + <> + + + + + + + + + + + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts index 9dbc4fc5d4f63e..e79ea3e7fff0af 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts @@ -17,3 +17,4 @@ export { Drop } from './drop'; export { Enrich } from './enrich'; export { Fail } from './fail'; export { Foreach } from './foreach'; +export { GeoIP } from './geoip'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts index a0a31dd3a8e934..c82f26b4053fde 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts @@ -6,11 +6,22 @@ import * as rt from 'io-ts'; import { isRight } from 'fp-ts/lib/Either'; -import { flow } from 'fp-ts/lib/function'; import { FieldConfig } from '../../../../../../shared_imports'; export const arrayOfStrings = rt.array(rt.string); -export const isArrayOfStrings = flow(arrayOfStrings.decode, isRight); + +export function isArrayOfStrings(v: unknown): v is string[] { + const res = arrayOfStrings.decode(v); + return isRight(res); +} + +/** + * Shared deserializer functions + */ +export const to = { + booleanOrUndef: (v: unknown): boolean | undefined => (typeof v === 'boolean' ? v : undefined), + arrayOfStrings: (v: unknown): string[] => (isArrayOfStrings(v) ? v : []), +}; export type FieldsConfig = Record; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index d844f18f84bc02..4e9d2a8cf7e0fc 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -21,6 +21,7 @@ import { Enrich, Fail, Foreach, + GeoIP, } from '../manage_processor_form/processors'; // import { SetProcessor } from './processors/set'; @@ -130,7 +131,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }), }, geoip: { - FieldsComponent: undefined, // TODO: Implement + FieldsComponent: GeoIP, docLinkPath: '/geoip-processor.html', label: i18n.translate('xpack.ingestPipelines.processors.label.geoip', { defaultMessage: 'GeoIP', From b748cd840f6770f1a3ad2623d5b3ab28690284a6 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Fri, 14 Aug 2020 12:01:18 +0200 Subject: [PATCH 05/21] added grok processor form and updated comments and some i18n ids --- .../processors/circle.tsx | 27 +-- .../processors/enrich.tsx | 6 +- .../processors/geoip.tsx | 3 +- .../manage_processor_form/processors/grok.tsx | 167 ++++++++++++++++++ .../manage_processor_form/processors/index.ts | 1 + .../shared/map_processor_type_to_form.tsx | 15 +- 6 files changed, 197 insertions(+), 22 deletions(-) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx index 3a39e597cb8dce..f727bf68e9de13 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx @@ -23,18 +23,7 @@ import { FieldNameField } from './common_fields/field_name_field'; const { emptyField } = fieldValidators; const fieldsConfig: FieldsConfig = { - target_field: { - type: FIELD_TYPES.TEXT, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.circleForm.targetFieldLabel', { - defaultMessage: 'Target field (optional)', - }), - helpText: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.circleForm.targetFieldHelpText', - { - defaultMessage: 'By default field is updated in-place.', - } - ), - }, + /* Required fields config */ error_distance: { type: FIELD_TYPES.NUMBER, deserializer: (v) => (typeof v === 'number' && !isNaN(v) ? v : 1.0), @@ -88,6 +77,20 @@ const fieldsConfig: FieldsConfig = { }, ], }, + + /* Optional fields config */ + target_field: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.circleForm.targetFieldLabel', { + defaultMessage: 'Target field (optional)', + }), + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.circleForm.targetFieldHelpText', + { + defaultMessage: 'By default field is updated in-place.', + } + ), + }, }; export const Circle: FunctionComponent = () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index 14a734c624fd62..9649a22c16d454 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -42,6 +42,7 @@ const maxMatchesValidators = { }; const fieldsConfig: FieldsConfig = { + /* Required fields config */ policy_name: { type: FIELD_TYPES.TEXT, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameFieldLabel', { @@ -89,6 +90,7 @@ const fieldsConfig: FieldsConfig = { ], }, + /* Optional fields config */ override: { type: FIELD_TYPES.TOGGLE, defaultValue: true, @@ -115,7 +117,7 @@ const fieldsConfig: FieldsConfig = { return n === 1 ? undefined : n; }, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.maxMatchesFieldLabel', { - defaultMessage: 'Max matches', + defaultMessage: 'Max matches (optional)', }), helpText: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.enrichForm.maxMatchesFieldHelpText', @@ -143,7 +145,7 @@ const fieldsConfig: FieldsConfig = { label: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.enrichForm.shapeRelationFieldLabel', { - defaultMessage: 'Shape relation', + defaultMessage: 'Shape relation (optional)', } ), helpText: i18n.translate( diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx index 31951dd7828ab0..f0ba2aa735b866 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx @@ -22,6 +22,7 @@ import { IgnoreMissingField } from './common_fields/ignore_missing_field'; import { FieldsConfig, to } from './shared'; const fieldsConfig: FieldsConfig = { + /* Optional field config */ target_field: { type: FIELD_TYPES.TEXT, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.geoIPForm.targetFieldLabel', { @@ -78,7 +79,7 @@ export const GeoIP: FunctionComponent = () => { <> diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx new file mode 100644 index 00000000000000..e43dd66aabc62f --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx @@ -0,0 +1,167 @@ +/* + * 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 { i18n } from '@kbn/i18n'; + +import { + FIELD_TYPES, + UseField, + ComboBoxField, + ToggleField, + fieldValidators, +} from '../../../../../../shared_imports'; + +import { XJsonEditor } from '../field_components'; + +import { FieldNameField } from './common_fields/field_name_field'; +import { IgnoreMissingField } from './common_fields/ignore_missing_field'; +import { FieldsConfig, to } from './shared'; + +const { emptyField, isJsonField } = fieldValidators; + +const fieldsConfig: FieldsConfig = { + /* Required field configs */ + patterns: { + type: FIELD_TYPES.COMBO_BOX, + deserializer: to.arrayOfStrings, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.grokForm.patternsFieldLabel', { + defaultMessage: 'Patterns', + }), + 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.', + }), + validations: [ + { + validator: emptyField( + i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.grokForm.patternsValueRequiredError', + { defaultMessage: 'A value for patterns is required.' } + ) + ), + }, + ], + }, + /* Optional field configs */ + pattern_definitions: { + type: FIELD_TYPES.TEXT, + deserializer: (v) => (v ? JSON.stringify(v, null, 2) : '{}'), + serializer: (v) => { + if (v) { + try { + return JSON.parse(v); + } catch (e) { + // Ignore + } + } + }, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.grokForm.patternDefinitionsLabel', { + defaultMessage: 'Pattern definitions (optional)', + }), + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.grokForm.patternDefinitionsHelpText', + { + defaultMessage: + 'A map of pattern-name and pattern tuples defining custom patterns. Patterns matching existing names will override the pre-existing definition.', + } + ), + validations: [ + { + validator: isJsonField( + i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.grokForm.patternsDefinitionsInvalidJSONError', + { defaultMessage: 'Invalid JSON' } + ), + { + allowEmptyString: true, + } + ), + }, + ], + }, + + trace_match: { + type: FIELD_TYPES.TOGGLE, + defaultValue: false, + serializer: (v) => (v === false ? undefined : v), + deserializer: to.booleanOrUndef, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.grokForm.traceMatchFieldLabel', { + defaultMessage: 'Trace match', + }), + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.grokForm.traceMatchFieldHelpText', + { + defaultMessage: 'Whether to insert pattern match metadata.', + } + ), + }, + + 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, + serializer: (v) => (v === true ? undefined : v), + deserializer: to.booleanOrUndef, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.grokForm.firstOnlyFieldLabel', { + defaultMessage: 'First only', + }), + }, +}; + +export const Grok: FunctionComponent = () => { + return ( + <> + + + + + + + + + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts index e79ea3e7fff0af..488c8c7aa72c4f 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts @@ -18,3 +18,4 @@ export { Enrich } from './enrich'; export { Fail } from './fail'; export { Foreach } from './foreach'; export { GeoIP } from './geoip'; +export { Grok } from './grok'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index 4e9d2a8cf7e0fc..f80d71fa4648d7 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -22,6 +22,7 @@ import { Fail, Foreach, GeoIP, + Grok, } from '../manage_processor_form/processors'; // import { SetProcessor } from './processors/set'; @@ -137,6 +138,13 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { defaultMessage: 'GeoIP', }), }, + grok: { + FieldsComponent: Grok, + docLinkPath: '/grok-processor.html', + label: i18n.translate('xpack.ingestPipelines.processors.label.grok', { + defaultMessage: 'Grok', + }), + }, gsub: { FieldsComponent: undefined, docLinkPath: '/gsub-processor.html', @@ -272,13 +280,6 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { defaultMessage: 'Set', }), }, - grok: { - FieldsComponent: undefined, - docLinkPath: '/grok-processor.html', - label: i18n.translate('xpack.ingestPipelines.processors.label.grok', { - defaultMessage: 'Grok', - }), - }, }; export type ProcessorType = keyof typeof mapProcessorTypeToDescriptor; From 970939c41f2f8e2a8d9ac5e9908f402d4dc8cd8e Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Fri, 14 Aug 2020 12:14:16 +0200 Subject: [PATCH 06/21] updated existing gsub processor form to be in line with other forms --- .../manage_processor_form/processors/gsub.tsx | 139 +++++++++--------- .../manage_processor_form/processors/index.ts | 1 + .../shared/map_processor_type_to_form.tsx | 3 +- 3 files changed, 70 insertions(+), 73 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx index 3148022adaa980..17517f1dab1b61 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx @@ -7,88 +7,83 @@ import React, { FunctionComponent } from 'react'; import { i18n } from '@kbn/i18n'; -import { - FieldConfig, - FIELD_TYPES, - fieldValidators, - ToggleField, - UseField, - Field, -} from '../../../../../../shared_imports'; +import { FIELD_TYPES, fieldValidators, UseField, Field } from '../../../../../../shared_imports'; + import { TextEditor } from '../field_components'; -const { emptyField } = fieldValidators; +import { FieldsConfig } from './shared'; +import { FieldNameField } from './common_fields/field_name_field'; +import { IgnoreMissingField } from './common_fields/ignore_missing_field'; -const fieldConfig: FieldConfig = { - type: FIELD_TYPES.TEXT, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.fieldFieldLabel', { - defaultMessage: 'Field', - }), - validations: [ - { - validator: emptyField( - i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.fieldRequiredError', { - defaultMessage: 'A field value is required.', - }) - ), - }, - ], -}; - -const patternConfig: FieldConfig = { - type: FIELD_TYPES.TEXT, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.patternFieldLabel', { - defaultMessage: 'Pattern', - }), - validations: [ - { - validator: emptyField( - i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.patternRequiredError', { - defaultMessage: 'A pattern value is required.', - }) - ), - }, - ], -}; +const { emptyField } = fieldValidators; -const replacementConfig: FieldConfig = { - type: FIELD_TYPES.TEXT, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.replacementFieldLabel', { - defaultMessage: 'Replacement', - }), - validations: [ - { - validator: emptyField( - i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.replacementRequiredError', { - defaultMessage: 'A replacement value is required.', - }) - ), - }, - ], -}; +const fieldsConfig: FieldsConfig = { + /* Required fields config */ + pattern: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.patternFieldLabel', { + defaultMessage: 'Pattern', + }), + deserializer: String, + helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.patternFieldHelpText', { + defaultMessage: 'The pattern to be replaced.', + }), + validations: [ + { + validator: emptyField( + i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.patternRequiredError', { + defaultMessage: 'A pattern value is required.', + }) + ), + }, + ], + }, -const targetConfig: FieldConfig = { - type: FIELD_TYPES.TEXT, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldLabel', { - defaultMessage: 'Target field (optional)', - }), -}; + replacement: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.replacementFieldLabel', { + defaultMessage: 'Replacement', + }), + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.gsubForm.replacementFieldHelpText', + { defaultMessage: 'The string to replace the matching patterns with.' } + ), + validations: [ + { + validator: emptyField( + i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.replacementRequiredError', { + defaultMessage: 'A replacement value is required.', + }) + ), + }, + ], + }, -const ignoreMissingConfig: FieldConfig = { - defaultValue: false, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.ignoreMissingFieldLabel', { - defaultMessage: 'Ignore missing', - }), - type: FIELD_TYPES.TOGGLE, + /* Optional fields config */ + target_field: { + type: FIELD_TYPES.TEXT, + deserializer: String, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldLabel', { + defaultMessage: 'Target field (optional)', + }), + helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldHelpText', { + defaultMessage: 'The field to assign the converted value to.', + }), + }, }; export const Gsub: FunctionComponent = () => { return ( <> - + { path="fields.pattern" /> - + - + - + ); }; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts index 488c8c7aa72c4f..ffb32010fcce23 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts @@ -19,3 +19,4 @@ export { Fail } from './fail'; export { Foreach } from './foreach'; export { GeoIP } from './geoip'; export { Grok } from './grok'; +export { Gsub } from './gsub'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index f80d71fa4648d7..5a9a12196fe3be 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -23,6 +23,7 @@ import { Foreach, GeoIP, Grok, + Gsub, } from '../manage_processor_form/processors'; // import { SetProcessor } from './processors/set'; @@ -146,7 +147,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }), }, gsub: { - FieldsComponent: undefined, + FieldsComponent: Gsub, docLinkPath: '/gsub-processor.html', label: i18n.translate('xpack.ingestPipelines.processors.label.gsub', { defaultMessage: 'Gsub', From 1e12a638557ccf60473600667301174979cfe70d Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Fri, 14 Aug 2020 12:21:24 +0200 Subject: [PATCH 07/21] added html_strip processor form --- .../processors/html_strip.tsx | 49 +++++++++++++++++++ .../manage_processor_form/processors/index.ts | 1 + .../shared/map_processor_type_to_form.tsx | 3 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx new file mode 100644 index 00000000000000..311a2b10598f19 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx @@ -0,0 +1,49 @@ +/* + * 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 { i18n } from '@kbn/i18n'; + +import { FIELD_TYPES, UseField, Field } from '../../../../../../shared_imports'; + +import { FieldsConfig } from './shared'; +import { FieldNameField } from './common_fields/field_name_field'; +import { IgnoreMissingField } from './common_fields/ignore_missing_field'; + +const fieldsConfig: FieldsConfig = { + /* Optional fields config */ + target_field: { + type: FIELD_TYPES.TEXT, + deserializer: String, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.htmlStripForm.targetFieldLabel', { + defaultMessage: 'Target field (optional)', + }), + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.htmlStripForm.targetFieldHelpText', + { + defaultMessage: + 'The field to assign the stripped value to. If blank the field will be updated in-place.', + } + ), + }, +}; + +export const HtmlStrip: FunctionComponent = () => { + return ( + <> + + + + + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts index ffb32010fcce23..a3bb83dae4becb 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts @@ -20,3 +20,4 @@ export { Foreach } from './foreach'; export { GeoIP } from './geoip'; export { Grok } from './grok'; export { Gsub } from './gsub'; +export { HtmlStrip } from './html_strip'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index 5a9a12196fe3be..3637dee2ca144e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -24,6 +24,7 @@ import { GeoIP, Grok, Gsub, + HtmlStrip, } from '../manage_processor_form/processors'; // import { SetProcessor } from './processors/set'; @@ -154,7 +155,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }), }, html_strip: { - FieldsComponent: undefined, // TODO: Implement + FieldsComponent: HtmlStrip, docLinkPath: '/htmlstrip-processor.html', label: i18n.translate('xpack.ingestPipelines.processors.label.htmlStrip', { defaultMessage: 'HTML Strip', From c4d39a0c4d9d388aacecc1dd9cd5ea74e9e536b8 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Fri, 14 Aug 2020 13:11:50 +0200 Subject: [PATCH 08/21] refactored some serialize and deserialize functions and added inference processor form --- .../processors/foreach.tsx | 5 +- .../manage_processor_form/processors/grok.tsx | 14 +- .../manage_processor_form/processors/index.ts | 1 + .../processors/inference.tsx | 203 ++++++++++++++++++ .../processors/shared.ts | 41 +++- .../shared/map_processor_type_to_form.tsx | 3 +- 6 files changed, 252 insertions(+), 15 deletions(-) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx index 216822bd10a0e6..afaa9e74879b6a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx @@ -12,14 +12,15 @@ import { FIELD_TYPES, fieldValidators, UseField } from '../../../../../../shared import { XJsonEditor } from '../field_components'; import { FieldNameField } from './common_fields/field_name_field'; -import { FieldsConfig } from './shared'; +import { FieldsConfig, to } from './shared'; const { emptyField, isJsonField } = fieldValidators; const fieldsConfig: FieldsConfig = { + /* Required fields config */ processor: { type: FIELD_TYPES.TEXT, - deserializer: (v) => (v ? JSON.stringify(v, null, 2) : '{}'), + deserializer: to.jsonString, serializer: JSON.parse, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.foreachForm.processorFieldLabel', { defaultMessage: 'Processor', diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx index e43dd66aabc62f..5262df741e4f92 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx @@ -19,7 +19,7 @@ import { XJsonEditor } from '../field_components'; import { FieldNameField } from './common_fields/field_name_field'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; -import { FieldsConfig, to } from './shared'; +import { FieldsConfig, to, from } from './shared'; const { emptyField, isJsonField } = fieldValidators; @@ -49,16 +49,8 @@ const fieldsConfig: FieldsConfig = { /* Optional field configs */ pattern_definitions: { type: FIELD_TYPES.TEXT, - deserializer: (v) => (v ? JSON.stringify(v, null, 2) : '{}'), - serializer: (v) => { - if (v) { - try { - return JSON.parse(v); - } catch (e) { - // Ignore - } - } - }, + deserializer: to.jsonString, + serializer: from.optionalJson, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.grokForm.patternDefinitionsLabel', { defaultMessage: 'Pattern definitions (optional)', }), diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts index a3bb83dae4becb..81c9d7b17adbc2 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts @@ -21,3 +21,4 @@ export { GeoIP } from './geoip'; export { Grok } from './grok'; export { Gsub } from './gsub'; export { HtmlStrip } from './html_strip'; +export { Inference } from './inference'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx new file mode 100644 index 00000000000000..9326c13eed8447 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx @@ -0,0 +1,203 @@ +/* + * 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 { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiCode, EuiLink } from '@elastic/eui'; + +import { + FIELD_TYPES, + fieldValidators, + UseField, + Field, + useKibana, +} from '../../../../../../shared_imports'; + +import { XJsonEditor } from '../field_components'; + +import { FieldsConfig, to, from } from './shared'; + +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' } + ), + }, +}; + +const getInferenceConfigHelpText = (esDocsBasePath: string): React.ReactNode => { + return ( + + {INFERENCE_CONFIG_DOCS.regression.linkLabel} + + ), + classification: ( + + {INFERENCE_CONFIG_DOCS.classification.linkLabel} + + ), + }} + /> + ); +}; + +const fieldsConfig: FieldsConfig = { + /* Required fields config */ + model_id: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.inferenceForm.modelIDFieldLabel', { + defaultMessage: 'Model ID', + }), + deserializer: String, + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.inferenceForm.modelIDFieldHelpText', + { + defaultMessage: 'The ID of the model to load and infer against.', + } + ), + validations: [ + { + validator: emptyField( + i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.patternRequiredError', { + defaultMessage: 'A model ID value is required.', + }) + ), + }, + ], + }, + + /* Optional fields config */ + target_field: { + type: FIELD_TYPES.TEXT, + deserializer: String, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldLabel', { + defaultMessage: 'Target field (optional)', + }), + helpText: ( + {'ml.inference.'} }} + /> + ), + }, + + field_map: { + type: FIELD_TYPES.TEXT, + deserializer: to.jsonString, + serializer: from.optionalJson, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.inferenceForm.fieldMapLabel', { + defaultMessage: 'Field map (optional)', + }), + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.inferenceForm.fieldMapHelpText', + { + defaultMessage: + 'Maps the document field names to the known field names of the model. This mapping takes precedence over any default mappings provided in the model configuration.', + } + ), + validations: [ + { + validator: isJsonField( + i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.inferenceForm.fieldMapInvalidJSONError', + { defaultMessage: 'Invalid JSON' } + ), + { + allowEmptyString: true, + } + ), + }, + ], + }, + + inference_config: { + type: FIELD_TYPES.TEXT, + deserializer: to.jsonString, + serializer: from.optionalJson, + label: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.inferenceForm.inferenceConfigLabel', + { + defaultMessage: 'Inference configuration (optional)', + } + ), + validations: [ + { + validator: isJsonField( + i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.grokForm.patternsDefinitionsInvalidJSONError', + { defaultMessage: 'Invalid JSON' } + ), + { + allowEmptyString: true, + } + ), + }, + ], + }, +}; + +export const Inference: FunctionComponent = () => { + const { services } = useKibana(); + const esDocUrl = services.documentation.getEsDocsBasePath(); + return ( + <> + + + + + + + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts index c82f26b4053fde..50b11174622406 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts @@ -17,11 +17,50 @@ export function isArrayOfStrings(v: unknown): v is string[] { } /** - * Shared deserializer functions + * Shared deserializer functions. + * + * These are intended to be used in @link{FieldsConfig} as the "deserializer". + * + * Example: + * { + * ... + * deserialize: to.booleanOrUndef, + * ... + * } + * */ export const to = { booleanOrUndef: (v: unknown): boolean | undefined => (typeof v === 'boolean' ? v : undefined), arrayOfStrings: (v: unknown): string[] => (isArrayOfStrings(v) ? v : []), + jsonString: (v: unknown) => (v ? JSON.stringify(v, null, 2) : '{}'), +}; + +/** + * Shared serializer functions. + * + * These are intended to be used in @link{FieldsConfig} as the "serializer". + * + * Example: + * { + * ... + * serializer: from.optionalJson, + * ... + * } + * + */ +export const from = { + /* Works with `to.jsonString` as deserializer. */ + optionalJson: (v: string) => { + if (v) { + try { + if (Object.keys(JSON.parse(v)).length) { + return v; + } + } catch (e) { + // Ignore + } + } + }, }; export type FieldsConfig = Record; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index 3637dee2ca144e..364d46babc8aea 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -25,6 +25,7 @@ import { Grok, Gsub, HtmlStrip, + Inference, } from '../manage_processor_form/processors'; // import { SetProcessor } from './processors/set'; @@ -162,7 +163,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }), }, inference: { - FieldsComponent: undefined, // TODO: Implement + FieldsComponent: Inference, docLinkPath: '/inference-processor.html', label: i18n.translate('xpack.ingestPipelines.processors.label.inference', { defaultMessage: 'Inference', From 32b1d46d42b13d385b2a062bbe12fc4d984f11ef Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Fri, 14 Aug 2020 14:32:43 +0200 Subject: [PATCH 09/21] fix copy-pasta mistake in inference form and add join processor form --- .../manage_processor_form/processors/index.ts | 1 + .../processors/inference.tsx | 13 ++-- .../manage_processor_form/processors/join.tsx | 71 +++++++++++++++++++ .../shared/map_processor_type_to_form.tsx | 3 +- 4 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts index 81c9d7b17adbc2..dd70f657a409a7 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts @@ -22,3 +22,4 @@ export { Grok } from './grok'; export { Gsub } from './gsub'; export { HtmlStrip } from './html_strip'; export { Inference } from './inference'; +export { Join } from './join'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx index 9326c13eed8447..1cffb3e4b9bcab 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx @@ -84,9 +84,12 @@ const fieldsConfig: FieldsConfig = { validations: [ { validator: emptyField( - i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.patternRequiredError', { - defaultMessage: 'A model ID value is required.', - }) + i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.inferenceForm.patternRequiredError', + { + defaultMessage: 'A model ID value is required.', + } + ) ), }, ], @@ -96,12 +99,12 @@ const fieldsConfig: FieldsConfig = { target_field: { type: FIELD_TYPES.TEXT, deserializer: String, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldLabel', { + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.inferenceForm.targetFieldLabel', { defaultMessage: 'Target field (optional)', }), helpText: ( {'ml.inference.'} }} /> diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx new file mode 100644 index 00000000000000..91b3193ea17bc0 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx @@ -0,0 +1,71 @@ +/* + * 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 { i18n } from '@kbn/i18n'; + +import { FIELD_TYPES, fieldValidators, UseField, Field } from '../../../../../../shared_imports'; + +import { FieldsConfig } from './shared'; +import { FieldNameField } from './common_fields/field_name_field'; + +const { emptyField } = fieldValidators; + +const fieldsConfig: FieldsConfig = { + /* Required fields config */ + separator: { + type: FIELD_TYPES.TEXT, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.joinForm.separatorFieldLabel', { + defaultMessage: 'Separator', + }), + deserializer: String, + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.joinForm.separatorFieldHelpText', + { + defaultMessage: 'The separator character', + } + ), + validations: [ + { + validator: emptyField( + i18n.translate('xpack.ingestPipelines.pipelineEditor.joinForm.separatorRequiredError', { + defaultMessage: 'A separator value is required.', + }) + ), + }, + ], + }, + + /* Optional fields config */ + target_field: { + type: FIELD_TYPES.TEXT, + deserializer: String, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.joinForm.targetFieldLabel', { + defaultMessage: 'Target field (optional)', + }), + helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.joinForm.targetFieldHelpText', { + defaultMessage: + 'The field to assign the joined value to. If empty, the field is updated in-place.', + }), + }, +}; + +export const Join: FunctionComponent = () => { + return ( + <> + + + + + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index 364d46babc8aea..1d8775305c2823 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -26,6 +26,7 @@ import { Gsub, HtmlStrip, Inference, + Join, } from '../manage_processor_form/processors'; // import { SetProcessor } from './processors/set'; @@ -170,7 +171,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }), }, join: { - FieldsComponent: undefined, // TODO: Implement + FieldsComponent: Join, docLinkPath: '/join-processor.html', label: i18n.translate('xpack.ingestPipelines.processors.label.join', { defaultMessage: 'Join', From 13f37b49fb96445cdbe10e3c668b2295bf859074 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Fri, 14 Aug 2020 15:56:39 +0200 Subject: [PATCH 10/21] Added JSON processor field - Also factored out target_field field to common field (still have to update the all instances) - Built out special logic for handling add_to_root and target_field combo on JSON processor form - Created another serializer, for default boolean -> undefined. --- .../common_fields/common_processor_fields.tsx | 4 +- .../common_fields/ignore_missing_field.tsx | 6 +- .../processors/common_fields/target_field.tsx | 44 ++++++++++ .../processors/enrich.tsx | 4 +- .../processors/geoip.tsx | 4 +- .../manage_processor_form/processors/grok.tsx | 4 +- .../manage_processor_form/processors/index.ts | 1 + .../manage_processor_form/processors/json.tsx | 83 +++++++++++++++++++ .../processors/shared.ts | 1 + .../shared/map_processor_type_to_form.tsx | 3 +- 10 files changed, 142 insertions(+), 12 deletions(-) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx index 5ac43bd251bc3d..8089b8e7dfad34 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/common_processor_fields.tsx @@ -16,12 +16,12 @@ import { } from '../../../../../../../shared_imports'; import { TextEditor } from '../../field_components'; -import { to } from '../shared'; +import { to, from } from '../shared'; const ignoreFailureConfig: FieldConfig = { defaultValue: false, - serializer: (v) => (v === false ? undefined : v), deserializer: to.booleanOrUndef, + serializer: from.defaultBoolToUndef(false), label: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.commonFields.ignoreFailureFieldLabel', { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx index c5abd3dd559589..c1c9d20664c04e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx @@ -7,14 +7,14 @@ import React, { FunctionComponent } from 'react'; import { i18n } from '@kbn/i18n'; import { FIELD_TYPES, UseField, ToggleField } from '../../../../../../../shared_imports'; -import { FieldsConfig, to } from '../shared'; +import { FieldsConfig, to, from } from '../shared'; export const fieldsConfig: FieldsConfig = { ignore_missing: { type: FIELD_TYPES.TOGGLE, defaultValue: false, - serializer: (v) => (v === false ? undefined : v), - deserializer: to.maybeBoolean, + deserializer: to.booleanOrUndef, + serializer: from.defaultBoolToUndef(false), label: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.commonFields.ignoreMissingFieldLabel', { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx new file mode 100644 index 00000000000000..8df079d6d4a225 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx @@ -0,0 +1,44 @@ +/* + * 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 { i18n } from '@kbn/i18n'; + +import { Field, FIELD_TYPES, UseField, FieldConfig } from '../../../../../../../shared_imports'; + +import { FieldsConfig } from '../shared'; + +const fieldsConfig: FieldsConfig = { + target_field: { + type: FIELD_TYPES.TEXT, + deserializer: String, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.jsonForm.targetFieldLabel', { + defaultMessage: 'Target field (optional)', + }), + helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.jsonForm.targetFieldHelpText', { + defaultMessage: + 'The field to assign the joined value to. If empty, the field is updated in-place.', + }), + }, +}; + +type Props = Partial; + +export const TARGET_FIELD_PATH = 'fields.target_field'; + +export const TargetField: FunctionComponent = (props) => { + return ( + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index 9649a22c16d454..84235d302b85c3 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -18,7 +18,7 @@ import { import { FieldNameField } from './common_fields/field_name_field'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; -import { FieldsConfig, to } from './shared'; +import { FieldsConfig, from, to } from './shared'; const { emptyField, numberSmallerThanField, numberGreaterThanField } = fieldValidators; @@ -94,8 +94,8 @@ const fieldsConfig: FieldsConfig = { override: { type: FIELD_TYPES.TOGGLE, defaultValue: true, - serializer: (v) => (v === true ? undefined : v), deserializer: to.booleanOrUndef, + serializer: from.defaultBoolToUndef, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.overrideFieldLabel', { defaultMessage: 'Override', }), diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx index f0ba2aa735b866..ce914788e7cfbc 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx @@ -19,7 +19,7 @@ import { import { FieldNameField } from './common_fields/field_name_field'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; -import { FieldsConfig, to } from './shared'; +import { FieldsConfig, from, to } from './shared'; const fieldsConfig: FieldsConfig = { /* Optional field config */ @@ -66,8 +66,8 @@ const fieldsConfig: FieldsConfig = { first_only: { type: FIELD_TYPES.TOGGLE, defaultValue: true, - serializer: (v) => (v === true ? undefined : v), deserializer: to.booleanOrUndef, + serializer: from.defaultBoolToUndef(true), label: i18n.translate('xpack.ingestPipelines.pipelineEditor.geoIPForm.firstOnlyFieldLabel', { defaultMessage: 'First only', }), diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx index 5262df741e4f92..d3565ddf4e3318 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx @@ -79,8 +79,8 @@ const fieldsConfig: FieldsConfig = { trace_match: { type: FIELD_TYPES.TOGGLE, defaultValue: false, - serializer: (v) => (v === false ? undefined : v), deserializer: to.booleanOrUndef, + serializer: from.defaultBoolToUndef(false), label: i18n.translate('xpack.ingestPipelines.pipelineEditor.grokForm.traceMatchFieldLabel', { defaultMessage: 'Trace match', }), @@ -110,8 +110,8 @@ const fieldsConfig: FieldsConfig = { first_only: { type: FIELD_TYPES.TOGGLE, defaultValue: true, - serializer: (v) => (v === true ? undefined : v), deserializer: to.booleanOrUndef, + serializer: from.defaultBoolToUndef(true), label: i18n.translate('xpack.ingestPipelines.pipelineEditor.grokForm.firstOnlyFieldLabel', { defaultMessage: 'First only', }), diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts index dd70f657a409a7..4974361bf04106 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/index.ts @@ -23,3 +23,4 @@ export { Gsub } from './gsub'; export { HtmlStrip } from './html_strip'; export { Inference } from './inference'; export { Join } from './join'; +export { Json } from './json'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx new file mode 100644 index 00000000000000..0ed7f07b232917 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx @@ -0,0 +1,83 @@ +/* + * 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, useEffect, useState } from 'react'; +import { i18n } from '@kbn/i18n'; + +import { + FIELD_TYPES, + UseField, + ToggleField, + useFormContext, +} from '../../../../../../shared_imports'; + +import { FieldsConfig, from, to } from './shared'; +import { FieldNameField } from './common_fields/field_name_field'; +import { TargetField, TARGET_FIELD_PATH } from './common_fields/target_field'; + +const ADD_TO_ROOT_FIELD_PATH = 'fields.add_to_root'; +const ADD_TO_ROOT_TARGET_FIELD_CONFLICT = 'ADD_TO_ROOT_TARGET_FIELD_CONFLICT'; + +const fieldsConfig: FieldsConfig = { + /* Optional fields config */ + add_to_root: { + type: FIELD_TYPES.TOGGLE, + defaultValue: false, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.jsonForm.addToRootFieldLabel', { + defaultMessage: 'Add to root', + }), + deserializer: to.booleanOrUndef, + serializer: from.defaultBoolToUndef(false), + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.jsonForm.addToRootFieldHelpText', + { + defaultMessage: + 'Inject the serialized JSON to the top level of the JSON document. A target field cannot be combined with this option.', + } + ), + }, +}; + +export const Json: FunctionComponent = () => { + const form = useFormContext(); + const [isAddToPathDisabled, setIsAddToPathDisabled] = useState(false); + useEffect(() => { + const subscription = form.subscribe(({ data: { raw: rawData } }) => { + const hasTargetField = !!rawData[TARGET_FIELD_PATH]; + if (hasTargetField && !isAddToPathDisabled) { + setIsAddToPathDisabled(true); + form.getFields()[ADD_TO_ROOT_FIELD_PATH].setValue(false); + } else if (!hasTargetField && isAddToPathDisabled) { + setIsAddToPathDisabled(false); + } + }); + return subscription.unsubscribe; + }, [form, isAddToPathDisabled]); + + return ( + <> + + + + + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts index 50b11174622406..9ee2bea6d4b012 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts @@ -61,6 +61,7 @@ export const from = { } } }, + defaultBoolToUndef: (defaultBool: boolean) => (v: boolean) => (v === defaultBool ? undefined : v), }; export type FieldsConfig = Record; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index 1d8775305c2823..5ad51edb9024a9 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -27,6 +27,7 @@ import { HtmlStrip, Inference, Join, + Json, } from '../manage_processor_form/processors'; // import { SetProcessor } from './processors/set'; @@ -178,7 +179,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }), }, json: { - FieldsComponent: undefined, // TODO: Implement + FieldsComponent: Json, docLinkPath: '/json-processor.html', label: i18n.translate('xpack.ingestPipelines.processors.label.json', { defaultMessage: 'JSON', From cedbd8886c875f58aeff70983cb9a9a1a6bf2e31 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Fri, 14 Aug 2020 15:58:45 +0200 Subject: [PATCH 11/21] remove unused variable --- .../components/manage_processor_form/processors/json.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx index 0ed7f07b232917..3c391084c0b53f 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx @@ -19,7 +19,6 @@ import { FieldNameField } from './common_fields/field_name_field'; import { TargetField, TARGET_FIELD_PATH } from './common_fields/target_field'; const ADD_TO_ROOT_FIELD_PATH = 'fields.add_to_root'; -const ADD_TO_ROOT_TARGET_FIELD_CONFLICT = 'ADD_TO_ROOT_TARGET_FIELD_CONFLICT'; const fieldsConfig: FieldsConfig = { /* Optional fields config */ From ac6483eb47c1cef29efaffa14cc1965af1dc7d8a Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Fri, 14 Aug 2020 16:35:53 +0200 Subject: [PATCH 12/21] Refactor to use new shared target_field component, and fix JSON serializer bug --- .../processors/bytes.tsx | 18 +------ .../processors/circle.tsx | 19 ++----- .../processors/common_fields/target_field.tsx | 1 - .../processors/convert.tsx | 24 ++++----- .../manage_processor_form/processors/date.tsx | 29 +++++------ .../processors/enrich.tsx | 49 +++++++++---------- .../processors/geoip.tsx | 21 ++++---- .../manage_processor_form/processors/gsub.tsx | 22 ++++----- .../processors/html_strip.tsx | 32 ++++-------- .../processors/inference.tsx | 31 +++++------- .../manage_processor_form/processors/join.tsx | 24 ++++----- .../processors/shared.ts | 5 +- 12 files changed, 104 insertions(+), 171 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/bytes.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/bytes.tsx index 64a501f03d454e..a76e1a6f3ce9a4 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/bytes.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/bytes.tsx @@ -7,23 +7,9 @@ import React, { FunctionComponent } from 'react'; import { i18n } from '@kbn/i18n'; -import { FIELD_TYPES, UseField, Field } from '../../../../../../shared_imports'; - -import { FieldsConfig } from './shared'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; import { FieldNameField } from './common_fields/field_name_field'; - -const fieldsConfig: FieldsConfig = { - target_field: { - type: FIELD_TYPES.TEXT, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.bytesForm.targetFieldLabel', { - defaultMessage: 'Target field (optional)', - }), - helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.bytesForm.targetFieldHelpText', { - defaultMessage: 'The field to assign the converted value to', - }), - }, -}; +import { TargetField } from './common_fields/target_field'; export const Bytes: FunctionComponent = () => { return ( @@ -35,7 +21,7 @@ export const Bytes: FunctionComponent = () => { )} /> - + diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx index f727bf68e9de13..599d2fdbfd413d 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/circle.tsx @@ -11,7 +11,6 @@ import { FIELD_TYPES, fieldValidators, UseField, - Field, SelectField, NumericField, } from '../../../../../../shared_imports'; @@ -19,6 +18,7 @@ import { import { FieldsConfig } from './shared'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; import { FieldNameField } from './common_fields/field_name_field'; +import { TargetField } from './common_fields/target_field'; const { emptyField } = fieldValidators; @@ -60,6 +60,7 @@ const fieldsConfig: FieldsConfig = { }, shape_type: { type: FIELD_TYPES.SELECT, + serializer: String, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.circleForm.shapeTypeFieldLabel', { defaultMessage: 'Shape type', }), @@ -77,20 +78,6 @@ const fieldsConfig: FieldsConfig = { }, ], }, - - /* Optional fields config */ - target_field: { - type: FIELD_TYPES.TEXT, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.circleForm.targetFieldLabel', { - defaultMessage: 'Target field (optional)', - }), - helpText: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.circleForm.targetFieldHelpText', - { - defaultMessage: 'By default field is updated in-place.', - } - ), - }, }; export const Circle: FunctionComponent = () => { @@ -135,7 +122,7 @@ export const Circle: FunctionComponent = () => { path="fields.shape_type" /> - + diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx index 8df079d6d4a225..c9d536dcb41c3f 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx @@ -34,7 +34,6 @@ export const TargetField: FunctionComponent = (props) => { { @@ -128,7 +115,14 @@ export const Convert: FunctionComponent = () => { path="fields.type" /> - + diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx index 05357ba38f20e3..7e3f8e0d7cd701 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/date.tsx @@ -19,6 +19,7 @@ import { import { FieldsConfig, to } from './shared'; import { FieldNameField } from './common_fields/field_name_field'; +import { TargetField } from './common_fields/target_field'; const { minLengthField } = fieldValidators; @@ -49,22 +50,6 @@ const fieldsConfig: FieldsConfig = { ], }, /* Optional fields config */ - target_field: { - type: FIELD_TYPES.TEXT, - serializer: (v) => (v ? undefined : v), - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.dateForm.targetFieldFieldLabel', { - defaultMessage: 'Target field (optional)', - }), - helpText: ( - {'@timestamp'}, - }} - /> - ), - }, timezone: { type: FIELD_TYPES.TEXT, serializer: (v) => (v ? v : undefined), @@ -110,7 +95,17 @@ export const DateProcessor: FunctionComponent = () => { - + {'@timestamp'}, + }} + /> + } + /> diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index 84235d302b85c3..20b0470d8fc6ba 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -14,10 +14,13 @@ import { ToggleField, NumericField, SelectField, + ValidationConfig, } from '../../../../../../shared_imports'; import { FieldNameField } from './common_fields/field_name_field'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; +import { TargetField } from './common_fields/target_field'; + import { FieldsConfig, from, to } from './shared'; const { emptyField, numberSmallerThanField, numberGreaterThanField } = fieldValidators; @@ -41,6 +44,14 @@ const maxMatchesValidators = { }), }; +const targetFieldValidator: ValidationConfig = { + validator: emptyField( + i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.targetFieldRequiredError', { + defaultMessage: 'A target field value is required.', + }) + ), +}; + const fieldsConfig: FieldsConfig = { /* Required fields config */ policy_name: { @@ -65,31 +76,6 @@ const fieldsConfig: FieldsConfig = { ], }, - target_field: { - type: FIELD_TYPES.TEXT, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.targetFieldLabel', { - defaultMessage: 'Target field', - }), - helpText: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.enrichForm.targetFieldHelpText', - { - defaultMessage: 'Field added to incoming documents to contain enrich data.', - } - ), - validations: [ - { - validator: emptyField( - i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.enrichForm.targetFieldRequiredError', - { - defaultMessage: 'A target field value is required.', - } - ) - ), - }, - ], - }, - /* Optional fields config */ override: { type: FIELD_TYPES.TOGGLE, @@ -173,7 +159,18 @@ export const Enrich: FunctionComponent = () => { - + diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx index ce914788e7cfbc..22aa2f000bab36 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx @@ -20,19 +20,10 @@ import { import { FieldNameField } from './common_fields/field_name_field'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; import { FieldsConfig, from, to } from './shared'; +import { TargetField } from './common_fields/target_field'; const fieldsConfig: FieldsConfig = { /* Optional field config */ - target_field: { - type: FIELD_TYPES.TEXT, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.geoIPForm.targetFieldLabel', { - defaultMessage: 'Target field (optional)', - }), - helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.geoIPForm.targetFieldHelpText', { - defaultMessage: - 'The field that will hold the geographical information looked up from the Maxmind database.', - }), - }, database_file: { type: FIELD_TYPES.TEXT, serializer: (v) => (v === 'GeoLite2-City.mmdb' ? undefined : v), @@ -84,7 +75,15 @@ export const GeoIP: FunctionComponent = () => { )} /> - + diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx index 17517f1dab1b61..33a456c961501c 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx @@ -14,6 +14,7 @@ import { TextEditor } from '../field_components'; import { FieldsConfig } from './shared'; import { FieldNameField } from './common_fields/field_name_field'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; +import { TargetField } from './common_fields/target_field'; const { emptyField } = fieldValidators; @@ -58,18 +59,6 @@ const fieldsConfig: FieldsConfig = { }, ], }, - - /* Optional fields config */ - target_field: { - type: FIELD_TYPES.TEXT, - deserializer: String, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldLabel', { - defaultMessage: 'Target field (optional)', - }), - helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldHelpText', { - defaultMessage: 'The field to assign the converted value to.', - }), - }, }; export const Gsub: FunctionComponent = () => { @@ -96,7 +85,14 @@ export const Gsub: FunctionComponent = () => { - + diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx index 311a2b10598f19..11999d26b4f2a8 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx @@ -7,29 +7,9 @@ import React, { FunctionComponent } from 'react'; import { i18n } from '@kbn/i18n'; -import { FIELD_TYPES, UseField, Field } from '../../../../../../shared_imports'; - -import { FieldsConfig } from './shared'; import { FieldNameField } from './common_fields/field_name_field'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; - -const fieldsConfig: FieldsConfig = { - /* Optional fields config */ - target_field: { - type: FIELD_TYPES.TEXT, - deserializer: String, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.htmlStripForm.targetFieldLabel', { - defaultMessage: 'Target field (optional)', - }), - helpText: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.htmlStripForm.targetFieldHelpText', - { - defaultMessage: - 'The field to assign the stripped value to. If blank the field will be updated in-place.', - } - ), - }, -}; +import { TargetField } from './common_fields/target_field'; export const HtmlStrip: FunctionComponent = () => { return ( @@ -41,7 +21,15 @@ export const HtmlStrip: FunctionComponent = () => { )} /> - + diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx index 1cffb3e4b9bcab..73ef1bffdbe395 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx @@ -19,6 +19,8 @@ import { import { XJsonEditor } from '../field_components'; +import { TargetField } from './common_fields/target_field'; + import { FieldsConfig, to, from } from './shared'; const { emptyField, isJsonField } = fieldValidators; @@ -96,21 +98,6 @@ const fieldsConfig: FieldsConfig = { }, /* Optional fields config */ - target_field: { - type: FIELD_TYPES.TEXT, - deserializer: String, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.inferenceForm.targetFieldLabel', { - defaultMessage: 'Target field (optional)', - }), - helpText: ( - {'ml.inference.'} }} - /> - ), - }, - field_map: { type: FIELD_TYPES.TEXT, deserializer: to.jsonString, @@ -173,14 +160,22 @@ export const Inference: FunctionComponent = () => { <> - + {'ml.inference.'} }} + /> + } + /> { component={XJsonEditor} componentProps={{ editorProps: { - height: 100, + height: 200, options: { minimap: { enabled: false } }, }, }} diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx index 91b3193ea17bc0..fa17513beacb58 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx @@ -11,6 +11,7 @@ import { FIELD_TYPES, fieldValidators, UseField, Field } from '../../../../../.. import { FieldsConfig } from './shared'; import { FieldNameField } from './common_fields/field_name_field'; +import { TargetField } from './common_fields/target_field'; const { emptyField } = fieldValidators; @@ -38,19 +39,6 @@ const fieldsConfig: FieldsConfig = { }, ], }, - - /* Optional fields config */ - target_field: { - type: FIELD_TYPES.TEXT, - deserializer: String, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.joinForm.targetFieldLabel', { - defaultMessage: 'Target field (optional)', - }), - helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.joinForm.targetFieldHelpText', { - defaultMessage: - 'The field to assign the joined value to. If empty, the field is updated in-place.', - }), - }, }; export const Join: FunctionComponent = () => { @@ -65,7 +53,15 @@ export const Join: FunctionComponent = () => { - + ); }; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts index 9ee2bea6d4b012..84b308dd9cd7ab 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/shared.ts @@ -53,8 +53,9 @@ export const from = { optionalJson: (v: string) => { if (v) { try { - if (Object.keys(JSON.parse(v)).length) { - return v; + const json = JSON.parse(v); + if (Object.keys(json).length) { + return json; } } catch (e) { // Ignore From 0bbfab1ca3265b2e6594df1fbf8589433edd0e57 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Mon, 17 Aug 2020 11:03:20 +0200 Subject: [PATCH 13/21] fix i18n --- .../processors/common_fields/target_field.tsx | 13 ++++++++----- x-pack/plugins/translations/translations/ja-JP.json | 4 ---- x-pack/plugins/translations/translations/zh-CN.json | 4 ---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx index c9d536dcb41c3f..9bf44425a7c5d1 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/target_field.tsx @@ -15,13 +15,16 @@ const fieldsConfig: FieldsConfig = { target_field: { type: FIELD_TYPES.TEXT, deserializer: String, - label: i18n.translate('xpack.ingestPipelines.pipelineEditor.jsonForm.targetFieldLabel', { + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.commonFields.targetFieldLabel', { defaultMessage: 'Target field (optional)', }), - helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.jsonForm.targetFieldHelpText', { - defaultMessage: - 'The field to assign the joined value to. If empty, the field is updated in-place.', - }), + helpText: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.commonFields.targetFieldHelpText', + { + defaultMessage: + 'The field to assign the joined value to. If empty, the field is updated in-place.', + } + ), }, }; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 8c92e7359b2f7d..23aac816d2e5ca 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -9739,14 +9739,10 @@ "xpack.ingestPipelines.pipelineEditor.deleteModal.deleteDescription": "このプロセッサーとエラーハンドラーを削除します。", "xpack.ingestPipelines.pipelineEditor.dropZoneButton.moveHereToolTip": "ここに移動", "xpack.ingestPipelines.pipelineEditor.dropZoneButton.unavailableToolTip": "ここに移動できません", - "xpack.ingestPipelines.pipelineEditor.gsubForm.fieldFieldLabel": "フィールド", - "xpack.ingestPipelines.pipelineEditor.gsubForm.fieldRequiredError": "フィールド値が必要です。", - "xpack.ingestPipelines.pipelineEditor.gsubForm.ignoreMissingFieldLabel": "不足しテイル項目を無視", "xpack.ingestPipelines.pipelineEditor.gsubForm.patternFieldLabel": "パターン", "xpack.ingestPipelines.pipelineEditor.gsubForm.patternRequiredError": "パターン値が必要です。", "xpack.ingestPipelines.pipelineEditor.gsubForm.replacementFieldLabel": "置換", "xpack.ingestPipelines.pipelineEditor.gsubForm.replacementRequiredError": "置換値が必要です。", - "xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldLabel": "ターゲットフィールド(任意)", "xpack.ingestPipelines.pipelineEditor.item.cancelMoveButtonAriaLabel": "移動のキャンセル", "xpack.ingestPipelines.pipelineEditor.item.descriptionPlaceholder": "説明なし", "xpack.ingestPipelines.pipelineEditor.item.editButtonAriaLabel": "このプロセッサーを編集", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 5ab70ff7a9d04d..bf76dadb6c2277 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -9742,14 +9742,10 @@ "xpack.ingestPipelines.pipelineEditor.deleteModal.deleteDescription": "删除此处理器和其失败时处理程序。", "xpack.ingestPipelines.pipelineEditor.dropZoneButton.moveHereToolTip": "移到此处", "xpack.ingestPipelines.pipelineEditor.dropZoneButton.unavailableToolTip": "无法移到此处", - "xpack.ingestPipelines.pipelineEditor.gsubForm.fieldFieldLabel": "字段", - "xpack.ingestPipelines.pipelineEditor.gsubForm.fieldRequiredError": "字段值必填。", - "xpack.ingestPipelines.pipelineEditor.gsubForm.ignoreMissingFieldLabel": "忽略缺失", "xpack.ingestPipelines.pipelineEditor.gsubForm.patternFieldLabel": "模式", "xpack.ingestPipelines.pipelineEditor.gsubForm.patternRequiredError": "模式值必填。", "xpack.ingestPipelines.pipelineEditor.gsubForm.replacementFieldLabel": "替换", "xpack.ingestPipelines.pipelineEditor.gsubForm.replacementRequiredError": "替换值必填。", - "xpack.ingestPipelines.pipelineEditor.gsubForm.targetFieldLabel": "目标字段(可选)", "xpack.ingestPipelines.pipelineEditor.item.cancelMoveButtonAriaLabel": "取消移动", "xpack.ingestPipelines.pipelineEditor.item.descriptionPlaceholder": "无描述", "xpack.ingestPipelines.pipelineEditor.item.editButtonAriaLabel": "编辑此处理器", From 6ecf83090df2283b93cafa142fb275a80a9d5f49 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Wed, 19 Aug 2020 17:05:52 +0200 Subject: [PATCH 14/21] address pr feedback --- .../manage_processor_form/processors/enrich.tsx | 6 +++--- .../components/manage_processor_form/processors/fail.tsx | 8 ++------ .../manage_processor_form/processors/html_strip.tsx | 2 +- .../manage_processor_form/processors/inference.tsx | 4 +++- .../components/manage_processor_form/processors/join.tsx | 2 +- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index 20b0470d8fc6ba..e5d04b381586dc 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -89,7 +89,7 @@ const fieldsConfig: FieldsConfig = { 'xpack.ingestPipelines.pipelineEditor.enrichForm.overrideFieldHelpText', { defaultMessage: - 'Whether this processor will update fields with pre-existing non-null-valued field. When set to false, such fields will not be overridden.', + 'Whether this processor will update fields with a pre-existing non-null-valued field. When set to false, such fields will not be overridden.', } ), }, @@ -109,7 +109,7 @@ const fieldsConfig: FieldsConfig = { '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', + '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 are 1 up to 128.', } ), validations: [ @@ -152,7 +152,7 @@ export const Enrich: FunctionComponent = () => { 'xpack.ingestPipelines.pipelineEditor.enrichForm.fieldNameHelpText', { defaultMessage: - 'The field in the input document that matches the policies match_field used to retrieve the enrichment data', + 'The field in the input document that matches the policy field used to retrieve the enrichment data.', } )} /> diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx index 8d53aaa75e29bd..93b7594531c0e1 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx @@ -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: 'The error message thrown by the processor.', }), validations: [ { @@ -36,9 +36,5 @@ const fieldsConfig: FieldsConfig = { }; export const Fail: FunctionComponent = () => { - return ( - <> - - - ); + return ; }; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx index 11999d26b4f2a8..8261cfaa3814ac 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx @@ -26,7 +26,7 @@ export const HtmlStrip: FunctionComponent = () => { 'xpack.ingestPipelines.pipelineEditor.htmlStripForm.targetFieldHelpText', { defaultMessage: - 'The field to assign the stripped value to. If blank the field will be updated in-place.', + 'The field to assign the stripped value to. If blank, the field will be updated in-place.', } )} /> diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx index 73ef1bffdbe395..8ff75314e2a679 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx @@ -50,6 +50,7 @@ const getInferenceConfigHelpText = (esDocsBasePath: string): React.ReactNode => values={{ regression: ( @@ -58,6 +59,7 @@ const getInferenceConfigHelpText = (esDocsBasePath: string): React.ReactNode => ), classification: ( @@ -164,7 +166,7 @@ export const Inference: FunctionComponent = () => { helpText={ {'ml.inference.'} }} /> } diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx index fa17513beacb58..2c88007b54d804 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx @@ -26,7 +26,7 @@ const fieldsConfig: FieldsConfig = { helpText: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.joinForm.separatorFieldHelpText', { - defaultMessage: 'The separator character', + defaultMessage: 'The separator character.', } ), validations: [ From 5718f77e25cdc6dc03065f2ee3edb281c8cd9ad9 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 20 Aug 2020 10:29:02 +0200 Subject: [PATCH 15/21] Fix enrich max fields help text copy --- .../components/manage_processor_form/processors/enrich.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index e5d04b381586dc..72f057a75ff89e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -109,7 +109,7 @@ const fieldsConfig: FieldsConfig = { '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 are 1 up to 128.', + '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.', } ), validations: [ From 40be085bbf6f5bf7bf9deda7507c2f3a0a5f4eeb Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 20 Aug 2020 10:54:44 +0200 Subject: [PATCH 16/21] add link to enrich policy docs in help text --- .../processors/enrich.tsx | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index 72f057a75ff89e..53caa190bb787a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -6,6 +6,8 @@ import React, { FunctionComponent } from 'react'; import { i18n } from '@kbn/i18n'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiLink } from '@elastic/eui'; import { FIELD_TYPES, fieldValidators, @@ -15,6 +17,7 @@ import { NumericField, SelectField, ValidationConfig, + useKibana, } from '../../../../../../shared_imports'; import { FieldNameField } from './common_fields/field_name_field'; @@ -52,6 +55,25 @@ const targetFieldValidator: ValidationConfig = { ), }; +const getEnrichPolicyNameFieldHelpText = (esDocUrl: string) => { + return ( + + {i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText.enrichPolicyLink', + { defaultMessage: 'enrich policy' } + )} + + ), + }} + /> + ); +}; + const fieldsConfig: FieldsConfig = { /* Required fields config */ policy_name: { @@ -60,7 +82,7 @@ const fieldsConfig: FieldsConfig = { defaultMessage: 'Policy name', }), helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText', { - defaultMessage: 'The name of the enrich policy to use.', + defaultMessage: 'Name of the enrich policy.', }), validations: [ { @@ -145,6 +167,8 @@ const fieldsConfig: FieldsConfig = { }; export const Enrich: FunctionComponent = () => { + const { services } = useKibana(); + const esDocUrl = services.documentation.getEsDocsBasePath(); return ( <> { )} /> - + Date: Thu, 20 Aug 2020 11:11:44 +0200 Subject: [PATCH 17/21] fix error validation message in enrich policy form and replace space with horizontal rule --- .../manage_processor_form/processor_settings_fields.tsx | 2 +- .../components/manage_processor_form/processors/enrich.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx index a6447bc30ac00f..dfcee7dd7647b2 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx @@ -36,7 +36,7 @@ export const ProcessorSettingsFields: FunctionComponent = ({ processor }) return ( <> - + ); diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index 53caa190bb787a..f735f404d9a50c 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -90,7 +90,7 @@ const fieldsConfig: FieldsConfig = { i18n.translate( 'xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameRequiredError', { - defaultMessage: 'A field value is required.', + defaultMessage: 'A policy name value is required.', } ) ), From 1ad0f2e7139c9214197531c17f229b9a75fe117b Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 20 Aug 2020 11:53:48 +0200 Subject: [PATCH 18/21] address copy feedback --- .../processor_settings_fields.tsx | 2 +- .../processors/enrich.tsx | 80 +++++++++++-------- .../manage_processor_form/processors/fail.tsx | 2 +- .../processors/foreach.tsx | 6 +- .../processors/geoip.tsx | 23 ++++-- .../manage_processor_form/processors/grok.tsx | 31 +------ .../manage_processor_form/processors/gsub.tsx | 27 ++++--- .../processors/html_strip.tsx | 18 +++-- .../processors/inference.tsx | 6 +- .../manage_processor_form/processors/join.tsx | 22 ++--- .../manage_processor_form/processors/json.tsx | 4 +- .../shared/map_processor_type_to_form.tsx | 2 +- 12 files changed, 114 insertions(+), 109 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx index dfcee7dd7647b2..6a70592bc2f70d 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processor_settings_fields.tsx @@ -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'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index f735f404d9a50c..4fa5f01095f65b 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -55,25 +55,6 @@ const targetFieldValidator: ValidationConfig = { ), }; -const getEnrichPolicyNameFieldHelpText = (esDocUrl: string) => { - return ( - - {i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText.enrichPolicyLink', - { defaultMessage: 'enrich policy' } - )} - - ), - }} - /> - ); -}; - const fieldsConfig: FieldsConfig = { /* Required fields config */ policy_name: { @@ -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.', } ) ), @@ -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.', } ), }, @@ -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: [ @@ -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.', - } - ), }, }; @@ -176,7 +149,7 @@ 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.', } )} /> @@ -184,7 +157,22 @@ export const Enrich: FunctionComponent = () => { + {i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText.enrichPolicyLink', + { defaultMessage: 'enrich policy' } + )} + + ), + }} + /> + ), }} component={Field} path="fields.policy_name" @@ -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]} @@ -212,7 +200,29 @@ export const Enrich: FunctionComponent = () => { /> + {i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.enrichForm.shapeRelationFieldHelpText.geoMatchPoliciesLink', + { defaultMessage: 'geo-match enrich policies' } + )} + + ), + }} + /> + ), + }} component={SelectField} componentProps={{ euiFieldProps: { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx index 93b7594531c0e1..be97231fdca469 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx @@ -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: [ { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx index afaa9e74879b6a..ce606af086893c 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx @@ -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: [ { @@ -41,7 +41,7 @@ const fieldsConfig: FieldsConfig = { i18n.translate( 'xpack.ingestPipelines.pipelineEditor.failForm.processorInvalidJsonError', { - defaultMessage: 'Invalid JSON.', + defaultMessage: 'Invalid JSON', } ) ), @@ -56,7 +56,7 @@ export const Foreach: FunctionComponent = () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx index 22aa2f000bab36..ebbd410761e14e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx @@ -33,8 +33,11 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'GeoLite2-City.mmdb'} }} + defaultMessage="GeoIP2 database file in the {ingestGeoIP} configuration directory. Defaults to {databaseFile}." + values={{ + databaseFile: {'GeoLite2-City.mmdb'}, + ingestGeoIP: {'ingest-geoip'}, + }} /> ), }, @@ -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.', } ), }, @@ -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.', + } + ), }, }; @@ -70,8 +80,8 @@ export const GeoIP: FunctionComponent = () => { <> @@ -79,8 +89,7 @@ export const GeoIP: FunctionComponent = () => { 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', } )} /> diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx index d3565ddf4e3318..5380c67f5d465c 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx @@ -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.' } ) ), }, @@ -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 = () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx index 33a456c961501c..20d4cc7dd9e29a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx @@ -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'; @@ -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.', }) ), }, @@ -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.', }) ), }, @@ -67,7 +69,7 @@ export const Gsub: FunctionComponent = () => { @@ -86,12 +88,15 @@ export const Gsub: FunctionComponent = () => { {'field'}, + }} + /> + } /> diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx index 8261cfaa3814ac..fb1a2d97672b01 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx @@ -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 { FieldNameField } from './common_fields/field_name_field'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; @@ -17,18 +19,18 @@ export const HtmlStrip: FunctionComponent = () => { {'field'} }} + /> + } /> diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx index 8ff75314e2a679..68281fc11f3402 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx @@ -82,7 +82,7 @@ const fieldsConfig: FieldsConfig = { helpText: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.inferenceForm.modelIDFieldHelpText', { - defaultMessage: 'The ID of the model to load and infer against.', + defaultMessage: 'ID of the model to infer against.', } ), validations: [ @@ -111,7 +111,7 @@ const fieldsConfig: FieldsConfig = { 'xpack.ingestPipelines.pipelineEditor.inferenceForm.fieldMapHelpText', { defaultMessage: - 'Maps the document field names to the known field names of the model. This mapping takes precedence over any default mappings provided in the model configuration.', + 'Maps document field names to the known field names of the model. Takes precedence over any mappings in the model.', } ), validations: [ @@ -166,7 +166,7 @@ export const Inference: FunctionComponent = () => { helpText={ {'ml.inference.'} }} /> } diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx index 2c88007b54d804..c35a5b463f5732 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx @@ -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'; @@ -26,7 +28,7 @@ const fieldsConfig: FieldsConfig = { helpText: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.joinForm.separatorFieldHelpText', { - defaultMessage: 'The separator character.', + defaultMessage: 'Separator character.', } ), validations: [ @@ -47,20 +49,22 @@ export const Join: FunctionComponent = () => { {'field'}, + }} + /> + } /> ); diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx index 3c391084c0b53f..d20be15468e7e4 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx @@ -34,7 +34,7 @@ const fieldsConfig: FieldsConfig = { 'xpack.ingestPipelines.pipelineEditor.jsonForm.addToRootFieldHelpText', { defaultMessage: - 'Inject the serialized JSON to the top level of the JSON document. A target field cannot be combined with this option.', + 'If true, add the JSON object to the top level of the document. Cannot be combined with a target field.', } ), }, @@ -61,7 +61,7 @@ export const Json: FunctionComponent = () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx index 4835164ecccf3b..854c6632ab94ad 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/shared/map_processor_type_to_form.tsx @@ -117,7 +117,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }, enrich: { FieldsComponent: Enrich, - docLinkPath: '/enrich-processor.html', + docLinkPath: '/ingest-enriching-data.html', label: i18n.translate('xpack.ingestPipelines.processors.label.enrich', { defaultMessage: 'Enrich', }), From 4030a9966211ae6344037657b8f12a78146504c3 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 20 Aug 2020 12:01:07 +0200 Subject: [PATCH 19/21] fix i18n id typo --- .../components/manage_processor_form/processors/grok.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx index 5380c67f5d465c..e96f190fbf57b5 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx @@ -112,7 +112,7 @@ export const Grok: FunctionComponent = () => { editorProps: { height: 200, 'aria-label': i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.grokForm.patternDefintionsAriaLabel', + 'xpack.ingestPipelines.pipelineEditor.grokForm.patternDefinitionsAriaLabel', { defaultMessage: 'Pattern definitions editor', } From 721119d89a5f492e7f7cabc9bb6993b29ae5ed1a Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 20 Aug 2020 13:04:13 +0200 Subject: [PATCH 20/21] fix i18n --- .../components/manage_processor_form/processors/enrich.tsx | 3 --- .../components/manage_processor_form/processors/json.tsx | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index 4fa5f01095f65b..5c7a797888b756 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -62,9 +62,6 @@ const fieldsConfig: FieldsConfig = { label: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameFieldLabel', { defaultMessage: 'Policy name', }), - helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.enrichForm.policyNameHelpText', { - defaultMessage: 'Name of the enrich policy.', - }), validations: [ { validator: emptyField( diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx index d20be15468e7e4..21f72935646ba7 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx @@ -60,7 +60,7 @@ export const Json: FunctionComponent = () => { <> From 56642c2017fa02a45d51d0e56ce3b115b06e4eed Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 20 Aug 2020 16:50:43 +0200 Subject: [PATCH 21/21] address additional round of feedback and fix json form help text --- .../common_fields/ignore_missing_field.tsx | 27 ++++++++++++++----- .../processors/enrich.tsx | 6 ++--- .../manage_processor_form/processors/fail.tsx | 2 +- .../processors/foreach.tsx | 4 +-- .../processors/geoip.tsx | 5 ++-- .../manage_processor_form/processors/grok.tsx | 4 +-- .../manage_processor_form/processors/gsub.tsx | 6 ++--- .../processors/html_strip.tsx | 2 +- .../processors/inference.tsx | 2 +- .../manage_processor_form/processors/join.tsx | 4 +-- .../manage_processor_form/processors/json.tsx | 11 +++++--- 11 files changed, 46 insertions(+), 27 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx index c1c9d20664c04e..35dd462d88425e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/common_fields/ignore_missing_field.tsx @@ -5,7 +5,15 @@ */ import React, { FunctionComponent } from 'react'; import { i18n } from '@kbn/i18n'; -import { FIELD_TYPES, UseField, ToggleField } from '../../../../../../../shared_imports'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiCode } from '@elastic/eui'; + +import { + FIELD_TYPES, + UseField, + ToggleField, + FieldConfig, +} from '../../../../../../../shared_imports'; import { FieldsConfig, to, from } from '../shared'; @@ -21,16 +29,23 @@ export const fieldsConfig: FieldsConfig = { defaultMessage: 'Ignore missing', } ), + helpText: ( + {'field'}, + }} + /> + ), }, }; -interface Props { - helpText?: string; -} +type Props = Partial; -export const IgnoreMissingField: FunctionComponent = ({ helpText }) => ( +export const IgnoreMissingField: FunctionComponent = (props) => ( diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx index 5c7a797888b756..31eac38222afbc 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/enrich.tsx @@ -88,7 +88,7 @@ const fieldsConfig: FieldsConfig = { helpText: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.enrichForm.overrideFieldHelpText', { - defaultMessage: 'If true, the processor can overwrite pre-existing field values.', + defaultMessage: 'If enabled, the processor can overwrite pre-existing field values.', } ), }, @@ -157,7 +157,7 @@ export const Enrich: FunctionComponent = () => { helpText: ( @@ -182,7 +182,7 @@ export const Enrich: FunctionComponent = () => { helpText={i18n.translate( 'xpack.ingestPipelines.pipelineEditor.enrichForm.targetFieldHelpText', { - defaultMessage: 'Field used to contain enrich data.', + defaultMessage: 'Field used to contain enrich data', } )} validations={[targetFieldValidator]} diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx index be97231fdca469..3befadc3ca5a31 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/fail.tsx @@ -21,7 +21,7 @@ const fieldsConfig: FieldsConfig = { defaultMessage: 'Message', }), helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.failForm.messageHelpText', { - defaultMessage: 'Error message returned by the processor.', + defaultMessage: 'Error message returned by the processor', }), validations: [ { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx index ce606af086893c..e471f8322f164a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/foreach.tsx @@ -26,7 +26,7 @@ const fieldsConfig: FieldsConfig = { defaultMessage: 'Processor', }), helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.foreachForm.processorHelpText', { - defaultMessage: 'Ingest processor to run on each array value.', + defaultMessage: 'Ingest processor to run on each array value', }), validations: [ { @@ -56,7 +56,7 @@ export const Foreach: FunctionComponent = () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx index ebbd410761e14e..ef2aa62c4a7de5 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/geoip.tsx @@ -68,8 +68,7 @@ const fieldsConfig: FieldsConfig = { 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.', + defaultMessage: 'Use the first matching geo data, even if the field contains an array.', } ), }, @@ -81,7 +80,7 @@ export const GeoIP: FunctionComponent = () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx index e96f190fbf57b5..1ed9898149a679 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/grok.tsx @@ -87,7 +87,7 @@ const fieldsConfig: FieldsConfig = { helpText: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.grokForm.traceMatchFieldHelpText', { - defaultMessage: 'If true, include metadata about the matching expression in the document.', + defaultMessage: 'Add metadata about the matching expression to the document', } ), }, @@ -99,7 +99,7 @@ export const Grok: FunctionComponent = () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx index 20d4cc7dd9e29a..4d3445d469da2e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/gsub.tsx @@ -29,7 +29,7 @@ const fieldsConfig: FieldsConfig = { }), deserializer: String, helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.gsubForm.patternFieldHelpText', { - defaultMessage: 'Regular expression used to match text.', + defaultMessage: 'Regular expression used to match substrings in the field', }), validations: [ { @@ -49,7 +49,7 @@ const fieldsConfig: FieldsConfig = { }), helpText: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.gsubForm.replacementFieldHelpText', - { defaultMessage: 'Replacement text for matches.' } + { defaultMessage: 'Replacement text for matches' } ), validations: [ { @@ -69,7 +69,7 @@ export const Gsub: FunctionComponent = () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx index fb1a2d97672b01..c6ca7df4cc3e77 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/html_strip.tsx @@ -19,7 +19,7 @@ export const HtmlStrip: FunctionComponent = () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx index 68281fc11f3402..ee8d7cc55a9f19 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/inference.tsx @@ -82,7 +82,7 @@ const fieldsConfig: FieldsConfig = { helpText: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.inferenceForm.modelIDFieldHelpText', { - defaultMessage: 'ID of the model to infer against.', + defaultMessage: 'ID of the model to infer against', } ), validations: [ diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx index c35a5b463f5732..712d0106459b1e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/join.tsx @@ -28,7 +28,7 @@ const fieldsConfig: FieldsConfig = { helpText: i18n.translate( 'xpack.ingestPipelines.pipelineEditor.joinForm.separatorFieldHelpText', { - defaultMessage: 'Separator character.', + defaultMessage: 'Separator character', } ), validations: [ @@ -49,7 +49,7 @@ export const Join: FunctionComponent = () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx index 21f72935646ba7..9d62c67460136d 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/components/manage_processor_form/processors/json.tsx @@ -34,7 +34,7 @@ const fieldsConfig: FieldsConfig = { 'xpack.ingestPipelines.pipelineEditor.jsonForm.addToRootFieldHelpText', { defaultMessage: - 'If true, add the JSON object to the top level of the document. Cannot be combined with a target field.', + 'Add the JSON object to the top level of the document. Cannot be combined with a target field.', } ), }, @@ -61,11 +61,16 @@ export const Json: FunctionComponent = () => { - +