Skip to content
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

Use EuiTokens for ES field types #57911

Merged
merged 17 commits into from
Feb 21, 2020

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Feb 18, 2020

EUI 19.0 added EuiToken types that line up with ES field types so that we can use them as a consistent way to render the symbols associated with these field types.

image

This PR will assume to update the current displays to use EuiToken and if possible, the singular component provided by Kibana: FieldIcon.

FieldIcon extends EuiToken and all of its props. However, it no longer accepts the useColor prop and instead consumers can pass down whatever color they want, including 'gray'. It also uses the scripted flag to make the token fill: 'dark' to differentiate.

Example of new usages in:

Discover

image

Graph

Screen Shot 2020-02-19 at 14 50 09 PM

Screen Shot 2020-02-19 at 14 50 16 PM

Lens

Note: The getColorForDataType method no longer returned the correct color and EuiProgress doesn’t currently support all the colors from the token map, so it was removed. @cchaos will follow up with a PR to address the coloring of the field data charts. Right now they will fallback to pink for progress and default for charts.

Screen Shot 2020-02-19 at 14 14 28 PM

Screen Shot 2020-02-19 at 14 14 53 PM

Maps

Screen Shot 2020-02-19 at 16 04 15 PM

Screen Shot 2020-02-19 at 16 04 36 PM

Screen Shot 2020-02-19 at 16 04 58 PM

Checklist

Delete any items that are not applicable to this PR.

For maintainers

cchaos added 7 commits February 18, 2020 15:09
# Conflicts:
#	src/plugins/kibana_react/public/field_icon/__snapshots__/field_icon.test.tsx.snap
#	src/plugins/kibana_react/public/field_icon/field_icon.tsx
# Conflicts:
#	x-pack/legacy/plugins/lens/public/indexpattern_plugin/datapanel.tsx
# Conflicts:
#	src/legacy/core_plugins/kibana/public/discover/np_ready/components/table/table_row.tsx
#	src/legacy/ui/public/directives/field_name/field_name.tsx
@snide
Copy link
Contributor

snide commented Feb 18, 2020

Yell when / if this is ready for review. Did a visual scan and it looks ok. Noticed some tiny things in the code. Also tried merging this into my discover branch and it seems to do OK,

@alisonelizabeth
Copy link
Contributor

This is awesome! It would be great to incorporate these icons into the mappings editor at some point. I did a quick audit, and there are a few field types that are available in the mappings editor, but do not have a dedicated icon. Here is the list with a brief description, along with a link to the documentation.

  • Binary: a binary value as a Base64-encoded string
  • Completion suggester: provides autocomplete functionality
  • Dense vector: stores vectors of float values
  • Flattened: maps an object as a single field
  • Join: defines parent-child relationships among documents of the same index
  • Keyword: supports searching for an exact value
  • Percolator: enables percolator queries
  • Rank feature: accepts a number that will boost documents in rank_feature queries
  • Rank features: accepts numeric vectors that will boost documents in rank_feature queries
  • Search-as-you-type: breaks strings into subfields for search suggestions, and will match terms at any position in the string
  • Text: supports full-text search by breaking strings into individual, searchable terms
  • Token Count: accepts string values; these values are analyzed, and the number of tokens in the string are indexed

@cchaos
Copy link
Contributor Author

cchaos commented Feb 19, 2020

Thank you @alisonelizabeth !! Some of these other field types are quite complicated and I think it will take some time to come up with a visual mapping for each (or groups of types). For this particular PR, since most of the UI's I'm tackling use the simple ones that already have mappings (otherwise they just show a ?), I'd like to create a separate issue and follow-up PR for the rest of these.

But let me know if there are any in the list that absolutely need to be addressed ASAP and I'll work to incorporate those in here. But we'll definitely get some visual mappings figured out for your implementation in the mappings editor.

@alisonelizabeth
Copy link
Contributor

@cchaos That works for me - thanks! I don't think there are any that need to be addressed immediately. We are already tracking this work via #57159.

cchaos added 7 commits February 19, 2020 14:49
The method no longer returns the correct color and EuiProgress doesn’t currently support all the colors from the token map. @cchaos will follow up with a PR to address the coloring of the field data charts. Right now they will fallback to pink for progress and default for charts.
@cchaos cchaos marked this pull request as ready for review February 19, 2020 21:38
@cchaos cchaos requested a review from a team February 19, 2020 21:38
@cchaos cchaos requested review from a team as code owners February 19, 2020 21:38
@cchaos cchaos changed the title [WIP] Use EuiTokens for ES field types Use EuiTokens for ES field types Feb 19, 2020
@cchaos cchaos requested a review from snide February 20, 2020 03:02
Copy link
Contributor

