-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
0764fc7
commit c09124c
Showing
8 changed files
with
233 additions
and
30 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...ors_editor/components/manage_processor_form/processors/common_fields/properties_field.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* 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 { EuiComboBoxOptionOption } from '@elastic/eui'; | ||
import { ComboBoxField, FIELD_TYPES, UseField } from '../../../../../../../shared_imports'; | ||
|
||
import { FieldsConfig, to } from '../shared'; | ||
|
||
const fieldsConfig: FieldsConfig = { | ||
properties: { | ||
type: FIELD_TYPES.COMBO_BOX, | ||
deserializer: to.arrayOfStrings, | ||
serializer: (v: string[]) => (v.length ? v : undefined), | ||
label: i18n.translate( | ||
'xpack.ingestPipelines.pipelineEditor.commonFields.propertiesFieldLabel', | ||
{ | ||
defaultMessage: 'Properties (optional)', | ||
} | ||
), | ||
}, | ||
}; | ||
|
||
interface Props { | ||
helpText?: React.ReactNode; | ||
propertyOptions?: EuiComboBoxOptionOption[]; | ||
} | ||
|
||
export const PropertiesField: FunctionComponent<Props> = ({ helpText, propertyOptions }) => { | ||
return ( | ||
<UseField | ||
config={{ | ||
...fieldsConfig.properties, | ||
helpText, | ||
}} | ||
component={ComboBoxField} | ||
path="fields.properties" | ||
componentProps={{ | ||
euiFieldProps: { | ||
options: propertyOptions || [], | ||
noSuggestions: !propertyOptions, | ||
}, | ||
}} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...omponents/pipeline_processors_editor/components/manage_processor_form/processors/trim.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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 { IgnoreMissingField } from './common_fields/ignore_missing_field'; | ||
import { FieldNameField } from './common_fields/field_name_field'; | ||
import { TargetField } from './common_fields/target_field'; | ||
|
||
export const Trim: FunctionComponent = () => { | ||
return ( | ||
<> | ||
<FieldNameField | ||
helpText={i18n.translate( | ||
'xpack.ingestPipelines.pipelineEditor.trimForm.fieldNameHelpText', | ||
{ defaultMessage: 'The field to trim whitespace from.' } | ||
)} | ||
/> | ||
|
||
<TargetField /> | ||
|
||
<IgnoreMissingField /> | ||
</> | ||
); | ||
}; |
29 changes: 29 additions & 0 deletions
29
...ents/pipeline_processors_editor/components/manage_processor_form/processors/uppercase.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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 { IgnoreMissingField } from './common_fields/ignore_missing_field'; | ||
import { FieldNameField } from './common_fields/field_name_field'; | ||
import { TargetField } from './common_fields/target_field'; | ||
|
||
export const Uppercase: FunctionComponent = () => { | ||
return ( | ||
<> | ||
<FieldNameField | ||
helpText={i18n.translate( | ||
'xpack.ingestPipelines.pipelineEditor.uppercaseForm.fieldNameHelpText', | ||
{ defaultMessage: 'The field to make uppercase.' } | ||
)} | ||
/> | ||
|
||
<TargetField /> | ||
|
||
<IgnoreMissingField /> | ||
</> | ||
); | ||
}; |
29 changes: 29 additions & 0 deletions
29
...nts/pipeline_processors_editor/components/manage_processor_form/processors/url_decode.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* 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 { IgnoreMissingField } from './common_fields/ignore_missing_field'; | ||
import { FieldNameField } from './common_fields/field_name_field'; | ||
import { TargetField } from './common_fields/target_field'; | ||
|
||
export const UrlDecode: FunctionComponent = () => { | ||
return ( | ||
<> | ||
<FieldNameField | ||
helpText={i18n.translate( | ||
'xpack.ingestPipelines.pipelineEditor.urlDecodeForm.fieldNameHelpText', | ||
{ defaultMessage: 'The field to decode.' } | ||
)} | ||
/> | ||
|
||
<TargetField /> | ||
|
||
<IgnoreMissingField /> | ||
</> | ||
); | ||
}; |
73 changes: 73 additions & 0 deletions
73
...nts/pipeline_processors_editor/components/manage_processor_form/processors/user_agent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* 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 { EuiComboBoxOptionOption } from '@elastic/eui'; | ||
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'; | ||
import { TargetField } from './common_fields/target_field'; | ||
import { PropertiesField } from './common_fields/properties_field'; | ||
|
||
const propertyOptions: EuiComboBoxOptionOption[] = [ | ||
{ label: 'name' }, | ||
{ label: 'os' }, | ||
{ label: 'device' }, | ||
{ label: 'original' }, | ||
{ label: 'version' }, | ||
]; | ||
|
||
const fieldsConfig: FieldsConfig = { | ||
/* Optional fields config */ | ||
regex_file: { | ||
type: FIELD_TYPES.TEXT, | ||
deserializer: String, | ||
label: i18n.translate( | ||
'xpack.ingestPipelines.pipelineEditor.userAgentForm.regexFileFieldLabel', | ||
{ | ||
defaultMessage: 'Regex file (optional)', | ||
} | ||
), | ||
helpText: i18n.translate( | ||
'xpack.ingestPipelines.pipelineEditor.userAgentForm.regexFileFieldHelpText', | ||
{ | ||
defaultMessage: | ||
'A filename containing the regular expressions for parsing the user agent string.', | ||
} | ||
), | ||
}, | ||
}; | ||
|
||
export const UserAgent: FunctionComponent = () => { | ||
return ( | ||
<> | ||
<FieldNameField | ||
helpText={i18n.translate( | ||
'xpack.ingestPipelines.pipelineEditor.userAgentForm.fieldNameHelpText', | ||
{ defaultMessage: 'The field containing the user agent string.' } | ||
)} | ||
/> | ||
|
||
<UseField config={fieldsConfig.regex_file} component={Field} path="fields.regex_file" /> | ||
|
||
<TargetField /> | ||
|
||
<PropertiesField | ||
helpText={i18n.translate( | ||
'xpack.ingestPipelines.pipelineEditor.userAgentForm.propertiesFieldHelpText', | ||
{ defaultMessage: 'Properties added to the target field.' } | ||
)} | ||
propertyOptions={propertyOptions} | ||
/> | ||
|
||
<IgnoreMissingField /> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters