-
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
[Mappings editor] Add UI/UX to mappings core #48876
[Mappings editor] Add UI/UX to mappings core #48876
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. |
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.
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> |
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.
Very elegant!
...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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
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
object
ornested
type. A multi-field is different. It is not a property of the field. It is the same field but indexed differently (e.g. atext
field can also be indexed askeyword
for aggregation or atext
field can be indexed as anothertext
type 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
object
andnested
type should not be available in the select dropdown as those are not valid types for multi-field.