-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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] Forms for processors T-U #76710
Merged
alisonelizabeth
merged 5 commits into
elastic:master
from
alisonelizabeth:ingest_pipelines/processors-t-u
Sep 14, 2020
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f14737a
forms for processors T-U
alisonelizabeth 4b8f4b1
Merge branch 'master' of github.com:elastic/kibana into ingest_pipeli…
alisonelizabeth e1f46a5
fix i18n
alisonelizabeth 7d6f017
Merge branch 'master' of github.com:elastic/kibana into ingest_pipeli…
alisonelizabeth cf59af3
address review feedback
alisonelizabeth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...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,43 @@ | ||
/* | ||
* 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 { 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; | ||
} | ||
|
||
export const PropertiesField: FunctionComponent<Props> = ({ helpText }) => { | ||
return ( | ||
<UseField | ||
config={{ | ||
...fieldsConfig.properties, | ||
helpText, | ||
}} | ||
component={ComboBoxField} | ||
path="fields.properties" | ||
/> | ||
); | ||
}; |
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 /> | ||
</> | ||
); | ||
}; |
62 changes: 62 additions & 0 deletions
62
...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,62 @@ | ||
/* | ||
* 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 { 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 fieldsConfig: FieldsConfig = { | ||
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.' } | ||
)} | ||
/> | ||
|
||
<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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit; I try to add an annotation for fields that are required vs optional. Like:
/* Optional fields config */
Above the config for optional fields. Would be nice to add that here too :)