Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ingest pipelines] add support for registered_domain processor #99643

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { setup, SetupResult, getProcessorValue } from './processor.helpers';
const defaultRegisteredDomainParameters = {
description: undefined,
if: undefined,
ignore_missing: true,
ignore_missing: undefined,
ignore_failure: undefined,
};

Expand Down Expand Up @@ -82,6 +82,29 @@ describe('Processor: Registered Domain', () => {
});
});

test('should still send ignore_missing:false when the toggle is disabled', async () => {
const {
actions: { saveNewProcessor },
form,
} = testBed;

// Add "field" value (required)
form.setInputValue('fieldNameField.input', 'field_1');

// Disable ignore missing toggle
form.toggleEuiSwitch('ignoreMissingSwitch.input');

// Save the field with new changes
await saveNewProcessor();

const processors = getProcessorValue(onUpdate, REGISTERED_DOMAIN_TYPE);
expect(processors[0][REGISTERED_DOMAIN_TYPE]).toEqual({
...defaultRegisteredDomainParameters,
field: 'field_1',
ignore_missing: false,
});
});

test('allows optional parameters to be set', async () => {
const {
actions: { saveNewProcessor },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const fieldsConfig: FieldsConfig = {
},
};

type Props = Partial<FieldConfig>;
type Props = Partial<FieldConfig<any>>;
sabarasaba marked this conversation as resolved.
Show resolved Hide resolved

export const IgnoreMissingField: FunctionComponent<Props> = (props) => (
<UseField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { i18n } from '@kbn/i18n';
import { FieldNameField } from './common_fields/field_name_field';
import { TargetField } from './common_fields/target_field';
import { IgnoreMissingField } from './common_fields/ignore_missing_field';
import { from } from './shared';

export const RegisteredDomain: FunctionComponent = () => {
return (
Expand All @@ -24,7 +25,7 @@ export const RegisteredDomain: FunctionComponent = () => {

<TargetField />

<IgnoreMissingField defaultValue={true} />
<IgnoreMissingField defaultValue={true} serializer={from.undefinedIfValue(true)} />
sabarasaba marked this conversation as resolved.
Show resolved Hide resolved
</>
);
};