[Mappings editor] Add UI/UX to mappings core#48876
[Mappings editor] Add UI/UX to mappings core#48876sebelga merged 45 commits intoelastic:feature/mappings-editorfrom
Conversation
When there aren't any fields defined on the document, we show by default the "CreateField" component to add a field.
💔 Build Failed |
💚 Build Succeeded |
|
Looks good, just a few small SCSS tweaks:
One larger change would be to keep the arrows on the left for collapse/expand for both nested children and multi-fields. Then we are keeping the same patter for showing and hiding. Could perhaps also try keeping the space for the arrow by default so there's not a jump in indentation when adding a child. |
jloleysens
left a comment
There was a problem hiding this comment.
Left some non-blocker comments - have to test locally still. For some reason I'm getting a OOM state when starting Kibana locally on this branch.
...ic/components/mappings_editor/components/document_fields/field_parameters/name_parameter.tsx
Outdated
Show resolved
Hide resolved
...agement/public/components/mappings_editor/components/document_fields/fields/create_field.tsx
Show resolved
Hide resolved
| <FormDataProvider pathsToWatch="type"> | ||
| {({ type }) => { | ||
| return <EuiFlexItem grow={false}>{renderFormFields(type)}</EuiFlexItem>; | ||
| }} | ||
| </FormDataProvider> |
...ublic/components/mappings_editor/components/document_fields/fields/edit_field/edit_field.tsx
Show resolved
Hide resolved
...ents/mappings_editor/components/document_fields/fields/edit_field/edit_field_header_form.tsx
Show resolved
Hide resolved
...legacy/plugins/index_management/public/components/mappings_editor/components/fields_tree.tsx
Show resolved
Hide resolved
...gacy/plugins/index_management/public/components/mappings_editor/constants/mappings_editor.ts
Show resolved
Hide resolved
x-pack/legacy/plugins/index_management/public/components/mappings_editor/lib/utils.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/index_management/public/components/mappings_editor/reducer.ts
Outdated
Show resolved
Hide resolved
|
|
||
| // We _also_ need to make a copy of the parent "childFields" | ||
| // array to force a re-render in the view. | ||
| if (parentField.parentId) { |
There was a problem hiding this comment.
I'm not entirely clear on why this is need - as I understand it the byId object is a flat mapping on the tree so not sure what we gain by copying the array on another id on the same object and how this change result in the update?
There was a problem hiding this comment.
You are right, the logic had some complexity because of some memoization down the component tree. I updated the logic and removed the need of those non-intuitive array updates. Thanks for pointing this!
💔 Build Failed |
jloleysens
left a comment
There was a problem hiding this comment.
Tested all the points mentioned in description and everything works as expected.
The only UX point I'd like to add is perhaps showing the shortcuts on hover to open another field editor (collapsing the current one open the other one). So on hover of the field below in the picture that edit controls on the right would show. Just a suggestion.
|
Thanks for the review @mdefazio and @jloleysens ! I have made all your recommended changes. I will merge this PR to the feature branch so I can update my current working branch. Would you mind having a look at the feature branch and confirm the design and behaviour is OK?
It was a design decision to not allow adding child or multi-field meanwhile we are in "create" or "edit" mode. But that was before the "ClickOutside" behaviour. |
💔 Build Failed |
|
This looks good to me! |
|
Hey @sebelga I see some CSS stuff in here that could be improved. I'll give you a PR to review, but some pointers from the sass docs.
An example of why this can be important. You have a naked |
|
Thanks for the review @snide I kind of followed all the recommendations you mention aside from 1 exception here and there it seems 😊
Are you referring to using camel case for the class names? |
|
Yes, I believe so... |

This PR adds the stylings + improvement on the UX to the Core of the mappings editor. It contains all the suggestions from @cjcenizal in #47335
Child field vs Multi-field
A child field is a field that belongs to an object, it is one of the properties of an
objectornestedtype. A multi-field is different. It is not a property of the field. It is the same field but indexed differently (e.g. atextfield can also be indexed askeywordfor aggregation or atextfield can be indexed as anothertexttype but with a differentanalyzer).To make the difference clear to the user, we worked with @mdefazio to have a different UI when the field is a multi-field vs if it is a property of an object (toggle on the left of the field vs having to click on the count of multi-fields to expand the fields. Also, the multi-field has a "link" icon on its left instead of a "L" bullet list, and multi-fields are separated by dash instead of a solid line.
The current implementation is not the final design from Michael, which is this one:
But, as the
<EuiBadge />does not allow a counter, we want to validate first if the UX makes sense before spending time extending the badge component.What to test
objectandnestedtype should not be available in the select dropdown as those are not valid types for multi-field.