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

[Discover] Move total hits counter from histogram to grid area. New controls in histogram. #171638

Merged
merged 89 commits into from
Jan 12, 2024

Conversation

jughosta
Copy link
Contributor

@jughosta jughosta commented Nov 21, 2023

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.

Screenshot 2023-12-05 at 15 37 20 Screenshot 2023-12-05 at 15 37 29 Screenshot 2023-12-05 at 15 37 37 Screenshot 2023-12-05 at 15 37 50 Screenshot 2023-12-05 at 15 37 59 Screenshot 2023-12-05 at 15 38 05 Screenshot 2023-12-05 at 15 40 38 Screenshot 2023-12-05 at 15 40 56 Screenshot 2023-12-05 at 15 43 08

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

@jughosta jughosta added Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) labels Nov 21, 2023
@jughosta jughosta self-assigned this Nov 21, 2023
Copy link
Contributor

@davismcphee davismcphee left a 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.

Copy link
Contributor

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 👍

Copy link
Contributor

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!

@kertal
Copy link
Member

kertal commented Jan 9, 2024

@kertal: FWIW, a term that came up a few times in recent usability tests was "Events" (rather than "Documents" or "Hits"). Perhaps this is a more recognizable and generic term? CCing @alexmarhaba.

IMO this would apply to time based documents. But in Discover we also support Non-time based documents searches

@andreadelrio andreadelrio self-requested a review January 10, 2024 02:08
Copy link
Contributor

@andreadelrio andreadelrio left a 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?

From:
image
To:
image

@andreadelrio andreadelrio self-requested a review January 10, 2024 17:24
Copy link
Contributor

@andreadelrio andreadelrio left a comment

Choose a reason for hiding this comment

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

🚀 Design changes LGTM!

@jughosta jughosta enabled auto-merge (squash) January 10, 2024 17:39
jughosta and others added 2 commits January 10, 2024 21:47
- 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
Copy link
Contributor

@davismcphee davismcphee left a 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:
lens_tooltip

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
Copy link
Contributor

@davismcphee davismcphee left a 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) 🎉

Comment on lines +43 to +49
const renderCustomChartToggleActions = useCallback(
() =>
React.isValidElement(panelsToggle)
? React.cloneElement(panelsToggle, { renderedFor: 'histogram' })
: panelsToggle,
[panelsToggle]
);
Copy link
Contributor

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.

Copy link
Contributor

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.

Comment on lines 272 to 275
// 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]);
Copy link
Contributor

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).

Copy link
Contributor Author

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.

@jughosta jughosta enabled auto-merge (squash) January 12, 2024 09:27
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Investigations - Security Solution Cypress Tests #5 / [ESS] Save Timeline Prompts "before each" hook for "should NOT prompt when navigating with a changed & saved timeline within security solution where timelines are disabled" "before each" hook for "should NOT prompt when navigating with a changed & saved timeline within security solution where timelines are disabled"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 694 698 +4
unifiedHistogram 68 109 +41
total +45

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
canvas 1013.7KB 1013.8KB +38.0B
discover 559.5KB 564.1KB +4.6KB
unifiedHistogram 51.0KB 69.3KB +18.2KB
total +22.9KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/unified-field-list 9 10 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 375.2KB 375.4KB +198.0B
unifiedHistogram 6.3KB 6.4KB +54.0B
total +252.0B
Unknown metric groups

API count

id before after diff
@kbn/shared-ux-button-toolbar 26 30 +4

async chunk count

id before after diff
unifiedHistogram 2 3 +1

ESLint disabled line counts

id before after diff
discover 24 25 +1

Total ESLint disabled count

id before after diff
discover 24 25 +1

History

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

cc @jughosta @andreadelrio

@jughosta jughosta merged commit aa33843 into elastic:main Jan 12, 2024
39 checks passed
@jughosta jughosta deleted the 168825-move-total-hits branch January 12, 2024 10:37
eokoneyo pushed a commit to eokoneyo/kibana that referenced this pull request Jan 12, 2024
…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>
stratoula added a commit that referenced this pull request Jan 12, 2024
## 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
semd pushed a commit to semd/kibana that referenced this pull request Jan 12, 2024
…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>
semd pushed a commit to semd/kibana that referenced this pull request Jan 12, 2024
## 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
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
…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>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Discover Discover Application release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover App Team (Document Explorer, Saved Search, Surrounding documents, Graph) v8.13.0
Projects
None yet