From 93811b511f80f676200766d430780d69803e9516 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Wed, 30 Jun 2021 14:03:21 +0300 Subject: [PATCH 01/18] wip: community_id processor --- .../processors/community_id.tsx | 288 ++++++++++++++++++ .../processor_form/processors/index.ts | 1 + .../shared/map_processor_type_to_form.tsx | 15 + 3 files changed, 304 insertions(+) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx new file mode 100644 index 0000000000000..372aa4b4110a1 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -0,0 +1,288 @@ +/* + * 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 { EuiSpacer, EuiCode, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; + +import { FieldsConfig, from } from './shared'; +import { TargetField } from './common_fields/target_field'; +import { IgnoreMissingField } from './common_fields/ignore_missing_field'; +import { + FIELD_TYPES, + useFormData, + SerializerFunc, + UseField, + Field, + NumericField, + fieldFormatters, + fieldValidators +} from '../../../../../../shared_imports'; + +const seedBoundriesValidator = { + max: fieldValidators.numberSmallerThanField({ + than: 65535, + allowEquality: true, + message: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.communityId.seedMaxNumberError', + { defaultMessage: 'This number must be less or equal than 65535.' } + ), + }), + min: fieldValidators.numberGreaterThanField({ + than: 0, + allowEquality: true, + message: i18n.translate( + 'xpack.ingestPipelines.pipelineEditor.communityId.seedMinNumberError', + { defaultMessage: 'This number must be greater or equals than 0.' } + ), + }), +}; + +const fieldsConfig: FieldsConfig = { + source_ip: { + type: FIELD_TYPES.TEXT, + serializer: from.emptyStringToUndefined, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.sourceIpLabel', { + defaultMessage: 'Source IP (optional)', + }), + helpText: ( + + ), + }, + source_port: { + type: FIELD_TYPES.TEXT, + serializer: from.emptyStringToUndefined, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.sourcePortLabel', { + defaultMessage: 'Source port (optional)', + }), + helpText: ( + + ), + }, + destination_ip: { + type: FIELD_TYPES.TEXT, + serializer: from.emptyStringToUndefined, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.destinationIpLabel', { + defaultMessage: 'Destination IP (optional)', + }), + helpText: ( + + ), + }, + destination_port: { + type: FIELD_TYPES.TEXT, + serializer: from.emptyStringToUndefined, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.destinationPortLabel', { + defaultMessage: 'Destination port (optional)', + }), + helpText: ( + + ), + }, + icmp_type: { + type: FIELD_TYPES.TEXT, + serializer: from.emptyStringToUndefined, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.icmpTypeLabel', { + defaultMessage: 'ICMP type (optional)', + }), + helpText: ( + + ), + }, + icmp_code: { + type: FIELD_TYPES.TEXT, + serializer: from.emptyStringToUndefined, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.icmpCodeLabel', { + defaultMessage: 'ICMP code (optional)', + }), + helpText: ( + + ), + }, + iana_number: { + type: FIELD_TYPES.TEXT, + serializer: from.emptyStringToUndefined, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.ianaLabel', { + defaultMessage: 'IANA number (optional)', + }), + helpText: ( + + ), + }, + transport: { + type: FIELD_TYPES.TEXT, + serializer: from.emptyStringToUndefined, + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.transportLabel', { + defaultMessage: 'Transport (optional)', + }), + helpText: ( + + ), + }, + seed: { + type: FIELD_TYPES.NUMBER, + formatters: [fieldFormatters.toInt], + serializer: from.undefinedIfValue(0), + label: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedLabel', { + defaultMessage: 'Seed (optional)', + }), + helpText: ( + + ), + validations: [{ + validator: (field) => { + if (field.value) { + return seedBoundriesValidator.max(field) ?? seedBoundriesValidator.min(field); + } + }, + }], + }, +}; + +/* + iana_number defaults to network.iana_number, not required + if defined, also show transport => default to network.transport not required +*/ +export const CommunityId: FunctionComponent = () => { + const [{ fields }] = useFormData({ watch: 'fields.iana_number' }); + + return ( + <> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {fields?.iana_number && + + } + + + + + + + + {'network.community_id'}, + }} + /> + } + /> + + } + /> + + ); +}; 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 5e3e5f82478bd..4ef556b64e876 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 @@ -8,6 +8,7 @@ export { Append } from './append'; export { Bytes } from './bytes'; export { Circle } from './circle'; +export { CommunityId } from './community_id'; export { Convert } from './convert'; export { CSV } from './csv'; export { DateProcessor } from './date'; 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 983fb0ea67bb0..6b92ab8c3657b 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 @@ -14,6 +14,7 @@ import { Append, Bytes, Circle, + CommunityId, Convert, CSV, DateProcessor, @@ -125,6 +126,20 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }, }), }, + community_id: { + FieldsComponent: CommunityId, + docLinkPath: '/community-id-processor.html', + label: i18n.translate('xpack.ingestPipelines.processors.label.communityId', { + defaultMessage: 'Community id', + }), + typeDescription: i18n.translate('xpack.ingestPipelines.processors.description.communityId', { + defaultMessage: 'Computes the Community ID for network flow data.', + }), + getDefaultDescription: () => + i18n.translate('xpack.ingestPipelines.processors.defaultDescription.communityId', { + defaultMessage: 'Computes the Community ID for network flow data.', + }), + }, convert: { FieldsComponent: Convert, docLinkPath: '/convert-processor.html', From 8ba5838120c671b2e2d0014022754a9f467bda5f Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Wed, 30 Jun 2021 17:22:57 +0300 Subject: [PATCH 02/18] fix up validation conditions for fields --- .../processors/community_id.tsx | 42 +++++++++---------- .../context/processors_context.tsx | 6 ++- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index 372aa4b4110a1..30bd534339b6f 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -21,25 +21,23 @@ import { Field, NumericField, fieldFormatters, - fieldValidators + fieldValidators, } from '../../../../../../shared_imports'; -const seedBoundriesValidator = { +const seedValidator = { max: fieldValidators.numberSmallerThanField({ than: 65535, allowEquality: true, - message: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.communityId.seedMaxNumberError', - { defaultMessage: 'This number must be less or equal than 65535.' } - ), + message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMaxNumberError', { + defaultMessage: 'This number must be equals or less than 65535.', + }), }), min: fieldValidators.numberGreaterThanField({ than: 0, allowEquality: true, - message: i18n.translate( - 'xpack.ingestPipelines.pipelineEditor.communityId.seedMinNumberError', - { defaultMessage: 'This number must be greater or equals than 0.' } - ), + message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMinNumberError', { + defaultMessage: 'This number must be equals or greater than 0.', + }), }), }; @@ -151,7 +149,7 @@ const fieldsConfig: FieldsConfig = { seed: { type: FIELD_TYPES.NUMBER, formatters: [fieldFormatters.toInt], - serializer: from.undefinedIfValue(0), + serializer: from.undefinedIfValue(''), label: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedLabel', { defaultMessage: 'Seed (optional)', }), @@ -161,20 +159,18 @@ const fieldsConfig: FieldsConfig = { defaultMessage="Seed for the community ID hash." /> ), - validations: [{ - validator: (field) => { - if (field.value) { - return seedBoundriesValidator.max(field) ?? seedBoundriesValidator.min(field); - } + validations: [ + { + validator: (field) => { + if (field.value) { + return seedValidator.max(field) ?? seedValidator.min(field); + } + }, }, - }], + ], }, }; -/* - iana_number defaults to network.iana_number, not required - if defined, also show transport => default to network.transport not required -*/ export const CommunityId: FunctionComponent = () => { const [{ fields }] = useFormData({ watch: 'fields.iana_number' }); @@ -247,14 +243,14 @@ export const CommunityId: FunctionComponent = () => { /> - {fields?.iana_number && + {!fields?.iana_number && ( - } + )} diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx index 0c43297e811d3..393fcb368d429 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx @@ -150,8 +150,12 @@ export const PipelineProcessorsContextProvider: FunctionComponent = ({ }); break; case 'managingProcessor': + const whitelistFields = ['transport', 'iana_number']; // These are the option names we get back from our UI - const knownOptionNames = Object.keys(processorTypeAndOptions.options); + const knownOptionNames = [ + ...Object.keys(processorTypeAndOptions.options), + ...whitelistFields, + ]; // The processor that we are updating may have options configured the UI does not know about const unknownOptions = omit(mode.arg.processor.options, knownOptionNames); // In order to keep the options we don't get back from our UI, we merge the known and unknown options From 9892aaf1e8e1647f8b331d9f56f231f2bc4ab91b Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Thu, 1 Jul 2021 10:25:58 +0300 Subject: [PATCH 03/18] add tests --- .../__jest__/processors/community_id.test.tsx | 120 ++++++++++++++++++ .../__jest__/processors/processor.helpers.tsx | 11 ++ .../processors/community_id.tsx | 38 +++--- 3 files changed, 151 insertions(+), 18 deletions(-) create mode 100644 x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx new file mode 100644 index 0000000000000..7fa19c4233390 --- /dev/null +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx @@ -0,0 +1,120 @@ +/* + * 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 community_id processor when saved +const defaultCommunityIdParams = { + if: undefined, + tag: undefined, + description: undefined, + target_field: undefined, + ignore_missing: undefined, + ignore_failure: undefined, +}; + +const COMMUNITY_ID_TYPE = 'community_id'; + +describe('Processor: Community id', () => { + 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(COMMUNITY_ID_TYPE); + }); + + test('can submit if no fields are filled', async () => { + const { + actions: { saveNewProcessor }, + form, + } = testBed; + + // Click submit button with no fields filled + await saveNewProcessor(); + + // Expect no form errors + expect(form.getErrorsMessages()).toHaveLength(0); + }); + + test('allows to set either iana_number or transport', async () => { + const { find, form } = testBed; + + expect(find('ianaField.input').exists()).toBe(true); + expect(find('transportField.input').exists()).toBe(true); + + form.setInputValue('ianaField.input', 'iana_number'); + expect(find('transportField').exists()).toBe(false); + + form.setInputValue('ianaField.input', ''); + form.setInputValue('transportField.input', 'transport'); + expect(find('ianaField').exists()).toBe(false); + }); + + test('allows optional parameters to be set', async () => { + const { + actions: { saveNewProcessor }, + form, + } = testBed; + + form.toggleEuiSwitch('ignoreMissingSwitch.input'); + form.toggleEuiSwitch('ignoreFailureSwitch.input'); + form.setInputValue('sourceIpField.input', 'source.ip'); + form.setInputValue('sourcePortField.input', 'source.port'); + form.setInputValue('targetField.input', 'target_field'); + form.setInputValue('destinationIpField.input', 'destination.ip'); + form.setInputValue('destinationPortField.input', 'destination.port'); + form.setInputValue('icmpTypeField.input', 'icmp_type'); + form.setInputValue('icmpCodeField.input', 'icmp_code'); + form.setInputValue('ianaField.input', 'iana'); + form.setInputValue('seedField.input', '10'); + + // Save the field with new changes + await saveNewProcessor(); + + const processors = getProcessorValue(onUpdate, COMMUNITY_ID_TYPE); + expect(processors[0][COMMUNITY_ID_TYPE]).toEqual({ + ...defaultCommunityIdParams, + ignore_failure: true, + ignore_missing: false, + target_field: 'target_field', + source_ip: 'source.ip', + source_port: 'source.port', + destination_ip: 'destination.ip', + destination_port: 'destination.port', + icmp_type: 'icmp_type', + icmp_code: 'icmp_code', + iana_number: 'iana', + seed: 10, + }); + }); +}); 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 15e8c323b1308..219ff0f4fef2d 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 @@ -163,4 +163,15 @@ type TestSubject = | 'fieldsValueField.input' | 'saltValueField.input' | 'methodsValueField' + | 'sourceIpField.input' + | 'sourcePortField.input' + | 'destinationIpField.input' + | 'destinationPortField.input' + | 'icmpTypeField.input' + | 'icmpCodeField.input' + | 'ianaField' + | 'ianaField.input' + | 'transportField' + | 'transportField.input' + | 'seedField.input' | 'trimSwitch.input'; diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index 30bd534339b6f..d093d2d166e8a 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -7,19 +7,19 @@ import React, { FunctionComponent } from 'react'; import { i18n } from '@kbn/i18n'; -import { EuiSpacer, EuiCode, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; +import { EuiSpacer, EuiCode, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { FieldsConfig, from } from './shared'; import { TargetField } from './common_fields/target_field'; import { IgnoreMissingField } from './common_fields/ignore_missing_field'; import { - FIELD_TYPES, - useFormData, - SerializerFunc, - UseField, Field, + UseField, + useFormData, + FIELD_TYPES, NumericField, + SerializerFunc, fieldFormatters, fieldValidators, } from '../../../../../../shared_imports'; @@ -172,7 +172,7 @@ const fieldsConfig: FieldsConfig = { }; export const CommunityId: FunctionComponent = () => { - const [{ fields }] = useFormData({ watch: 'fields.iana_number' }); + const [{ fields }] = useFormData({ watch: ['fields.iana_number', 'fields.transport'] }); return ( <> @@ -234,24 +234,26 @@ export const CommunityId: FunctionComponent = () => { - - - - - {!fields?.iana_number && ( + {!fields?.transport && ( + + + + )} + {!fields?.iana_number && ( + - )} - + + )} From 137721e8acc03f6c5ecbc35f1f36c415359895cd Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Mon, 5 Jul 2021 11:51:03 +0300 Subject: [PATCH 04/18] Fix layout and tests --- .../__jest__/processors/community_id.test.tsx | 4 +- .../processors/community_id.tsx | 87 ++++++++++--------- 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx index 7fa19c4233390..5fcaf282db10d 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx @@ -73,11 +73,11 @@ describe('Processor: Community id', () => { expect(find('transportField.input').exists()).toBe(true); form.setInputValue('ianaField.input', 'iana_number'); - expect(find('transportField').exists()).toBe(false); + expect(find('transportField.input').props().disabled).toBeTruthy(); form.setInputValue('ianaField.input', ''); form.setInputValue('transportField.input', 'transport'); - expect(find('ianaField').exists()).toBe(false); + expect(find('ianaField.input').props().disabled).toBeTruthy(); }); test('allows optional parameters to be set', async () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index d093d2d166e8a..96a2e3e7217b3 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -129,7 +129,10 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'transport'}, + }} /> ), }, @@ -142,7 +145,10 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'iana_number'}, + }} /> ), }, @@ -214,49 +220,44 @@ export const CommunityId: FunctionComponent = () => { - - - - - - - - + - - {!fields?.transport && ( - - - - )} - {!fields?.iana_number && ( - - - - )} - + + - + + + Date: Tue, 6 Jul 2021 09:09:54 +0300 Subject: [PATCH 05/18] Fix copy and validations --- .../__jest__/processors/community_id.test.tsx | 11 ----------- .../processor_form/processors/community_id.tsx | 13 +++++++++++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx index 5fcaf282db10d..f081536ca17bf 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx @@ -8,16 +8,6 @@ import { act } from 'react-dom/test-utils'; import { setup, SetupResult, getProcessorValue } from './processor.helpers'; -// Default parameter values automatically added to the community_id processor when saved -const defaultCommunityIdParams = { - if: undefined, - tag: undefined, - description: undefined, - target_field: undefined, - ignore_missing: undefined, - ignore_failure: undefined, -}; - const COMMUNITY_ID_TYPE = 'community_id'; describe('Processor: Community id', () => { @@ -103,7 +93,6 @@ describe('Processor: Community id', () => { const processors = getProcessorValue(onUpdate, COMMUNITY_ID_TYPE); expect(processors[0][COMMUNITY_ID_TYPE]).toEqual({ - ...defaultCommunityIdParams, ignore_failure: true, ignore_missing: false, target_field: 'target_field', diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index 96a2e3e7217b3..31acf127cf7ec 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -24,16 +24,19 @@ import { fieldValidators, } from '../../../../../../shared_imports'; +const seedMinValue = 0; +const seedMaxValue = 65535; + const seedValidator = { max: fieldValidators.numberSmallerThanField({ - than: 65535, + than: seedMaxValue, allowEquality: true, message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMaxNumberError', { defaultMessage: 'This number must be equals or less than 65535.', }), }), min: fieldValidators.numberGreaterThanField({ - than: 0, + than: seedMinValue, allowEquality: true, message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMinNumberError', { defaultMessage: 'This number must be equals or greater than 0.', @@ -264,6 +267,12 @@ export const CommunityId: FunctionComponent = () => { component={NumericField} path="fields.seed" data-test-subj="seedField" + componentProps={{ + euiFieldProps: { + min: seedMinValue, + max: seedMaxValue, + }, + }} /> Date: Tue, 6 Jul 2021 09:16:23 +0300 Subject: [PATCH 06/18] Remove unused prop --- .../pipeline_editor/__jest__/processors/processor.helpers.tsx | 2 -- 1 file changed, 2 deletions(-) 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 11fe5bce8c8c2..7bdf53486e8e9 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 @@ -182,9 +182,7 @@ type TestSubject = | 'destinationPortField.input' | 'icmpTypeField.input' | 'icmpCodeField.input' - | 'ianaField' | 'ianaField.input' - | 'transportField' | 'transportField.input' | 'seedField.input' | 'trimSwitch.input'; From ba4693242348b4d41292b3102d0ac578b55f0f25 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Tue, 13 Jul 2021 15:40:19 +0300 Subject: [PATCH 07/18] fix test matchers --- .../__jest__/processors/community_id.test.tsx | 4 ++-- .../processor_form/processors/community_id.tsx | 16 ++++++++-------- .../context/processors_context.tsx | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx index f081536ca17bf..0338cb8e04348 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/__jest__/processors/community_id.test.tsx @@ -63,11 +63,11 @@ describe('Processor: Community id', () => { expect(find('transportField.input').exists()).toBe(true); form.setInputValue('ianaField.input', 'iana_number'); - expect(find('transportField.input').props().disabled).toBeTruthy(); + expect(find('transportField.input').props().disabled).toBe(true); form.setInputValue('ianaField.input', ''); form.setInputValue('transportField.input', 'transport'); - expect(find('ianaField.input').props().disabled).toBeTruthy(); + expect(find('ianaField.input').props().disabled).toBe(true); }); test('allows optional parameters to be set', async () => { diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index 31acf127cf7ec..d98cc4d43344e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -24,19 +24,19 @@ import { fieldValidators, } from '../../../../../../shared_imports'; -const seedMinValue = 0; -const seedMaxValue = 65535; +const SEED_MIN_VALUE = 0; +const SEED_MAX_VALUE = 65535; const seedValidator = { max: fieldValidators.numberSmallerThanField({ - than: seedMaxValue, + than: SEED_MAX_VALUE, allowEquality: true, message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMaxNumberError', { defaultMessage: 'This number must be equals or less than 65535.', }), }), min: fieldValidators.numberGreaterThanField({ - than: seedMinValue, + than: SEED_MIN_VALUE, allowEquality: true, message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMinNumberError', { defaultMessage: 'This number must be equals or greater than 0.', @@ -232,7 +232,7 @@ export const CommunityId: FunctionComponent = () => { data-test-subj="ianaField" componentProps={{ euiFieldProps: { - disabled: fields?.transport, + disabled: !!fields?.transport, }, }} /> @@ -243,7 +243,7 @@ export const CommunityId: FunctionComponent = () => { data-test-subj="transportField" componentProps={{ euiFieldProps: { - disabled: fields?.iana_number, + disabled: !!fields?.iana_number, }, }} /> @@ -269,8 +269,8 @@ export const CommunityId: FunctionComponent = () => { data-test-subj="seedField" componentProps={{ euiFieldProps: { - min: seedMinValue, - max: seedMaxValue, + min: SEED_MIN_VALUE, + max: SEED_MAX_VALUE, }, }} /> diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx index 7c2dba443fb63..3da9141ab8e5e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx @@ -153,14 +153,14 @@ export const PipelineProcessorsContextProvider: FunctionComponent = ({ // These are the option names we get back from our UI const knownOptionNames = [ ...Object.keys(processorTypeAndOptions.options), - + // We manually add fields that we **don't** want to be treated as "unknownOptions" 'internal_networks', 'internal_networks_field', 'transport', 'iana_number', ]; - + // The processor that we are updating may have options configured the UI does not know about const unknownOptions = omit(mode.arg.processor.options, knownOptionNames); // In order to keep the options we don't get back from our UI, we merge the known and unknown options From c5ef54ea1f28efb9f2f1f4f9d7c1713cf1c27b90 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Tue, 13 Jul 2021 15:41:53 +0300 Subject: [PATCH 08/18] lowercase copy --- .../components/shared/map_processor_type_to_form.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 99f4da7268884..dd61205ae2528 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 @@ -134,11 +134,11 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { defaultMessage: 'Community id', }), typeDescription: i18n.translate('xpack.ingestPipelines.processors.description.communityId', { - defaultMessage: 'Computes the Community ID for network flow data.', + defaultMessage: 'Computes the Community id for network flow data.', }), getDefaultDescription: () => i18n.translate('xpack.ingestPipelines.processors.defaultDescription.communityId', { - defaultMessage: 'Computes the Community ID for network flow data.', + defaultMessage: 'Computes the Community id for network flow data.', }), }, convert: { From bd740716fd2d7b2b083e28857113629c595ce3fd Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Tue, 13 Jul 2021 17:52:50 +0300 Subject: [PATCH 09/18] Convert hardcoded values to variables --- .../components/processor_form/processors/community_id.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index d98cc4d43344e..3d33077401614 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -32,14 +32,16 @@ const seedValidator = { than: SEED_MAX_VALUE, allowEquality: true, message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMaxNumberError', { - defaultMessage: 'This number must be equals or less than 65535.', + defaultMessage: `This number must be equals or less than {maxValue}.`, + values: { maxValue: SEED_MAX_VALUE }, }), }), min: fieldValidators.numberGreaterThanField({ than: SEED_MIN_VALUE, allowEquality: true, message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMinNumberError', { - defaultMessage: 'This number must be equals or greater than 0.', + defaultMessage: `This number must be equals or greater than ${SEED_MIN_VALUE}.`, + values: { minValue: SEED_MIN_VALUE }, }), }), }; From 26c69335be5935feef8a26262481cc06ebed7b94 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Tue, 13 Jul 2021 17:58:34 +0300 Subject: [PATCH 10/18] Remove extra dollar sign --- .../components/processor_form/processors/community_id.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/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index 3d33077401614..7839ce7a6e8f8 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -40,7 +40,7 @@ const seedValidator = { than: SEED_MIN_VALUE, allowEquality: true, message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMinNumberError', { - defaultMessage: `This number must be equals or greater than ${SEED_MIN_VALUE}.`, + defaultMessage: `This number must be equals or greater than {SEED_MIN_VALUE}.`, values: { minValue: SEED_MIN_VALUE }, }), }), From ee6d096b8942be11bc84076620b62ae9ec29353f Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Tue, 13 Jul 2021 19:31:43 +0300 Subject: [PATCH 11/18] fix copy variable --- .../components/processor_form/processors/community_id.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/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index 7839ce7a6e8f8..c1c34ad82e3c8 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -40,7 +40,7 @@ const seedValidator = { than: SEED_MIN_VALUE, allowEquality: true, message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMinNumberError', { - defaultMessage: `This number must be equals or greater than {SEED_MIN_VALUE}.`, + defaultMessage: `This number must be equals or greater than {minValue}.`, values: { minValue: SEED_MIN_VALUE }, }), }), From 40eecaa2913cbd72710bde25ff16a0c2ea312df4 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Fri, 16 Jul 2021 09:19:48 +0300 Subject: [PATCH 12/18] Update x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yulia Čech <6585477+yuliacech@users.noreply.github.com> --- .../components/shared/map_processor_type_to_form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 dd61205ae2528..b936e1bed3c3c 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 @@ -138,7 +138,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { }), getDefaultDescription: () => i18n.translate('xpack.ingestPipelines.processors.defaultDescription.communityId', { - defaultMessage: 'Computes the Community id for network flow data.', + defaultMessage: 'Computes the Community ID for network flow data.', }), }, convert: { From d9906ccba3188bcd157d36e67a26292a82e3526b Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Fri, 16 Jul 2021 09:19:55 +0300 Subject: [PATCH 13/18] Update x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yulia Čech <6585477+yuliacech@users.noreply.github.com> --- .../components/shared/map_processor_type_to_form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b936e1bed3c3c..99f4da7268884 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 @@ -134,7 +134,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { defaultMessage: 'Community id', }), typeDescription: i18n.translate('xpack.ingestPipelines.processors.description.communityId', { - defaultMessage: 'Computes the Community id for network flow data.', + defaultMessage: 'Computes the Community ID for network flow data.', }), getDefaultDescription: () => i18n.translate('xpack.ingestPipelines.processors.defaultDescription.communityId', { From 64b70f95403f62b68247bee3ef608b58bd860c9a Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Fri, 16 Jul 2021 09:20:03 +0300 Subject: [PATCH 14/18] Update x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/shared/map_processor_type_to_form.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yulia Čech <6585477+yuliacech@users.noreply.github.com> --- .../components/shared/map_processor_type_to_form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 99f4da7268884..2a7067be512ae 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 @@ -131,7 +131,7 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = { FieldsComponent: CommunityId, docLinkPath: '/community-id-processor.html', label: i18n.translate('xpack.ingestPipelines.processors.label.communityId', { - defaultMessage: 'Community id', + defaultMessage: 'Community ID', }), typeDescription: i18n.translate('xpack.ingestPipelines.processors.description.communityId', { defaultMessage: 'Computes the Community ID for network flow data.', From 19d500f89b65800558925a5a706920505aedbd70 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Fri, 16 Jul 2021 09:20:12 +0300 Subject: [PATCH 15/18] Update x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yulia Čech <6585477+yuliacech@users.noreply.github.com> --- .../components/processor_form/processors/community_id.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/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index c1c34ad82e3c8..5198c060ee99f 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -40,7 +40,7 @@ const seedValidator = { than: SEED_MIN_VALUE, allowEquality: true, message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMinNumberError', { - defaultMessage: `This number must be equals or greater than {minValue}.`, + defaultMessage: `This number must be equal or greater than {minValue}.`, values: { minValue: SEED_MIN_VALUE }, }), }), From 0dabf68ec5bd64084f3855ba17d4ac9a2c98ccc1 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Fri, 16 Jul 2021 09:20:19 +0300 Subject: [PATCH 16/18] Update x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yulia Čech <6585477+yuliacech@users.noreply.github.com> --- .../components/processor_form/processors/community_id.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/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index 5198c060ee99f..9274b8df422d8 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -32,7 +32,7 @@ const seedValidator = { than: SEED_MAX_VALUE, allowEquality: true, message: i18n.translate('xpack.ingestPipelines.pipelineEditor.communityId.seedMaxNumberError', { - defaultMessage: `This number must be equals or less than {maxValue}.`, + defaultMessage: `This number must be equal or less than {maxValue}.`, values: { maxValue: SEED_MAX_VALUE }, }), }), From 7e399a3402c5915bc7a4baf4e900922f704fd7d2 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Fri, 16 Jul 2021 09:36:11 +0300 Subject: [PATCH 17/18] No need to whitelist known fields --- .../components/pipeline_editor/context/processors_context.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx index 3da9141ab8e5e..ddf996de7805c 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/context/processors_context.tsx @@ -153,12 +153,9 @@ export const PipelineProcessorsContextProvider: FunctionComponent = ({ // These are the option names we get back from our UI const knownOptionNames = [ ...Object.keys(processorTypeAndOptions.options), - // We manually add fields that we **don't** want to be treated as "unknownOptions" 'internal_networks', 'internal_networks_field', - 'transport', - 'iana_number', ]; // The processor that we are updating may have options configured the UI does not know about From 77d00ea8e208424aaad8a84f95efedf1eaec1544 Mon Sep 17 00:00:00 2001 From: Ignacio Rivas Date: Mon, 19 Jul 2021 09:12:28 +0300 Subject: [PATCH 18/18] CR changes --- .../processors/community_id.tsx | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx index 9274b8df422d8..cd6f97d0a299e 100644 --- a/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx +++ b/x-pack/plugins/ingest_pipelines/public/application/components/pipeline_editor/components/processor_form/processors/community_id.tsx @@ -56,7 +56,8 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'source.ip'} }} /> ), }, @@ -69,7 +70,8 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'source.port'} }} /> ), }, @@ -82,7 +84,8 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'destination.ip'} }} /> ), }, @@ -95,7 +98,8 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'destination.port'} }} /> ), }, @@ -108,7 +112,8 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'icmp.type'} }} /> ), }, @@ -121,7 +126,8 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'icmp.code'} }} /> ), }, @@ -134,9 +140,10 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'transport'}, + field: {'Transport'}, + defaultValue: {'network.iana_number'}, }} /> ), @@ -150,9 +157,10 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'iana_number'}, + field: {'IANA number'}, + defaultValue: {'network.transport'}, }} /> ), @@ -167,7 +175,8 @@ const fieldsConfig: FieldsConfig = { helpText: ( {'0'} }} /> ), validations: [