@kindsun kindsun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maps lgtm! Really nice improvement. Looks great!

  • code review
  • tested locally in chrome

@kertal kertal self-requested a review February 20, 2020 19:57
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graph changes LGTM, also looked briefly through Discover and Lens and everything looks fine for me. Thanks a lot for this!

@cchaos
Copy link
Contributor Author

cchaos commented Feb 21, 2020

@elasticmachine merge upstream

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, very nice change!

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple questions. Looked locally though and seems ok.

<EuiHighlight search={searchValue}>{option.label}</EuiHighlight>
</span>
<EuiFlexGroup className={contentClassName} gutterSize="s" alignItems="center">
<EuiFlexItem grow={null}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the null on purpose here?

<EuiHighlight search={searchValue}>{option.label}</EuiHighlight>
</span>
<EuiFlexGroup className={contentClassName} gutterSize="s" alignItems="center">
<EuiFlexItem grow={null}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values aren't technically wrong, so I'm just going to allow them.

@cchaos cchaos requested a review from snide February 21, 2020 19:12
Copy link
Contributor

@mattkime mattkime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@cchaos cchaos merged commit 5fefb76 into elastic:master Feb 21, 2020
@cchaos cchaos deleted the working/tokens_for_field_types branch February 21, 2020 23:30
mbondyra added a commit to mbondyra/kibana that referenced this pull request Feb 22, 2020
…_improve-advanced-settings-save

* commit '98aa1d2d4f974f72a9a5397b1b91f11509f6fb7a':
  [SIEM] [Case] Enable case by default. Snake to camel on UI (elastic#57936)
  [File upload] Update remaining File Upload dependencies for NP migration (elastic#58128)
  Use EuiTokens for ES field types (elastic#57911)
  Added UI support for the default action group for Alert Type Model (elastic#57603)
  force savedObject API consumers to define SO type explicitly (elastic#58022)
  Update dependency @elastic/charts to ^17.1.1 (elastic#57634)
cchaos added a commit that referenced this pull request Feb 22, 2020
* [FieldIcon] Refactor to extend EuiToken and props

* [Add to FieldIcon] Export props

* [Graph] Updated instances of FieldIcon

* [Maps] Update FieldIcon instance

* [Lens] Update FieldIcon usage


* [Discover] Update FieldIcon usage


* Remove comment

* [Lens] Delete unused files

* [Graph] Fix alignments

* More cleanup

* Fixing snaps

* [Lens] Removing method `getColorForDataType`

The method no longer returns the correct color and EuiProgress doesn’t currently support all the colors from the token map. @cchaos will follow up with a PR to address the coloring of the field data charts. Right now they will fallback to pink for progress and default for charts.

* [Maps] Fixing implementations of FieldIcon

* [Graph] Using css utility class instead of custom class

* Snap

* Fix css to use var
jloleysens added a commit to jloleysens/kibana that referenced this pull request Feb 24, 2020
…-out-of-legacy

* 'master' of github.com:elastic/kibana:
  [SIEM] [Case] Enable case by default. Snake to camel on UI (elastic#57936)
  [File upload] Update remaining File Upload dependencies for NP migration (elastic#58128)
  Use EuiTokens for ES field types (elastic#57911)
  Added UI support for the default action group for Alert Type Model (elastic#57603)
  force savedObject API consumers to define SO type explicitly (elastic#58022)
  Update dependency @elastic/charts to ^17.1.1 (elastic#57634)
  [Endpoint] Add a flyout to alert list. (elastic#57926)
  Make sure index pattern has fields before parsing (elastic#58242)
  Sanitize workpad before sending to API (elastic#57704)
  [ML] Transform: Support multi-line JSON notation in advanced editor (elastic#58015)
  [Endpoint] Refactor Management List Tests (elastic#58148)
  [kbn/optimizer] include bootstrap cache key in optimizer cache key (elastic#58176)
  Do not refresh color scale on each lookup (elastic#57792)
  Updating to @elastic/[email protected] (elastic#54662)
  Trigger context (elastic#57870)
  [ML] Transforms: Adds clone feature to transforms list. (elastic#57837)
  [ML] New Platform server shim: update fields service routes (elastic#58060)
  [Endpoint] EMT-184: change endpoints to metadata up and down the code base. (elastic#58038)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants