-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Discover] Optimize popover size for grid cell expansion #152480
base: main
Are you sure you want to change the base?
Conversation
Hi @kertal, Wdyt? Should we enable resizing? |
Oh wow 😲 , I expected we could just configure grid-resizing.mp4I think this would definitely be valuable, but it also adds more questions and tasks, and it doesn't sound like a small task. For instance the configured size should be remembered. Please note that current implementation would work only in new browsers. To address this, some styles should be moved to Eui or Eui cell popover should support custom classes. What are the browser requirements? Also looping in @elastic/eui-design if there are any plans in this area we are not aware of |
@kertal I am using |
No current plans, but it sounds like y'all need some way of setting props (custom classNames or what have you) on the rendered cell popover. Would us passing a function like |
@cee-chen Yes, |
elastic/eui#6632 - likely will be a bit longer until it lands in Kibana though as a heads up - maybe another week or two! |
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
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.
Cool idea and it seems to be working well overall! Although I think it's something we should ask for design input on before we settle on a solution.
A couple of notes about the current implementation:
- It seems like the JSON popover is constrained to the screen width, but I can resize the plain text popover off the screen so it can't be resized again without closing and reopening. Ideally both popovers would be constrained to the screen size if possible.
- It would be best if we could get the vertical resizing working with the JSON popover since it would probably benefit most from this functionality anyway. I see that the JSON viewer takes an explicit height as a prop, but I was able to hack together a somewhat working solution in a few minutes using a
ResizeObserver
that manually updates the height when resized, so maybe that would be an option to explore.
@@ -380,6 +381,8 @@ export const DiscoverGrid = ({ | |||
[dataView, displayedRows, useNewFieldsApi, shouldShowFieldHandler, services.uiSettings] | |||
); | |||
|
|||
const renderCellPopover = useMemo(() => getRenderCellPopoverFn(), []); |
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.
Nit: it seems like it would be simpler to pass in something like a CellPopover
component directly instead of wrapping it with getRenderCellPopoverFn
since we're not using the closure for anything.
&.dscDiscoverGrid__cellPopover--withJson { | ||
resize: horizontal; | ||
min-width: 516px; | ||
width: 516px; | ||
} |
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 definitely think, even if we decide not to allow resizing, having the JSON view in a larger dimension makes much sense
+1 from my side, @andreadelrio can you have a look? link I guess it would be more effort, but to make this actually useful, at least we should have some sort of memory for the user assigned dimensions. So when the user scales the JSON view, it could be remembered. I'm not so sure about other expansions, since when the user scales a @timestamp field, the dimension won't fit a long message field. But just loud thinking, if we could remember the last 10 fields a user scaled. For a first version, a small improvement, I think it could make sense just to have a PR that scales the JSON content in a larger way like in this PR. |
This looks good to me. I would just suggest, when you increase the width of the popover, keep the Also, should we have a minimum height? A height that's so low that hides the button is not ideal imo. |
Moving back to Draft state to work on improvements. |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @jughosta |
Closes #132309
Open to your feedback!
Summary
This PR makes changes to cell popover styles in Discover:
Gifs
Our JSON viewer is not very responsive according to its container dimensions so I was able to only allow horizontal resizing.
JSON popover height is equal to the max height for non-JSON popover.
Please note that current implementation would work only in new browsers. To address this, some styles should be moved to Eui or Eui cell popover should support custom classes.elastic/eui#6632Ideas for future improvements: currently it's not possible for users to reposition the cell popover. It might be better to later look into a different solution and open values in a flyout for example or as a modal.