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

[App Search] Added the Documents View #83947

Merged
merged 34 commits into from
Dec 4, 2020

Conversation

JasonStoltz
Copy link
Member

@JasonStoltz JasonStoltz commented Nov 20, 2020

Summary

This PR adds a Documents View for the App Search Plugin, accessible via the 'Documents' link in the Engines sub nav.

The view is ported from our stand-alone UI. Most notable about this view is that it uses the https://github.com/elastic/search-ui library.

It looks like it balloons the size of the enterpriseSearch async chunk to ~1.3MB, increasing by ~630.3KB (based on the build report below). I'm guessing this is due to all of the transitive dependencies brought in by @elastic/react-search-ui. Is there a way to see a breakdown of the chunk?

We don't use the majority of the transitive dependencies that are brought in. I thought these might get shaken out by tree shaking, but perhaps not. We might be able to do some work on search-ui to omit these dependencies.

Given that, I'm looking for thoughts and opinions on how to proceed. The commit that adds Search UI is here: 9b3a7a6. CC specifically @spalger and @constancecchen.

The view is completely functional, but I do leave a few things out to be implemented later as separate PRs:

What it includes:

  • Added @elastic/react-search-ui and @elastic/search-ui-app-search-connector as dependencies.
  • Added the search-ui-based search experience to the Documents page.

What it does not include the following, which will be implemented in separate PRs:

  • This PR does not include the correct "Result" view, which must requires the StuiResult component to be migrated. This uses a temporary view for showing results.
  • This PR does not include the facets and the ability to configure those facets.
  • This PR does not include polling to detect when indexing finishes on an Engine.
  • This PR does not have the Index Documents button wired up.

screencapture-localhost-5601-app-enterprise-search-app-search-engines-national-parks-demo-documents-2020-11-20-12_17_40

QA

You can see various forms of "No Results" messages in this PR by using the following scenarios:

  • Perform a search that returns no results on the Documents page
  • Visit the Documents page on a regular engine that has no Documents indexed
  • Visit the Document page on a meta engine that has no Documents indexed

Another scenario to note:

  • When visiting this page for a meta engine, there should be a blue banner displayed at the top

Reviewing this PR

⚠️ I recommend stepping through this commit by commit. ⚠️

It is a big PR, but the atomic commits should make this easier to review in logical chunks.

Note that the majority of the new code is more or less copy / paste from the old code repository. The changes I made were mostly limited to adding i18n, fixing axe failures, and writing tests. I made little to no intentional refactors.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@JasonStoltz JasonStoltz force-pushed the documents-view-3 branch 2 times, most recently from eae5f43 to 27cf3c3 Compare November 23, 2020 17:33
@JasonStoltz JasonStoltz force-pushed the documents-view-3 branch 4 times, most recently from 35111a0 to c8225d2 Compare November 23, 2020 19:46
@JasonStoltz JasonStoltz marked this pull request as ready for review November 24, 2020 15:56
@JasonStoltz JasonStoltz requested a review from a team November 24, 2020 15:56
@JasonStoltz JasonStoltz added release_note:skip Skip the PR/issue when compiling release notes v7.11.0 labels Nov 24, 2020
@cee-chen
Copy link
Member

It looks like it balloons the size of the enterpriseSearch async chunk to ~1.3MB, increasing by ~630.3KB (based on the build report below).

1.3MB doesn't feel too bad considering it's async, and we can potentially use React.lazy to load in the Documents view so it only loads on that view and not every single view (correct me if I'm wrong Spencer).

I'm guessing this is due to all of the transitive dependencies brought in by @elastic/react-search-ui. Is there a way to see a breakdown of the chunk?

Not sure if this is what you mean, but Josh Dover has a Kibana dashboard comparing various plugin sizes that might be helpful? For Search UI, I think there are dependency breakdown tools that @yakhinvadim has used in the past - any chance you could run one of those on Search UI, Vadim?

We don't use the majority of the transitive dependencies that are brought in. I thought these might get shaken out by tree shaking, but perhaps not. We might be able to do some work on search-ui to omit these dependencies.

My very limited experience w/ tree shaking is that it never works how you expect haha. Just want to level-set here as well Spencer, we're definitely happy to re-look at Search UI but our current top/pressing priority is merging App Search fully to Kibana by 7.13 - it would be awesome if Search UI could be added as-is currently and improved post-MVP, but if you see anything that would be a blocker, please let us know!

@yakhinvadim
Copy link
Contributor

@constancecchen would this be enough? https://bundlephobia.com/result?p=@elastic/react-search-ui@1.5.0

@JasonStoltz
Copy link
Member Author

JasonStoltz commented Nov 24, 2020

@yakhinvadim Nice Vadim, that is helpful. Interestingly, it looks like that says the bundle size is 262.2
kb. I suppose maybe the the other 300+ kb is just our new code. There are quite a few lines in this PR.

To note, if I were able to publish a version of react-search-ui that dropped it's dependency on https://bundlephobia.com/result?p=@elastic/react-search-ui-views@1.5.0, we'd presumably be able to reduce the bundle size by 187kb.

I'm guessing that's not significant enough to be a show stopper for this PR.

Copy link
Member

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

First small set of comments, nothing blocking / mostly very minor - trying to batch my comments and review this PR in bits at a time

Copy link
Member

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Second batch of comments/q's

Copy link
Member

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

3rd batch of comments - only 1 set / 6 more files to go!

@JasonStoltz
Copy link
Member Author

@constancecchen Ready for a second look, all of those commits correspond with a comment you made. There are a couple of additional commits at the end:

a2d9ed8 - reset yarn.lock - I had to regenerate yarn.lock to resolve a merge error
a2d9ed8 - fix type errors - Fixed error I introduced in previous commits

Copy link
Member

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Changes look great! One non-blocking comment, approving in advance for when i18n error is fixed

@JasonStoltz
Copy link
Member Author

Thanks @constancecchen 👍 👍 👍

@cee-chen
Copy link
Member

cee-chen commented Dec 3, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
enterpriseSearch 636 969 +333

Async chunks

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

id before after diff
enterpriseSearch 1.1MB 1.7MB ⚠️ +631.0KB

Distributable file count

id before after diff
default 43496 46520 +3024
oss 22757 27561 +4804

Page load bundle

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

id before after diff
upgradeAssistant 60.4KB 60.5KB +87.0B

History

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

@JasonStoltz JasonStoltz merged commit 40e206e into elastic:master Dec 4, 2020
@JasonStoltz JasonStoltz deleted the documents-view-3 branch December 4, 2020 16:17
JasonStoltz added a commit to JasonStoltz/kibana that referenced this pull request Dec 7, 2020
JasonStoltz added a commit to JasonStoltz/kibana that referenced this pull request Dec 7, 2020
JasonStoltz added a commit to JasonStoltz/kibana that referenced this pull request Dec 7, 2020
JasonStoltz added a commit to JasonStoltz/kibana that referenced this pull request Dec 7, 2020
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Dec 8, 2020
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v7.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants