-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
Transformations: Support enum field conversion #76410
Conversation
…s drag n droppable; code is a mess
…generate enum values from data button; add way to modify values (currently loses focus from input on every character input though...)
…uding removing state for tracking current editing index)
@leeoniya this is (finally) ready for review 😅 |
works pretty well :) found some bugs:
enum-no-reset.mp4you can actually save items in an unfilled state. we should probably prevent adding new items when we have an empty one waiting to be filled, and clean them out before saving? then things start to get weird, maybe cause using values as react list keys and ending up with dupes?: enum-snafu.mp4 |
Maybe when adding a new enum, the edit input field could already be open and focus set to it? If it loses focus with nothing added to it, it could be removed? |
Testing this it seems that current behavior is expected (config is drawn from panel JSON and if panel json isn't saved / updated then transform config can persist) transform.config.mov
This one is actually a little tricky 😬 Basically what is happening is when you drag table row it is being taken out of the table and thus the table is re-rendering to match the "new" table state where the column max-width is being updated dynamically (see here for context). The only ways around this is to either:
I'll default to 1) for time being 👍
Fixed this - following suggestion from @oscarkilhed 💯 updated.UX.exp.mov |
mappedIndex: number; | ||
onChangeEnumValue: (index: number, value: string) => void; | ||
onRemoveEnumRow: (index: number) => void; | ||
checkIsEnumUniqueValue: (value: string) => boolean; |
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.
should this be a passed-in prop or can we just directly use the checkIsEnumUniqueValue
from https://github.com/grafana/grafana/pull/76410/files#diff-0f946700206cc388640fbe8e8df18c407f2a947e1b8bd5a0acca1b51dc91477aR102-R104?
dunno if you had specific plans for more than one pluggable strategy for uniqueness testing?
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.
main reason for checkIsEnumUniqueValue
being passed as a prop is wanting to avoid sending the entire enumRows
object as a prop to every instance of the EnumMappingRow
component
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.
some minor nits, but LGTM 👍
What is this feature?
This adds an enum config editor to the
Convert field type
transform so that users can customize + display their enum data in supported panels.Updated UX
latest.UX.mov
Why do we need this feature?
We added the ability to render enum data a while back but did not uncover any way to actually configure fields into the enum field config format.
Users can convert their field types into an enum field today via the
Convert field type
transform (implemented via this PR), but have no ability to rearrange / customize the resulting enum configsWho is this feature for?
All users that want to display enum data in their panels
Which issue(s) does this PR fix?:
Fixes #72073
Created a follow up issue to address issue where user can add multiple overriding conversions for the same field (which breaks enum rendering)
Special notes for your reviewer:
Please check that: