-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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] Move total hits counter from histogram to grid area. New controls in histogram. #171638
Conversation
…825-move-total-hits
…825-move-total-hits
…825-move-total-hits
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.
Finished my initial code review, and the changes are looking great so far! I'll follow up tomorrow with some local testing and another review.
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.
Thanks for adding the aria labels here, it's great to keep a11y in mind 👍
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.
It's great that you converted this to RTL, thanks!
IMO this would apply to time based documents. But in Discover we also support Non-time based documents searches |
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.
@jughosta Looking great! Nit, can we remove the 8px gap from here?
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.
🚀 Design changes LGTM!
- Fix double EuiSelectable focus ring styles - Fix issue where toolbar buttons get cut off on smaller screen sizes - Add tooltips to toolbar buttons so users can see the full labels when truncated - Tweak toolbar button menu designs to more closely match mockups (full-width menu items, compressed search bar, show all time interval menu items without scrolling) - Add middle truncation to toolbar button menus for long values, and update search bar placeholder to "Search" to match mockups - Autofocus on toolbar button menu selectables when popover is opened - Update toolbar button menu "no results" display to put message and search term on one line - Remove extra 2 pixels below Lens suggestion selector caused by `display: inline-block`, and update tooltip delay to "long" to match the toolbar button tooltips
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.
Awesome work on this! It's such an improvement over what we had before, and makes the entire design feel more complete and cohesive 🎉 I've tested this PR pretty thoroughly at this point, including the listed test scenarios (thanks a lot for including those), and I haven't encountered any bugs 🙌
I did have a few UX concerns, but rather than just listing them out here, I figured I'd have a shot at addressing them to help move things along with this PR 🙂 I included all of the changes in the PR description for reference, so feel free to merge or adjust as needed if you think any of the changes don't make sense: jughosta#9.
The only other concern I had that I couldn't address since it would first require discussion and collaboration with Shared UX is that it would be nice if we used EUI tooltips for the toolbar buttons to match our other UI elements and the data grid toolbar buttons. But this doesn't need to be addressed in this PR of course, and we can talk to them to see what they think and create a followup PR later:
I'll be out tomorrow morning, but I'll do another review in the afternoon once I'm back and you've gotten a chance to check out the touchups PR. Thanks for all the work on this, and it's looking very close to being ready to merge!
Total hits and histogram control touchups
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 did a final quick round of testing and code review, and it LGTM! Excellent job on this, all of the design refresh work really makes Discover feel like a much cleaner and more modern app. I especially like how much space the new collapsible section designs provide for the data grid (almost makes fullscreen mode feel unnecessary now) 🎉
const renderCustomChartToggleActions = useCallback( | ||
() => | ||
React.isValidElement(panelsToggle) | ||
? React.cloneElement(panelsToggle, { renderedFor: 'histogram' }) | ||
: panelsToggle, | ||
[panelsToggle] | ||
); |
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.
This seems to work well for what we're doing here, but I think the use of cloneElement
in this PR may be a bit of a code smell. It seems the React team now considers it a "legacy" API and is recommending alternatives like render props instead, which might be an option for us. That said, I have no problem merging this as is, just something to consider as potential followup work for cleanup.
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.
Thanks for the cleanup in here btw 👍 It still feels more complicated than it should be to manage our refetches, but this definitely removes some of the complexity.
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
const chartMemoized = useMemo(() => chart, [chart?.title, chart?.timeInterval, chart?.hidden]); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
const hitsMemoized = useMemo(() => hits, [hits?.status, hits?.total]); |
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.
Just curious if the lack of memoization before was causing any issues in this PR, or if this was just added for convenience to prevent consumers having to do their own memoization? It's not an issue to do it here IMO (although I don't love having to disable ESLint rules personally), I'm just wondering. In retrospect, given how Unified Histogram has evolved I probably should have done this differently from the start and skipped the context objects altogether (I guess hindsight is 20/20).
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.
@davismcphee That was something I added when trying to reduce the number of Chart rerenderings. I can't prove now that it's still relevant so I'm removing this code.
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
async chunk count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
…ontrols in histogram. (elastic#171638) - Closes elastic#168825 - Closes elastic#171610 - Closes elastic#167427 - Partially addresses elastic#165192 This PR moves the total hits counter closer to the grid, updates histogram controls and introduces new panel toggle buttons for toggling fields sidebar and histogram. <img width="500" alt="Screenshot 2023-12-05 at 15 37 20" src="https://github.com/elastic/kibana/assets/1415710/5b9bd771-1052-4205-849f-18c21cc299b8"> <img width="500" alt="Screenshot 2023-12-05 at 15 37 29" src="https://github.com/elastic/kibana/assets/1415710/e5941b27-c497-4d7e-b461-68b66931475a"> <img width="500" alt="Screenshot 2023-12-05 at 15 37 37" src="https://github.com/elastic/kibana/assets/1415710/97abd32e-9ff2-4d9a-b7e7-b9d6d9cf64db"> <img width="500" alt="Screenshot 2023-12-05 at 15 37 50" src="https://github.com/elastic/kibana/assets/1415710/10f2b4f4-ec37-41c3-b78b-78c64e14d655"> <img width="400" alt="Screenshot 2023-12-05 at 15 37 59" src="https://github.com/elastic/kibana/assets/1415710/ef2e28b2-f6ba-4ccb-aea4-3946ba2d5839"> <img width="300" alt="Screenshot 2023-12-05 at 15 38 05" src="https://github.com/elastic/kibana/assets/1415710/07901ede-0bcb-46a6-a398-4562189fd54f"> <img width="500" alt="Screenshot 2023-12-05 at 15 40 38" src="https://github.com/elastic/kibana/assets/1415710/17830115-2111-4b8f-ae40-7b5875c06879"> <img width="500" alt="Screenshot 2023-12-05 at 15 40 56" src="https://github.com/elastic/kibana/assets/1415710/975d475b-280b-495a-b7b7-31c7ade5f21e"> <img width="500" alt="Screenshot 2023-12-05 at 15 43 08" src="https://github.com/elastic/kibana/assets/1415710/38b6053a-e260-48d8-9591-3f3409df2876"> When testing, please check collapsing/expanding the fields sidebar and histogram. Also for ES|QL mode with suggestions, legacy table, no results and error prompt, Field Statistics tab, data views without a time field, light/dark themes. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
## Summary Following this PR #171638, this renames the histogram query to use the word results instead of rows. <img width="1672" alt="image" src="https://github.com/elastic/kibana/assets/17003240/9b917bd2-e961-43eb-9aad-6fefd5e38f9c"> ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
…ontrols in histogram. (elastic#171638) - Closes elastic#168825 - Closes elastic#171610 - Closes elastic#167427 - Partially addresses elastic#165192 ## Summary This PR moves the total hits counter closer to the grid, updates histogram controls and introduces new panel toggle buttons for toggling fields sidebar and histogram. <img width="500" alt="Screenshot 2023-12-05 at 15 37 20" src="https://github.com/elastic/kibana/assets/1415710/5b9bd771-1052-4205-849f-18c21cc299b8"> <img width="500" alt="Screenshot 2023-12-05 at 15 37 29" src="https://github.com/elastic/kibana/assets/1415710/e5941b27-c497-4d7e-b461-68b66931475a"> <img width="500" alt="Screenshot 2023-12-05 at 15 37 37" src="https://github.com/elastic/kibana/assets/1415710/97abd32e-9ff2-4d9a-b7e7-b9d6d9cf64db"> <img width="500" alt="Screenshot 2023-12-05 at 15 37 50" src="https://github.com/elastic/kibana/assets/1415710/10f2b4f4-ec37-41c3-b78b-78c64e14d655"> <img width="400" alt="Screenshot 2023-12-05 at 15 37 59" src="https://github.com/elastic/kibana/assets/1415710/ef2e28b2-f6ba-4ccb-aea4-3946ba2d5839"> <img width="300" alt="Screenshot 2023-12-05 at 15 38 05" src="https://github.com/elastic/kibana/assets/1415710/07901ede-0bcb-46a6-a398-4562189fd54f"> <img width="500" alt="Screenshot 2023-12-05 at 15 40 38" src="https://github.com/elastic/kibana/assets/1415710/17830115-2111-4b8f-ae40-7b5875c06879"> <img width="500" alt="Screenshot 2023-12-05 at 15 40 56" src="https://github.com/elastic/kibana/assets/1415710/975d475b-280b-495a-b7b7-31c7ade5f21e"> <img width="500" alt="Screenshot 2023-12-05 at 15 43 08" src="https://github.com/elastic/kibana/assets/1415710/38b6053a-e260-48d8-9591-3f3409df2876"> ## Testing When testing, please check collapsing/expanding the fields sidebar and histogram. Also for ES|QL mode with suggestions, legacy table, no results and error prompt, Field Statistics tab, data views without a time field, light/dark themes. ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
## Summary Following this PR elastic#171638, this renames the histogram query to use the word results instead of rows. <img width="1672" alt="image" src="https://github.com/elastic/kibana/assets/17003240/9b917bd2-e961-43eb-9aad-6fefd5e38f9c"> ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
…ontrols in histogram. (elastic#171638) - Closes elastic#168825 - Closes elastic#171610 - Closes elastic#167427 - Partially addresses elastic#165192 ## Summary This PR moves the total hits counter closer to the grid, updates histogram controls and introduces new panel toggle buttons for toggling fields sidebar and histogram. <img width="500" alt="Screenshot 2023-12-05 at 15 37 20" src="https://github.com/elastic/kibana/assets/1415710/5b9bd771-1052-4205-849f-18c21cc299b8"> <img width="500" alt="Screenshot 2023-12-05 at 15 37 29" src="https://github.com/elastic/kibana/assets/1415710/e5941b27-c497-4d7e-b461-68b66931475a"> <img width="500" alt="Screenshot 2023-12-05 at 15 37 37" src="https://github.com/elastic/kibana/assets/1415710/97abd32e-9ff2-4d9a-b7e7-b9d6d9cf64db"> <img width="500" alt="Screenshot 2023-12-05 at 15 37 50" src="https://github.com/elastic/kibana/assets/1415710/10f2b4f4-ec37-41c3-b78b-78c64e14d655"> <img width="400" alt="Screenshot 2023-12-05 at 15 37 59" src="https://github.com/elastic/kibana/assets/1415710/ef2e28b2-f6ba-4ccb-aea4-3946ba2d5839"> <img width="300" alt="Screenshot 2023-12-05 at 15 38 05" src="https://github.com/elastic/kibana/assets/1415710/07901ede-0bcb-46a6-a398-4562189fd54f"> <img width="500" alt="Screenshot 2023-12-05 at 15 40 38" src="https://github.com/elastic/kibana/assets/1415710/17830115-2111-4b8f-ae40-7b5875c06879"> <img width="500" alt="Screenshot 2023-12-05 at 15 40 56" src="https://github.com/elastic/kibana/assets/1415710/975d475b-280b-495a-b7b7-31c7ade5f21e"> <img width="500" alt="Screenshot 2023-12-05 at 15 43 08" src="https://github.com/elastic/kibana/assets/1415710/38b6053a-e260-48d8-9591-3f3409df2876"> ## Testing When testing, please check collapsing/expanding the fields sidebar and histogram. Also for ES|QL mode with suggestions, legacy table, no results and error prompt, Field Statistics tab, data views without a time field, light/dark themes. ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
## Summary Following this PR elastic#171638, this renames the histogram query to use the word results instead of rows. <img width="1672" alt="image" src="https://github.com/elastic/kibana/assets/17003240/9b917bd2-e961-43eb-9aad-6fefd5e38f9c"> ### Checklist - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
Summary
This PR moves the total hits counter closer to the grid, updates histogram controls and introduces new panel toggle buttons for toggling fields sidebar and histogram.
Testing
When testing, please check collapsing/expanding the fields sidebar and histogram. Also for ES|QL mode with suggestions, legacy table, no results and error prompt, Field Statistics tab, data views without a time field, light/dark themes.
Checklist