-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 Node Pipeline] Pipeline Processors Editor #63694
Conversation
* First iteration of ingest table * Add action placeholders * Refactor list and address PR feedback Refactored the list into smaller pieces and assemble in main.tsx Also addressed feedback on copy, removed unused notifications dep * WiP on flyout Showing name in title * Add reload button * Finish first version of flyout * Slight update to copy * `delete` -> `edit` * Address PR feedback Copy and a11y updates * Add on failure JSON to flyout if it is available * Add details json block file and remove ununsed import Co-authored-by: Elastic Machine <[email protected]>
…bana into pipeline-editor-part-mvp-1 * 'feature/ingest-node-pipelines' of github.com:elastic/kibana: [Ingest pipelines] Edit pipeline page (elastic#63522) # Conflicts: # x-pack/plugins/ingest_pipelines/public/application/sections/pipelines_create/pipelines_create.tsx # x-pack/plugins/ingest_pipelines/public/shared_imports.ts
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
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.
Great work @jloleysens! It’s awesome to start seeing this come together.
Overall, I was able to easily follow along the code. I do think it would be helpful though to update the PR description with some notes around the general architecture decisions you made, so it’s documented and also so others can come along and easily review.
I left a few comments in the code. Some other general thoughts I had:
- I like having the field configs live within each processor type
- I like the “dumb” file names given for data manipulation (
data_in
anddata_out
) - DnD 👌
- I don’t know that I agree with the
pipeline_processors_editor
directory living directly underapplication
(not sure if this was an intentional decision or not) - I noticed a few places where i18n is missing and there is not a
todo
. I can make a note of them if you’d like, but not sure if it was necessary for the initial review. - [bug] I noticed the processors data for the ES request flyout isn’t updated
...ns/ingest_pipelines/public/application/pipeline_processors_editor/components/form_flyout.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ingest_pipelines/public/application/pipeline_processors_editor/reducer.ts
Outdated
Show resolved
Hide resolved
...ns/ingest_pipelines/public/application/pipeline_processors_editor/components/form_flyout.tsx
Outdated
Show resolved
Hide resolved
...on/pipeline_processors_editor/components/processor_settings_form/processor_settings_form.tsx
Outdated
Show resolved
Hide resolved
Thanks for the review @alisonelizabeth !
At the time this was an intentional decision, I was trying to think of ingest pipeline editor as a separate app (not a component inside of ingest pipelines). Even though it is consumed as a component inside of ingest pipelines. What do you think about moving it to |
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.
Nice work @jloleysens! This is looking great. I went through the code again and left some more comments.
A couple other things I noticed while testing:
- I noticed a React warning in the console when adding an
on_failure
processor - The 'Delete' functionality was buggy for me. I didn't look into it in too much detail, but sometimes the UI did not remove the processor. If I continued to click "Delete" for all of them, it eventually broke the UI.
- Dragging a processor into another one took me a little bit to get the hang of. Possibly just me though 😄 . I haven't really played around with the EUI component much, so not sure how much flexibility we have here.
const subscription = form.subscribe(onFormUpdate); | ||
return subscription.unsubscribe; | ||
|
||
// TODO: Address this issue |
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.
I think this is a bug in the form lib.
Create a separate component to connect to the form and subscribe to its changes. It is currently required to have a separate component (instead of putting the subscribing logic inside the current ) because the form object is not memoized in the lib and it creates an infinite re-render loop. This is something I will change in a future update (Probably exposing a hook useFormData() and that's it for the consumer).
See: #63522 (comment)
@@ -0,0 +1,7 @@ | |||
|
|||
.pipelineProcessorsEditor__dragAndDropTreeFixes { |
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.
Is this something we should open up an issue against EUI for?
return ( | ||
<EuiDraggable spacing="l" draggableId={id} key={id} index={index} customDragHandle> | ||
{provided => ( | ||
<EuiPanel style={{ marginLeft: 30 * level + 'px' }} paddingSize="s"> |
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.
I understand this is likely subject to change, but might make a note that this is to handle the nesting.
...plugins/ingest_pipelines/public/application/components/pipeline_processors_editor/data_in.ts
Outdated
Show resolved
Hide resolved
...ines/public/application/components/pipeline_processors_editor/pipeline_processors_editor.tsx
Outdated
Show resolved
Hide resolved
const { emptyField } = fieldValidators; | ||
|
||
const typeConfig: FieldConfig = { | ||
type: FIELD_TYPES.TEXT, |
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.
IIRC there is a FIELD_TYPES.COMBOBOX
that you can use.
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.
@alisonelizabeth Thanks for pointing that out! Do you know what effect setting it to FIELD_TYPES.COMBO_BOX
has?
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.
It maps to this: https://github.com/elastic/kibana/blob/master/src/plugins/es_ui_shared/static/forms/components/fields/combobox_field.tsx
(Not tested) I think you can do something like this:
const typeConfig: FieldConfig = {
type: FIELD_TYPES.COMBO_BOX,
label: i18n.translate('xpack.ingestPipelines.pipelineEditor.typeField.typeFieldLabel', {
defaultMessage: 'Type',
}),
defaultValue: [],
validations: [
{
validator: emptyField(
i18n.translate('xpack.ingestPipelines.pipelineEditor.typeField.fieldRequiredError', {
defaultMessage: 'A type is required.',
})
),
},
],
};
<UseField config={typeConfig} path="type" />
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.
Nice work @jloleysens! This is looking great. I went through the code again and left some more comments.
A couple other things I noticed while testing:
- I noticed a React warning in the console when adding an
on_failure
processor - The 'Delete' functionality was buggy for me. I didn't look into it in too much detail, but sometimes the UI did not remove the processor. If I continued to click "Delete" for all of them, it eventually broke the UI.
- Dragging a processor into another one took me a little bit to get the hang of. Possibly just me though 😄 . I haven't really played around with the EUI component much, so not sure how much flexibility we have here.
@alisonelizabeth Thanks for the review!
Yeah, happens only the first time when opening a flyout to add or edit a processor. Subsequent opening of the flyout does not cause this warning. I was wondering if @sebelga could weigh in here as it seems this may be related to the form lib?
Yeah I see I had not pushed my latest code which contains the fix for this!
Do you mean getting one processor to "hover" over another then turning transparent? Or just generally moving a processor up and down in an indented list? |
- added some padding around the new processors editor field - Updated use of flex box in the pipeline form fields
The test button is also now inside of the pipeline processor editor. Eventually all of this functionality should be moved into the pipeline processor editor.
👍
👍
Yeah, the hover part took me a little bit to get used to. |
@elasticmachine merge upstream |
merge conflict between base and head |
…or-part-mvp-2 * 'master' of github.com:elastic/kibana: (259 commits) SavedObjects bulkCreate API should return migrationVersion and strip the type & namespace from the id (elastic#65150) Drilldown count tooltip (elastic#65105) plugins logs start with "plugins." prefix (elastic#65710) [ML] Fix pagination reset on search query update. (elastic#65668) [SIEM] Add types to the mappings objects so extra keys cannot be introduced [apm] Update machine learning flyout and service maps docs (elastic#65517) change api endpoint and throw error (elastic#65790) [Maps] remove SLA percentage metric (elastic#65718) [Reporting] APM integration for baseline performance measurements (elastic#59967) fix(NA): noParse regex for windows on kbn optimizer (elastic#65755) [ML] DFA: ensure at least one field is included in analysis before job can be created (elastic#65320) [Data plugin] cleanup - remove unused getRoutes / routes from indexPattern object (elastic#65683) Removed skip to enable test. (elastic#65575) [Lens] Type safe migrations (elastic#65576) [Canvas] Fix nav link behavior in Canvas (elastic#65590) [Event log] Fix flaky test (elastic#65658) [Alerting] changes preconfigured actions config from array to object (elastic#65397) remove immediate functions from esqueue worker cycles (elastic#65375) [Metrics UI] Fix isAbove to only display when threshold set (elastic#65540) draft search profiler accessibility tests (elastic#62357) ... # Conflicts: # x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form_fields.tsx
💔 Build Failed
Failed CI StepsTest FailuresKibana Pipeline / x-pack-intake-agent / X-Pack Jest Tests.x-pack/plugins/ingest_pipelines/__jest__/client_integration. on component mount should toggle the on-failure processors editorStandard Out
Stack Trace
Kibana Pipeline / x-pack-intake-agent / X-Pack Jest Tests.x-pack/plugins/ingest_pipelines/__jest__/client_integration. on component mount test pipeline should open the test pipeline flyoutStandard Out
Stack Trace
History
To update your PR or re-run it, just comment with: |
It depended of what React warning 😊 #64647 Fixes a data flow issue in the form lib, once it will be merged and you rebase this branch we'll know for sure. 👍 |
Closing in favour of new feature branch PR #66021 |
Summary
Variant on #63617 where the editor focusses on processors.Branch from original PR #63617.
This involved moving JSX around and creating a way for the pipeline form component to read out data from the pipeline editor.
Note; does not handle on failure processors yet.We can render a second editor for handling the on failure processors.Notes on architecture and structure
pipeline_processors_editor
folder contains the component and it's child componentsprocessor_settings_form
child component with all validation and configuration in the same file.Notes to reviewer
Main focus has been establishing patterns for us to flesh out all the other processor forms.
All styling optimisations have been deferred until after this review and once final designs have been agreed upon.
Translations have been done or marked as TODO throughout (please flag any ones that I may have missed).
The data has not been flattened to a
byId
map which keeps the reordering and rendering logic a bit simpler for now. Optimisation other than flattening to a byId map is still possible, which I would like to explore a bit later on but for now, worst case O(n) on an array that should never grow past 50-60 (guessing?) items is acceptable IMO.Have not built rendering of on failure pipelines yet. There are some things that are still in flux here, however I can definitely work on just rending the nested list next.
Screenshot
TODO