-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Ingest Pipelines] Processor forms for processors A-D (#72849)
* First few processors of the first batch - Also refactored options to live in scoped objects to avoid overriding type (important fix!) - Have not polished copy or form layout. * add type to shared imports * Refactors for repeated fields and added forms - date_index_name - dissect - dot_expander - drop Fields refactored: - Field - Ignore missing * Fix broken imports and some other small refactors * added text editor field and updated pattern and if fields * Large copy improvements and updates and other small refactors - Added help text for all fields - Updated layout so that required fields are always on first - Replaced circle radio group with a select drop down * update circle shape type field to select * Added "long" option for convert type * fix path import * fix types and i18n * add validation for dot expander fix append value to be a combobox * fix i18n Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
c7a46d5
commit 50f3328
Showing
26 changed files
with
1,347 additions
and
87 deletions.
There are no files selected for viewing
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
38 changes: 38 additions & 0 deletions
38
...eline_processors_editor/components/manage_processor_form/field_components/text_editor.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,38 @@ | ||
/* | ||
* 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 { EuiPanel } from '@elastic/eui'; | ||
import React, { FunctionComponent } from 'react'; | ||
import { EuiFormRow } from '@elastic/eui'; | ||
import { | ||
CodeEditor, | ||
FieldHook, | ||
getFieldValidityAndErrorMessage, | ||
} from '../../../../../../shared_imports'; | ||
|
||
interface Props { | ||
field: FieldHook<string>; | ||
editorProps: { [key: string]: any }; | ||
} | ||
|
||
export const TextEditor: FunctionComponent<Props> = ({ field, editorProps }) => { | ||
const { value, helpText, setValue, label } = field; | ||
const { errorMessage } = getFieldValidityAndErrorMessage(field); | ||
|
||
return ( | ||
<EuiFormRow | ||
label={label} | ||
helpText={helpText} | ||
isInvalid={typeof errorMessage === 'string'} | ||
error={errorMessage} | ||
fullWidth | ||
> | ||
<EuiPanel paddingSize="s" hasShadow={false}> | ||
<CodeEditor value={value} onChange={setValue} {...(editorProps as any)} /> | ||
</EuiPanel> | ||
</EuiFormRow> | ||
); | ||
}; |
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
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
56 changes: 56 additions & 0 deletions
56
...ponents/pipeline_processors_editor/components/manage_processor_form/processors/append.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,56 @@ | ||
/* | ||
* 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, | ||
fieldValidators, | ||
UseField, | ||
ComboBoxField, | ||
} from '../../../../../../shared_imports'; | ||
|
||
import { FieldsConfig } from './shared'; | ||
import { FieldNameField } from './common_fields/field_name_field'; | ||
|
||
const { emptyField } = fieldValidators; | ||
|
||
const fieldsConfig: FieldsConfig = { | ||
value: { | ||
type: FIELD_TYPES.COMBO_BOX, | ||
deserializer: (v) => (Array.isArray(v) ? v : [String(v)]), | ||
label: i18n.translate('xpack.ingestPipelines.pipelineEditor.appendForm.valueFieldLabel', { | ||
defaultMessage: 'Value', | ||
}), | ||
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.appendForm.valueFieldHelpText', { | ||
defaultMessage: 'The value to be appended by this processor.', | ||
}), | ||
validations: [ | ||
{ | ||
validator: emptyField( | ||
i18n.translate('xpack.ingestPipelines.pipelineEditor.appendForm.valueRequiredError', { | ||
defaultMessage: 'A value to set is required.', | ||
}) | ||
), | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
export const Append: FunctionComponent = () => { | ||
return ( | ||
<> | ||
<FieldNameField | ||
helpText={i18n.translate('xpack.ingestPipelines.pipelineEditor.appendForm.fieldHelpText', { | ||
defaultMessage: 'The field to be appended to.', | ||
})} | ||
/> | ||
|
||
<UseField config={fieldsConfig.value} component={ComboBoxField} path="fields.value" /> | ||
</> | ||
); | ||
}; |
43 changes: 43 additions & 0 deletions
43
...mponents/pipeline_processors_editor/components/manage_processor_form/processors/bytes.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 { 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'; | ||
|
||
const fieldsConfig: FieldsConfig = { | ||
target_field: { | ||
type: FIELD_TYPES.TEXT, | ||
label: i18n.translate('xpack.ingestPipelines.pipelineEditor.bytesForm.targetFieldLabel', { | ||
defaultMessage: 'Target field (optional)', | ||
}), | ||
helpText: i18n.translate('xpack.ingestPipelines.pipelineEditor.bytesForm.targetFieldHelpText', { | ||
defaultMessage: 'The field to assign the converted value to', | ||
}), | ||
}, | ||
}; | ||
|
||
export const Bytes: FunctionComponent = () => { | ||
return ( | ||
<> | ||
<FieldNameField | ||
helpText={i18n.translate( | ||
'xpack.ingestPipelines.pipelineEditor.bytesForm.fieldNameHelpText', | ||
{ defaultMessage: 'The field to convert.' } | ||
)} | ||
/> | ||
|
||
<UseField config={fieldsConfig.target_field} component={Field} path="fields.target_field" /> | ||
|
||
<IgnoreMissingField /> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.