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

Use push flyout for Discover document flyout #166406

Merged
merged 51 commits into from
Apr 26, 2024

Conversation

lukasolson
Copy link
Member

@lukasolson lukasolson commented Sep 13, 2023

Summary

Closes #163798.
Closes #160306

Uses "push" style for the document viewer flyout in Discover.

Before:

image

After:

image

Checklist

@lukasolson lukasolson self-assigned this Sep 13, 2023
@@ -251,6 +254,15 @@ export function DiscoverGridFlyout({
textBasedHits={isPlainRecord ? hits : undefined}
/>
</EuiFlyoutBody>
<EuiFlyoutFooter>
Copy link
Member Author

Choose a reason for hiding this comment

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

From the EUI docs (https://elastic.github.io/eui/#/layout/flyout#push-versus-overlay):

Also, it is good to include a close button in the footer for a larger hit target than the small close button provides.

@lukasolson lukasolson marked this pull request as ready for review September 27, 2023 22:50
@lukasolson lukasolson requested a review from a team as a code owner September 27, 2023 22:50
@kertal kertal added release_note:enhancement Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. labels Sep 29, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@kertal kertal added the Feature:Discover Discover Application label Sep 29, 2023
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiButtonEmpty iconType="cross" onClick={onClose} flush="left">
Close
Copy link
Member

Choose a reason for hiding this comment

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

yes, this make sense, one ask, pls add i18n for Close 🙏

@kertal
Copy link
Member

kertal commented Sep 29, 2023

@elasticmachine merge upstream

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.

Looking good overall! A couple point of feedback from testing:

Now that the sidebar is resizable and the doc flyout pushes the content, the sidebar and main panels can become squished when the flyout is open and the screen is on the smaller side of XL (so still a push flyout). It seems like reducing the min width of the main panel improves this. I'd recommend updating discover_resizable_layout.tsx to use const minMainPanelWidth = euiTheme.base * 24; instead of the current value.

I also noticed that since the flyout pushes the content when it opens, you can lose sight of the selected document row as the data grid resizes. I wonder if it's possible to do something like auto-scroll to the selected doc after opening the flyout?
lose_doc

It also looks like after I close the push flyout, there are some rendering issues with the data grid. This is likely just a bug with EuiDataGrid, but I wonder if we can do something about it. It's possible that implementing some sort of auto-scroll functionality might force the data grid to render and fix this issue as well:
render_issues

Otherwise I do find the flyout a bit wide overall. Even on a large screen it took up about half the space, but I think this could be reduced when we migrate to floating actions in the doc viewer table, so I wouldn't consider it blocking unless others feel strongly about it.

@kertal kertal requested a review from a team October 2, 2023 16:41
@kertal
Copy link
Member

kertal commented Oct 2, 2023

I feel like, given there were new changes under the hood, like the sizable field list, and also the potential vanishing of the actually selected row when the autosized document column is rendered, it should be reviewed again for design changes, and in the context of our ongoing redesign FYI @andreadelrio @MichaelMarcialis @ninoslavmiskovic
I feel like we should not rush in this significant change, here's a deployment to test:
deployment

@andreadelrio
Copy link
Contributor

I feel like, given there were new changes under the hood, like the sizable field list, and also the potential vanishing of the actually selected row when the autosized document column is rendered, it should be reviewed again for design changes, and in the context of our ongoing redesign FYI @andreadelrio @MichaelMarcialis @ninoslavmiskovic I feel like we should not rush in this significant change, here's a deployment to test: deployment

Seeing this in action, I think I would not implement this change until we implement #164617. The left white space for me is a blocker to implement this push flyout. When we move to floating actions we'll be able to reduce the width of this flyout. I also think that when we implement the push flyout it should come with the ability to drag-to-resize, similar to what we now have for the field list.

@ninoslavmiskovic
Copy link
Contributor

The vanishing row is a bug in my opinion.

Also I did not expect the push fly out to be that "aggressive" on resizing.

Could we e.g work with how it pushes the content or collapse the field list automatically?

Agree on next iteration with working on the re-sizing, however before see it as a blocker.

Is there anything we can work on how it renders ?

size="m"
pushMinBreakpoint="xl"
data-test-subj="docTableDetailsFlyout"
onKeyDown={onKeyDown}
ownFocus={false}
Copy link
Member

Choose a reason for hiding this comment

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

I think ownFocus should be true now, this would not apply for the push, but for the overlay style

Suggested change
ownFocus={false}
ownFocus={true}

@lukasolson lukasolson added the ci:cloud-deploy Create or update a Cloud deployment label Jan 12, 2024
@lukasolson lukasolson removed the ci:cloud-deploy Create or update a Cloud deployment label Jan 12, 2024
@lukasolson lukasolson requested a review from a team as a code owner April 16, 2024 23:21

it('should not display a log level badge when not available', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

For some reason this test (and the others below) were failing because the web elements had become "stale", and were throwing errors. I'm not sure how the changes in this PR would affect this, but breaking these into separate it() statements seems to fix the issue and still test the same behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

This PR will actually remove most of these tests after moving the doc view implementation, I'll take care of the conflicts but this LGTM.

@@ -81,7 +81,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dataGrid.clickRowToggle({ columnIndex: 4 });
await testSubjects.existOrFail('logsExplorerFlyoutLogLevel');
await dataGrid.closeFlyout();
});
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I think the flyouts no longer need to be closed in those tests, since we navigate to Discover before each test

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

LGTM, looking great and working snappy 👍
Tests locally with Safari, Firefox, Chrome, all fine and work as expected.
A note about the tests, that's pretty strange, it seems when using the push flyout our code in the test to get the row cells no longer works. Might be caused because when the push flyout is closed, this leads the table / layout to be pre-rendered. Not a blocker but we might need to investigate what's happening here , what also might have worked instead of creating separate tests, is just to not close the flout when showing another row, since this should work with the push flyout

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.

Just about good to go on my end! A couple of minor points of feedback, but it's just about there IMO.

I did notice that my workaround to prevent breaking the Discover layout doesn't work when there's a nav sidebar like in serverless or the O11y solution nav, but I don't think there's much we can do about that unless we make all of Discover responsive based on container width, so I think it's good for now:
overlap

@@ -230,6 +232,10 @@ export function DiscoverGridFlyout({
minWidth={minWidth}
maxWidth={maxWidth}
onResize={setFlyoutWidth}
css={{
maxWidth: `${isXlScreen ? `calc(100vw - ${defaultWidth}px)` : '90vw'} !important`,
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't realize this when I originally opened my touchups PR, but there's going to be an issue with using defaultWidth here since it could be a string value when overridden by a customization (e.g. Logs Explorer uses 60%). I think we can just split out euiTheme.base * 34 into a separate const to use here and we should be safe.

css={{
maxWidth: `${isXlScreen ? `calc(100vw - ${defaultWidth}px)` : '90vw'} !important`,
}}
className="dscGridFlyout"
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than using a class with a new style, we should be able to instead use paddingSize="m" to get the 16px padding. This will also apply the padding to the header which right now is still 24px.

@@ -133,7 +133,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('a11y test for actions on a field', async () => {
await PageObjects.discover.clickDocViewerTab('doc_view_table');
if (await testSubjects.exists('openFieldActionsButton-Cancelled')) {
await testSubjects.click('openFieldActionsButton-Cancelled');
await testSubjects.click('openFieldActionsButton-Cancelled'); // Open the actions
await testSubjects.click('openFieldActionsButton-Cancelled'); // Close the actions
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should close the menu after we call await a11y.testAppSnapshot(); to make sure our a11y snapshot includes the open menu.

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.

LGTM, thanks!

Copy link
Contributor

@tonyghiani tonyghiani left a comment

Choose a reason for hiding this comment

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

LGTM

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

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

id before after diff
discover 636.1KB 639.0KB +2.8KB
unifiedDocViewer 60.8KB 60.9KB +117.0B
total +3.0KB

History

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

cc @lukasolson @andreadelrio

@lukasolson lukasolson requested a review from davismcphee April 25, 2024 17:52
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.

Looks like my remaining concerns are addressed, so in that case this LGTM 👍 Great work on this, and I'm excited to get it merged!

I noticed one minor issue where the Logs Explorer flyout default width isn't being set now, but that's actually unrelated to these changes and is a separate bug with the customization framework, so I'll open up a separate PR to address it.

@lukasolson lukasolson merged commit 9203342 into elastic:main Apr 26, 2024
18 checks passed
@kibanamachine kibanamachine added v8.15.0 backport:skip This commit does not require backporting labels Apr 26, 2024
davismcphee added a commit that referenced this pull request Apr 30, 2024
…er (#181788)

## Summary

This PR fixes an issue where the `useCustomization` hook in Discover
always returns `undefined` on the first render, which can have
unintended consequences. This went unnoticed before, but the work in
#166406 revealed the issue, resulting in the Logs Explorer flyout
initializing to the wrong width.

With this fix, the width initializes correctly, but the default value of
`60%` causes the layout to become crammed, so I updated it to what
seemed like a more reasonable default of `650px`. I can change this to
something else if we feel there's a better default.

**Before (`60%`):**
<img width="1997" alt="before"
src="https://github.com/elastic/kibana/assets/25592674/50994ca9-f232-4c5c-a948-46a0e9202864">

**Now (`650px`):**
<img width="1997" alt="after"
src="https://github.com/elastic/kibana/assets/25592674/dcc8f53f-0f17-4b2f-9e33-9b1ba134d4ae">

### Checklist

- [ ] 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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] 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))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
jughosta added a commit that referenced this pull request May 17, 2024
## Summary

This PR updates the bottom margin so the JSON view can be scrolled
properly inside DocViewer flyout. It's a follow up for
#183468 (fixes the scrolling to be
limited to flyout height) and
#166406 (taller footer was added
with Close button in it).
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:enhancement Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. Team:Fleet Team label for Observability Data Collection Fleet team v8.15.0
Projects
None yet