From 8fb174d8a06eff3b1c5c8da793fd8bb82e551cd9 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Tue, 25 May 2021 13:24:32 +0200 Subject: [PATCH 1/7] add new fingerprint processor --- .../__jest__/processors/fingerprint.test.tsx | 124 +++++++++++++++ .../__jest__/processors/processor.helpers.tsx | 3 + .../processor_form/processors/fingerprint.tsx | 144 ++++++++++++++++++ .../processor_form/processors/index.ts | 1 + .../shared/map_processor_type_to_form.tsx | 16 ++ 5 files changed, 288 insertions(+) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx new file mode 100644 index 00000000000000..f3da4212c10ad0 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx @@ -0,0 +1,124 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { act } from 'react-dom/test-utils'; +import { setup, SetupResult, getProcessorValue } from './processor.helpers'; + +// Default parameter values automatically added to the registered domain processor when saved +const defaultFingerprintParameters = { + if: undefined, + tag: undefined, + method: undefined, + salt: undefined, + description: undefined, + ignore_missing: undefined, + ignore_failure: undefined, + target_field: undefined +}; + +const FINGERPRINT_TYPE = 'fingerprint'; + +describe('Processor: Fingerprint', () => { + let onUpdate: jest.Mock; + let testBed: SetupResult; + + beforeAll(() => { + jest.useFakeTimers(); + }); + + afterAll(() => { + jest.useRealTimers(); + }); + + beforeEach(async () => { + onUpdate = jest.fn(); + + await act(async () => { + testBed = await setup({ + value: { + processors: [], + }, + onFlyoutOpen: jest.fn(), + onUpdate, + }); + }); + + testBed.component.update(); + + // Open flyout to add new processor + testBed.actions.addProcessor(); + // Add type (the other fields are not visible until a type is selected) + await testBed.actions.addProcessorType(FINGERPRINT_TYPE); + }); + + test('prevents form submission if required fields are not provided', async () => { + const { + actions: { saveNewProcessor }, + form, + } = testBed; + + // Click submit button with only the type defined + await saveNewProcessor(); + + // Expect form error as "field" is required parameter + expect(form.getErrorsMessages()).toEqual(['A field value is required.']); + }); + + test('saves with default parameter values', async () => { + const { + actions: { saveNewProcessor }, + find, + component, + } = testBed; + + // Add "type" value (required) + await act(async () => { + find('fieldsValueField.input').simulate('change', [{ label: 'user' }]); + }); + component.update(); + // Save the field + await saveNewProcessor(); + + const processors = getProcessorValue(onUpdate, FINGERPRINT_TYPE); + expect(processors[0][FINGERPRINT_TYPE]).toEqual({ + ...defaultFingerprintParameters, + fields: ['user'], + }); + }); + + test('allows optional parameters to be set', async () => { + const { + actions: { saveNewProcessor }, + form, + find, + component, + } = testBed; + + // Add "field" value (required) + await act(async () => { + find('fieldsValueField.input').simulate('change', [{ label: 'user' }]); + }); + component.update(); + + // Set optional parameteres + form.setInputValue('targetField.input', 'target_field'); + form.setSelectValue('methodsValueField', 'SHA-256'); + form.setInputValue('saltValueField.input', 'salt'); + + // Save the field with new changes + await saveNewProcessor(); + + const processors = getProcessorValue(onUpdate, FINGERPRINT_TYPE); + expect(processors[0][FINGERPRINT_TYPE]).toEqual({ + ...defaultFingerprintParameters, + fields: ['user'], + target_field: 'target_field', + method: 'SHA-256', + salt: 'salt', + }); + }); +}); diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx index 193e94c7aeb9e6..342e381f2e7f11 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/processor.helpers.tsx @@ -153,4 +153,7 @@ type TestSubject = | 'separatorValueField.input' | 'quoteValueField.input' | 'emptyValueField.input' + | 'fieldsValueField.input' + | 'saltValueField.input' + | 'methodsValueField' | 'trimSwitch.input'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx new file mode 100644 index 00000000000000..b750f1b12dd448 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx @@ -0,0 +1,144 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import React, { FunctionComponent } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiCode } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { FieldsConfig, from, to } from './shared'; +import { TargetField } from './common_fields/target_field'; +import { IgnoreMissingField } from './common_fields/ignore_missing_field'; +import { + FIELD_TYPES, + Field, + UseField, + SelectField, + ComboBoxField, + fieldValidators, +} from '../../../../../../shared_imports'; + +const fieldsConfig: FieldsConfig = { + fields: { + type: FIELD_TYPES.COMBO_BOX, + deserializer: to.arrayOfStrings, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.fieldNameField', { + defaultMessage: 'Fields', + }), + helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.fieldNameHelpText', { + defaultMessage: 'Fields to remove.', + }), + validations: [ + { + validator: fieldValidators.emptyField( + i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.fieldNameRequiredError', { + defaultMessage: 'A field value is required.', + }) + ), + }, + ], + }, + salt: { + type: FIELD_TYPES.TEXT, + serializer: from.emptyStringToUndefined, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.saltFieldLabel', { + defaultMessage: 'Salt (optional)', + }), + helpText: ( + + ), + }, + method: { + type: FIELD_TYPES.TEXT, + serializer: from.emptyStringToUndefined, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.methodFieldLabel', { + defaultMessage: 'Method (optional)', + }), + helpText: ( + {'SHA-1'} }} + /> + ) + }, +}; + +export const Fingerprint: FunctionComponent = () => { + return ( + <> + + + + + + + + + + + ); +}; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/index.ts b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/index.ts index 4fb4365c477b56..5e3e5f82478bd6 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/index.ts +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/index.ts @@ -17,6 +17,7 @@ export { DotExpander } from './dot_expander'; export { Drop } from './drop'; export { Enrich } from './enrich'; export { Fail } from './fail'; +export { Fingerprint } from './fingerprint'; export { Foreach } from './foreach'; export { GeoIP } from './geoip'; export { Grok } from './grok'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx index b5e42ea56bdf8b..8b0b606a3b5d10 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx @@ -23,6 +23,7 @@ import { Drop, Enrich, Fail, + Fingerprint, Foreach, GeoIP, Grok, @@ -308,6 +309,21 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { defaultMessage: 'Raises an exception that halts execution', }), }, + fingerprint: { + FieldsComponent: Fingerprint, + docLinkPath: '/fingerprint-processor.html', + label: i18n.translate('xpack.ingestPipelines.processors.label.fingerprint', { + defaultMessage: 'Fingerprint', + }), + typeDescription: i18n.translate('xpack.ingestPipelines.processors.description.fingerprint', { + defaultMessage: + 'Computes a hash of the document’s content.', + }), + getDefaultDescription: () => + i18n.translate('xpack.ingestPipelines.processors.defaultDescription.fingerprint', { + defaultMessage: 'Computes a hash of the document’s content.', + }), + }, foreach: { FieldsComponent: Foreach, docLinkPath: '/foreach-processor.html', From 113fadd38feea2118bfd8c92acfc3030eeeeae6e Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Tue, 25 May 2021 13:26:55 +0200 Subject: [PATCH 2/7] linter fixes --- .../__jest__/processors/fingerprint.test.tsx | 2 +- .../processor_form/processors/fingerprint.tsx | 18 ++++++++++-------- .../shared/map_processor_type_to_form.tsx | 9 ++++----- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx index f3da4212c10ad0..47250515b7e446 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx @@ -17,7 +17,7 @@ const defaultFingerprintParameters = { description: undefined, ignore_missing: undefined, ignore_failure: undefined, - target_field: undefined + target_field: undefined, }; const FINGERPRINT_TYPE = 'fingerprint'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx index b750f1b12dd448..b4d50b479e056f 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx @@ -35,9 +35,12 @@ const fieldsConfig: FieldsConfig = { validations: [ { validator: fieldValidators.emptyField( - i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.fieldNameRequiredError', { - defaultMessage: 'A field value is required.', - }) + i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.fingerprint.fieldNameRequiredError', + { + defaultMessage: 'A field value is required.', + } + ) ), }, ], @@ -67,7 +70,7 @@ const fieldsConfig: FieldsConfig = { defaultMessage="The hash method used to compute the fingerprint. Defaults to {value}." values={{ value: {'SHA-1'} }} /> - ) + ), }, }; @@ -90,10 +93,9 @@ export const Fingerprint: FunctionComponent = () => { options: [ { value: 'MD5', - text: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.fingerprint.md5Option', - { defaultMessage: 'MD5' } - ), + text: i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.md5Option', { + defaultMessage: 'MD5', + }), }, { value: 'SHA-1', diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx index 8b0b606a3b5d10..983fb0ea67bb0f 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx @@ -316,13 +316,12 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { defaultMessage: 'Fingerprint', }), typeDescription: i18n.translate('xpack.ingestPipelines.processors.description.fingerprint', { - defaultMessage: - 'Computes a hash of the document’s content.', - }), - getDefaultDescription: () => - i18n.translate('xpack.ingestPipelines.processors.defaultDescription.fingerprint', { defaultMessage: 'Computes a hash of the document’s content.', }), + getDefaultDescription: () => + i18n.translate('xpack.ingestPipelines.processors.defaultDescription.fingerprint', { + defaultMessage: 'Computes a hash of the document’s content.', + }), }, foreach: { FieldsComponent: Foreach, From 6d27ba6eb0db96180a2c43d04aca90b66f4788ab Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Tue, 25 May 2021 13:36:01 +0200 Subject: [PATCH 3/7] fix wrong copy --- .../components/processor_form/processors/fingerprint.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx index b4d50b479e056f..d981380a5354f9 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx @@ -30,7 +30,7 @@ const fieldsConfig: FieldsConfig = { defaultMessage: 'Fields', }), helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.fieldNameHelpText', { - defaultMessage: 'Fields to remove.', + defaultMessage: 'Fields that should be included in the fingerprint.', }), validations: [ { From 1831cbd1a3674d464c93562496eaa6e38d248cb1 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Tue, 25 May 2021 15:58:57 +0200 Subject: [PATCH 4/7] copy changes --- .../processor_form/processors/fingerprint.tsx | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx index d981380a5354f9..a068fd49467326 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx @@ -30,7 +30,7 @@ const fieldsConfig: FieldsConfig = { defaultMessage: 'Fields', }), helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.fieldNameHelpText', { - defaultMessage: 'Fields that should be included in the fingerprint.', + defaultMessage: 'Fields to include in the fingerprint.', }), validations: [ { @@ -67,7 +67,7 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'SHA-1'} }} /> ), @@ -84,7 +84,17 @@ export const Fingerprint: FunctionComponent = () => { data-test-subj="fieldsValueField" /> - + {'fingerprint'}, + }} + /> + } + /> { data-test-subj="saltValueField" /> - + {'fields'}, + }} + /> + } + /> ); }; From d45af568af41eb299f16498043cf68255aad859d Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Wed, 26 May 2021 09:39:45 +0200 Subject: [PATCH 5/7] Preselect default method value by default --- .../__jest__/processors/fingerprint.test.tsx | 10 +++-- .../processor_form/processors/fingerprint.tsx | 39 ++++++++----------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx index 47250515b7e446..269620bd2f4300 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx @@ -12,7 +12,7 @@ import { setup, SetupResult, getProcessorValue } from './processor.helpers'; const defaultFingerprintParameters = { if: undefined, tag: undefined, - method: undefined, + method: 'SHA-1', salt: undefined, description: undefined, ignore_missing: undefined, @@ -75,7 +75,7 @@ describe('Processor: Fingerprint', () => { component, } = testBed; - // Add "type" value (required) + // Add "fields" value (required) await act(async () => { find('fieldsValueField.input').simulate('change', [{ label: 'user' }]); }); @@ -98,7 +98,7 @@ describe('Processor: Fingerprint', () => { component, } = testBed; - // Add "field" value (required) + // Add "fields" value (required) await act(async () => { find('fieldsValueField.input').simulate('change', [{ label: 'user' }]); }); @@ -108,6 +108,8 @@ describe('Processor: Fingerprint', () => { form.setInputValue('targetField.input', 'target_field'); form.setSelectValue('methodsValueField', 'SHA-256'); form.setInputValue('saltValueField.input', 'salt'); + form.toggleEuiSwitch('ignoreMissingSwitch.input'); + form.toggleEuiSwitch('ignoreFailureSwitch.input'); // Save the field with new changes await saveNewProcessor(); @@ -119,6 +121,8 @@ describe('Processor: Fingerprint', () => { target_field: 'target_field', method: 'SHA-256', salt: 'salt', + ignore_missing: true, + ignore_failure: true, }); }); }); diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx index a068fd49467326..c225221c47d3cc 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx @@ -60,17 +60,26 @@ const fieldsConfig: FieldsConfig = { }, method: { type: FIELD_TYPES.TEXT, + defaultValue: 'SHA-1', serializer: from.emptyStringToUndefined, label: i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.methodFieldLabel', { - defaultMessage: 'Method (optional)', + defaultMessage: 'Method', }), helpText: ( {'SHA-1'} }} + defaultMessage="Hash method used to compute the fingerprint." /> ), + validations: [ + { + validator: fieldValidators.emptyField( + i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.methodRequiredError', { + defaultMessage: 'A method value is required.', + }) + ), + }, + ], }, }; @@ -103,37 +112,23 @@ export const Fingerprint: FunctionComponent = () => { options: [ { value: 'MD5', - text: i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.md5Option', { - defaultMessage: 'MD5', - }), + text: 'MD5', }, { value: 'SHA-1', - text: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.fingerprint.sha1Option', - { defaultMessage: 'SHA-1' } - ), + text: 'SHA-1', }, { value: 'SHA-256', - text: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.fingerprint.sha256Option', - { defaultMessage: 'SHA-256' } - ), + text: 'SHA-256', }, { value: 'SHA-512', - text: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.fingerprint.sha512Option', - { defaultMessage: 'SHA-512' } - ), + text: 'SHA-512', }, { value: 'MurmurHash3', - text: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.fingerprint.murmurhash3Option', - { defaultMessage: 'MurmurHash3' } - ), + text: 'MurmurHash3', }, ], }, From 2fe5ee154a41c4b323662ea5104831046ac19a10 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Wed, 26 May 2021 14:38:14 +0200 Subject: [PATCH 6/7] remove not needed validation --- .../components/processor_form/processors/fingerprint.tsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx index c225221c47d3cc..aa30196173885f 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx @@ -71,15 +71,6 @@ const fieldsConfig: FieldsConfig = { defaultMessage="Hash method used to compute the fingerprint." /> ), - validations: [ - { - validator: fieldValidators.emptyField( - i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.methodRequiredError', { - defaultMessage: 'A method value is required.', - }) - ), - }, - ], }, }; From b0170455c3bfef9eddc5b6153bd0ef74f0caef1a Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Wed, 26 May 2021 16:06:21 +0200 Subject: [PATCH 7/7] remove default value from req with a serializer --- .../pipeline_editor/__jest__/processors/fingerprint.test.tsx | 2 +- .../components/processor_form/processors/fingerprint.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx index 269620bd2f4300..7c2ca012a04607 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/fingerprint.test.tsx @@ -12,7 +12,7 @@ import { setup, SetupResult, getProcessorValue } from './processor.helpers'; const defaultFingerprintParameters = { if: undefined, tag: undefined, - method: 'SHA-1', + method: undefined, salt: undefined, description: undefined, ignore_missing: undefined, diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx index aa30196173885f..5e52d560020c01 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/fingerprint.tsx @@ -59,9 +59,9 @@ const fieldsConfig: FieldsConfig = { ), }, method: { - type: FIELD_TYPES.TEXT, + type: FIELD_TYPES.SELECT, defaultValue: 'SHA-1', - serializer: from.emptyStringToUndefined, + serializer: (v) => (v === 'SHA-1' || v === '' ? undefined : v), label: i18n.translate('xpack.ingestPipelines.pipelineEditor.fingerprint.methodFieldLabel', { defaultMessage: 'Method', }),