-
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
[Graph] Field manager #45384
[Graph] Field manager #45384
Conversation
@cchaos I like it being consistent with filters - I updated the PR, could you take another look? While I was at it, I changed the default field colors to use the light colors of the eui palette. I have the same problem as maps that combo box can't show an icon as selected option. |
Design PR4U: flash1293#4 |
That's fine for now, I'll look for or create a ticket for this type of display in EUI. |
💚 Build Succeeded |
@cchaos the disabling thing is expected, disabling the field just prevents new nodes of this type to be discovered via searches and expands. The color should get updated, good catch - I will look into this. |
@cchaos I couldn't reproduce the problem with settings not trickling down to the graph - it's working fine for me. Could you check whether it's reproducible? |
💚 Build Succeeded |
5c960b7
to
aeb1f1a
Compare
💚 Build Succeeded |
💚 Build Succeeded |
@flash1293 Hmmm, I pulled down the lates and I'm not having that issue anymore. I wonder if it was because I was working off an already created Graph (in a different version) but since I've started new, it's been working. I'll keep an eye out for if it happens again. |
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.
} | ||
|
||
function getIconForDataType(dataType: string) { | ||
const icons: Partial<Record<string, UnwrapArray<typeof ICON_TYPES>>> = { |
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.
Seems like you're doing this same thing in Lens. Maybe you'll want to figure out a more global service?
export function getColorForDataType(type: string) { | ||
const iconType = getIconForDataType(type); | ||
const { colors } = palettes.euiPaletteColorBlind; | ||
const colorIndex = stringToNum(iconType) % colors.length; |
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.
We should definitely make sure we're using the same colors across all apps.
I will take care of that when moving the visualization itself over.
We definitely should - Discover is another possible consumer. #46450 |
Summary
This PR moves the field manager to react and EUI. It also implements the state handling as redux store.
Adding new fields
I made it possible to add multiple fields at once because in most cases you want to work with more than one field.
![Screenshot 2019-09-20 at 16 05 33](https://user-images.githubusercontent.com/1508364/65333304-8ac6d100-dbc0-11e9-9331-3b45c94cf5b0.png)
Field editor
Max hops
is moved to a collapsed accordion because in most cases you don't change this setting. If you change the field, the current field is deselected and the new field is selected and gets the settings from the current field (color, icon and hop size). Changes are directly applied (no update button), because they are easy to reverse - even if you remove a field you can just add it again and get all settings back.Disabled fields
Fields can be disabled by the switch in the field editor or by shift-clicking the field. Not really happy with the style of disabled fields yet.
![Screenshot 2019-09-20 at 16 07 12](https://user-images.githubusercontent.com/1508364/65333405-bb0e6f80-dbc0-11e9-9063-b2826d59ebe9.png)
State handling
For now the redux store doesn't do much, but it will be extended in subsequent PRs to do all the state handling currently living in legacy JS files.