Skip to content

Commit

Permalink
Ignore missing field should default to true
Browse files Browse the repository at this point in the history
  • Loading branch information
sabarasaba committed May 10, 2021
1 parent 432d24d commit 0522a5c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import { setup, SetupResult, getProcessorValue } from './processor.helpers';

// Default parameter values automatically added to the registered domain processor when saved
const defaultRegisteredDomainParameters = {
ignore_failure: undefined,
ignore_missing: undefined,
description: undefined,
if: undefined,
ignore_missing: true,
ignore_failure: undefined,
};

const REGISTERED_DOMAIN_TYPE = 'registered_domain';
Expand Down Expand Up @@ -41,21 +42,21 @@ describe('Processor: Registered Domain', () => {
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(REGISTERED_DOMAIN_TYPE);
});

test('prevents form submission if required fields are not provided', async () => {
const {
actions: { addProcessor, saveNewProcessor, addProcessorType },
actions: { saveNewProcessor },
form,
} = testBed;

// Open flyout to add new processor
addProcessor();

// Add type (the other fields are not visible until a type is selected)
await addProcessorType(REGISTERED_DOMAIN_TYPE);

// Click submit button with only the type defined
await saveNewProcessor();

Expand All @@ -65,14 +66,10 @@ describe('Processor: Registered Domain', () => {

test('saves with default parameter values', async () => {
const {
actions: { addProcessor, saveNewProcessor, addProcessorType },
actions: { saveNewProcessor },
form,
} = testBed;

// Open flyout to add new processor
addProcessor();
// Add type (the other fields are not visible until a type is selected)
await addProcessorType(REGISTERED_DOMAIN_TYPE);
// Add "field" value (required)
form.setInputValue('fieldNameField.input', 'field_1');
// Save the field
Expand All @@ -87,14 +84,10 @@ describe('Processor: Registered Domain', () => {

test('allows optional parameters to be set', async () => {
const {
actions: { addProcessor, addProcessorType, saveNewProcessor },
actions: { saveNewProcessor },
form,
} = testBed;

// Open flyout to add new processor
addProcessor();
// Add type (the other fields are not visible until a type is selected)
await addProcessorType(REGISTERED_DOMAIN_TYPE);
// Add "field" value (required)
form.setInputValue('fieldNameField.input', 'field_1');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export const RegisteredDomain: FunctionComponent = () => {
<FieldNameField
helpText={i18n.translate(
'xpack.ingestPipelines.pipelineEditor.registeredDomain.fieldNameHelpText',
{ defaultMessage: 'Field containing the source FQDN.' }
{ defaultMessage: 'Field containing the fully qualified domain name.' }
)}
/>

<TargetField />

<IgnoreMissingField />
<IgnoreMissingField defaultValue={true} />
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -523,18 +523,21 @@ export const mapProcessorTypeToDescriptor: MapProcessorTypeToDescriptor = {
FieldsComponent: RegisteredDomain,
docLinkPath: '/registered-domain-processor.html',
label: i18n.translate('xpack.ingestPipelines.processors.label.registeredDomain', {
defaultMessage: 'Registered Domain',
}),
typeDescription: i18n.translate('xpack.ingestPipelines.processors.description.registeredDomain', {
defaultMessage:
'Extracts the registered domain (also known as the effective top-level domain or eTLD), sub-domain, and top-level domain from a fully qualified domain name.',
defaultMessage: 'Registered domain',
}),
typeDescription: i18n.translate(
'xpack.ingestPipelines.processors.description.registeredDomain',
{
defaultMessage:
'Extracts the registered domain (also known as the effective top-level domain or eTLD), sub-domain, and top-level domain from a fully qualified domain name.',
}
),
getDefaultDescription: ({ field }) =>
i18n.translate('xpack.ingestPipelines.processors.defaultDescription.registeredDomain', {
defaultMessage:
'Extracts the registered domain, sub-domain and top-level domain from "{field}"',
values: {
field
field,
},
}),
},
Expand Down

0 comments on commit 0522a5c

Please sign in to comment.