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] New responsive layout using EUI components #83633

Merged
merged 241 commits into from
Dec 3, 2020

Conversation

kertal
Copy link
Member

@kertal kertal commented Nov 18, 2020

Summary

Responsiveness of Discover was powered by Bootstrap classes, with this PR it's replaced by EUI. The ways it works is a bit different to before, there is a Flyout containing the field selector in the mobile version. This prepares Discover for #67259 aka Data Grid (Basically it's work, extracted from there).

The layout has changed, moved to EuiPage components, sidebar and results are now scrollable separately:
discover-scrollable-2

You can hide the date histogram to gain more vertical screen space (Histogram query is still submitted, but this will change).

discover-hide-chart

And here's the new responsiveness in action:
discover-resize

Other changes

Doc Viewer Table action icons moved to the right side of the table.

Bildschirmfoto 2020-11-19 um 10 05 17

Changes in this PR were mainly done by @andreadelrio 👍
FYI @gchaps we need to check the docs if there are screens to update

Checklist

Delete any items that are not applicable to this PR.

For maintainers

- [ ] This was checked for breaking API changes and was labeled appropriately

Michail Yasonik and others added 30 commits January 14, 2020 16:53
Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

All my previous comments have been addressed, LGTM from my side.

This is probably a personal thing, but I don't really like the new style of the index pattern picker, especially along with the other elements in that area - everything looks slightly different (colors, font weights, edges, ...), the hits count is not aligned to the elements in the sidebar, the sidebar collapse button feels a little misplaced with its different color floating in between the other elements. Biggest part of that is probably me being used to the old style :)
Screenshot 2020-12-01 at 17 42 21

I found one minor thing, but it's not blocking this IMHO:
If the table is scrollable horizontally, the "End of page" message at the end of the table is not taking the full width (not sure how important):
Screenshot 2020-12-01 at 17 44 11

This definitely needs another pair of eyes before merging as there are so many changes going on.

/**
* hits fetched from ES, displayed in the doc table
*/
hits: Array<Record<string, unknown>>;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Could this be ElasticSearchHit[]?

Copy link
Member Author

Choose a reason for hiding this comment

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

of course it could, and now it is! thx!

@kertal
Copy link
Member Author

kertal commented Dec 1, 2020

Thx @flash1293 for your valuable feedback!

This definitely needs another pair of eyes before merging as there are so many changes going on.

Dear @andreadelrio & @cchaos could your eyes have another look? Many thx!

@cchaos
Copy link
Contributor

cchaos commented Dec 2, 2020

This is probably a personal thing, but I don't really like the new style of the index pattern picker, especially along with the other elements in that area - everything looks slightly different (colors, font weights, edges, ...), the hits count is not aligned to the elements in the sidebar, the sidebar collapse button feels a little misplaced with its different color floating in between the other elements. Biggest part of that is probably me being used to the old style :)

I agree that there are some great inconsistencies here but most of that will be mitigated when we switch to the new K8 theme. Example:

Screen Shot 2020-12-02 at 12 10 07 PM

The main change here really was making the index pattern selection more prominent by making it the border-style button. This button control the entire data of this screen and it was getting lost. The second update was actually removing the compressed style of the field search box so it lines up better size-wise with the rest of the controls.

image

And the mobile version (both being bordered buttons) is actually more consistent.

image

@andreadelrio
Copy link
Contributor

@kertal filed issue #84805 so we can tackle the footer problem Joe brought up in a follow up PR. From the design side this should be ready to be merged.

@andreadelrio andreadelrio self-requested a review December 2, 2020 18:03
@flash1293
Copy link
Contributor

Thanks for the explanation, @cchaos - the K8 theme mockup looks great

@kertal
Copy link
Member Author

kertal commented Dec 3, 2020

@elasticmachine merge upstream

Copy link
Contributor

@majagrubic majagrubic left a comment

Choose a reason for hiding this comment

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

Just a few quick code comments while I'm testing this.

onRemoveColumn={onRemoveColumn}
onSort={onSort}
)}
{resultState === 'uninitialized' && <DiscoverUninitialized onRefresh={fetch} />}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use ternary statements here, I think it would improve readability?
resultState === 'uninitialized' ? <DiscoverUninitialized onRefresh={fetch} : null

Copy link
Member Author

Choose a reason for hiding this comment

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

But I think then we should do it the same way throughout the file? for consistency. the readability is subjective, but what's an argument for ternary is, that it's explicit. issue with && are very well described here: https://kentcdodds.com/blog/use-ternaries-rather-than-and-and-in-jsx
However I'd prefer changes here later on (since it's not a single line)


return (
<I18nProvider>
<div className="dscAppContainer" data-fetch-counter={fetchCounter}>
<h1 className="euiScreenReaderOnly">{savedSearch.title}</h1>
<EuiPage className="dscPage" data-fetch-counter={fetchCounter}>
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 could break down the render function into smaller functions, to improve readability. Eg. renderSidebar, renderRows etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you don't mind we could do that later on ⏳

@@ -114,7 +114,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.discover.waitUntilSearchingHasFinished();

const newDurationHours = await PageObjects.timePicker.getTimeDurationInHours();
expect(Math.round(newDurationHours)).to.be(24);
expect(Math.round(newDurationHours)).to.be(26);
Copy link
Contributor

Choose a reason for hiding this comment

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

why this change?

Copy link
Member Author

@kertal kertal Dec 3, 2020

Choose a reason for hiding this comment

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

The layout changed, and so the width of the date histogram, but what didn't change is the width of the histogram brushing with the mouse. Because the date histogram is a bit smaller, a longer time range is selected. that's why more hours were selected. (It's a good question, also I've wondered why this test was failing initially)

Copy link
Contributor

@majagrubic majagrubic left a comment

Choose a reason for hiding this comment

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

Tested in Chrome on Mac OS, looks great!

@kertal kertal merged commit 95f8d9d into elastic:master Dec 3, 2020
kertal added a commit to kertal/kibana that referenced this pull request Dec 3, 2020
Co-authored-by: Andrea Del Rio <delrio.andre@gmail.com>
Co-authored-by: cchaos <caroline.horn@elastic.co>
Co-authored-by: Michail Yasonik <michail.yasonik@elastic.co>
Co-authored-by: Dave Snider <dave.snider@gmail.com>
Co-authored-by: Marta Bondyra <marta.bondyra@elastic.co>
# Conflicts:
#	src/plugins/discover/public/application/angular/directives/fixed_scroll.test.js
kertal added a commit that referenced this pull request Dec 3, 2020
Co-authored-by: Andrea Del Rio <delrio.andre@gmail.com>
Co-authored-by: cchaos <caroline.horn@elastic.co>
Co-authored-by: Michail Yasonik <michail.yasonik@elastic.co>
Co-authored-by: Dave Snider <dave.snider@gmail.com>
Co-authored-by: Marta Bondyra <marta.bondyra@elastic.co>
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 279 312 +33

Async chunks

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

id before after diff
discover 432.2KB 450.3KB +18.1KB

Page load bundle

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

id before after diff
discover 82.1KB 82.0KB -93.0B
Unknown metric groups

async chunk count

id before after diff
discover 7 6 -1

History

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.