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

[Workplace Search] Initial rendering of Org Sources #84164

Merged

Conversation

scottybollinger
Copy link
Contributor

@scottybollinger scottybollinger commented Nov 23, 2020

Summary

This PR builds upon the previous PRs (#83954, #83799, #83544, #83459, #83799, #83593) to achieve a working render of the main Sources tree. The result is the majority of the Organization Sources section working as expected with more to be completed later.

sources

Some notes:

  • This is only Organization sources, Personal sources will come later.
  • Any copy that was in the ent-search sidebar is just placed at the top of the main content area for now. Will work with design to get this fixed in a future PR.
  • The DisplaySettings and Schema sections of the custom sources have not been migrated yet.
  • Assume that a lot of the design will change so please ignore any design issues until a future PR cleans all of that up.
  • It was decided by Product that instead of keying off of /org to determine context, that we would now flip it where we key of personal with /p.
  • Content source flows have not been tested yet because the backend needs to handle redirects first. The flow has been tested as far as it can be and works fine.
  • There is quite a bit more i18n to be done outside of the logic files, and that will be done in a future PR

More extensive QA to be done after DisplaySettings and Schema are added and the server can handle the redirects correctly.

Best to follow along by commit with whitespace changes hidden

Didn’t have a way to test these when created
No need to do this in 2 places now. There was a race condition where the default logic value for `isOrganization` was set to `false` We don’t need a useEffect call here because the value is synchronous and has no side effects. Calling the method directly fixes the race condition.
It was decided by Product that instead of keying off of `/org` to determine context, that we would now flip it where we key of provate with `/p`.

This means that /sources is now organization where before it was personal
This aligns with App Search and allows for easier telemtry and breadcrumbs
As a part of this commit, the approach for rendering subnavs was refactored to align with App Search.

There was a bug where some components weren’t rendering properly because the SourceLogic and GroupsLogic files were never unmounting. The reason for this is the subnav components use their respective logic files to get the IDs needed for rendering the subnav links. That is, SourceSubNav would call SourceLogic to get the ID to render the links and would stay rendered for the duration of the user’s time in the app. The result is that users would leave the source details page and navigate to add a new source and the logic file would never reset to a loading state and the UI would break.

The fix was to borrow from the pattern App Search uses and pass the subnavs as props. Because App Search only uses a single engines subnav, they only needed one prop. We use multiple props for each subnav.

Also, the subnav should not be rendered on the root routes (/sources, /p/sources, and /groups) so conditionals were added to only render the subnavs when not on those root routes.
Missed this in first commit
Before this change, the legacy styles were not ported over. This gives a uniform size for both wrapped and unwrapped icons. The icons are a bit smaller on the add source page but Eui has lowered it’s largest size ‘xxl’ and we would need to write manual overrides. IMO the change is not significant enough to override.
The eui.css file in ent-search is no longer up to date with current EUI and this was broken. The best fix was to use the component that renders as expected
More in a future PR but this makes the majority of things look correct.
Fix some type errors and rename constants
@scottybollinger scottybollinger added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting labels Nov 23, 2020
We have multiple `Layouts` now with the new subnavs
Like the first commit, missed these when porting over routes with no UI.
The columns were way off in Kibana
No longer needed since ‘/org’ is gone
@scottybollinger
Copy link
Contributor Author

@constancecchen when you have some time (next week is totally fine) can you take a look at my approach here? No need to review the entire PR; just wanted to get your thoughts on how I implemented this particular thing.

@scottybollinger scottybollinger marked this pull request as ready for review November 23, 2020 23:40
@scottybollinger scottybollinger requested a review from a team as a code owner November 23, 2020 23:40
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
enterpriseSearch 504 596 +92

Async chunks

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

id before after diff
enterpriseSearch 746.6KB 985.0KB ⚠️ +238.4KB

Distributable file count

id before after diff
default 43057 43060 +3
Unknown metric groups

miscellaneous assets size

id before after diff
enterpriseSearch 851.5KB 881.0KB +29.5KB

History

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

Copy link
Contributor

@yakhinvadim yakhinvadim left a comment

Choose a reason for hiding this comment

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

This is amazing, Scotty! 💯

Everything looks good to me except for increased bundle size:

id before after diff
enterpriseSearch 746.6KB 985.0KB ⚠️ +238.4KB

I couldn't find the obvious source of the increase. The only new import I noticed is telemetry and kibana chrome, but I expect them to already be included in enterpriseSearch bundle.

Do you have ideas?

Please feel free to merge if the bundle size increase is expected and unavoidable.

@scottybollinger
Copy link
Contributor Author

This is amazing, Scotty! 💯

Everything looks good to me except for increased bundle size:

id before after diff
enterpriseSearch 746.6KB 985.0KB ⚠️ +238.4KB
I couldn't find the obvious source of the increase. The only new import I noticed is telemetry and kibana chrome, but I expect them to already be included in enterpriseSearch bundle.

Do you have ideas?

Please feel free to merge if the bundle size increase is expected and unavoidable.

Thanks Vadim. This is the bulk of the Workplace Search application and my assumption is that the bundle size increased because all of the code in the 6 PRs listed above had not actually been imported into the app until this PR, as they were simply migrated and never injected into the bundle. This PR makes use of all of those components and that increase does not surprise me, although I do think we should, as Constance has suggested, explore code splitting the entire Enterprise Search Kibana plugin at some point. If we have time before 8.0, I can start looking into this. Going to go ahead and merge now.

@scottybollinger scottybollinger merged commit a12bb04 into elastic:master Nov 24, 2020
@scottybollinger scottybollinger deleted the scottybollinger/org-sources branch November 24, 2020 16:16
rylnd added a commit to rylnd/kibana that referenced this pull request Nov 24, 2020
* master: (41 commits)
  [Maps] fix code-owners (elastic#84265)
  [@kbn/utils] Clean target before build (elastic#84253)
  [code coverage] collect for oss integration tests (elastic#83907)
  [APM] Use `asTransactionRate` consistently everywhere (elastic#84213)
  Attempt to fix incremental build error (elastic#84152)
  Unskip "Copy dashboards to space" (elastic#84115)
  Remove expressions.legacy from README (elastic#79681)
  Expression: Add render mode and use it for canvas interactivity (elastic#83559)
  [deb/rpm] Move systemd service to /usr/lib/systemd/system (elastic#83571)
  [Security Solution][Resolver] Allow a configurable entity_id field (elastic#81679)
  [ML] Space permision checks for job deletion (elastic#83871)
  [build] Provide ARM build of RE2 (elastic#84163)
  TSVB should use "histogram:maxBars" and "histogram:barTarget" settings for auto instead of a default 100 buckets (elastic#83628)
  [Workplace Search] Initial rendering of Org Sources (elastic#84164)
  update geckodriver to 0.28 (elastic#84085)
  Fix timelion vis escapes single quotes (elastic#84196)
  [Security Solution] Fix incorrect time for dns histogram (elastic#83532)
  [DX] Bump TS version to v4.1 (elastic#83397)
  [Security Solution] Add endpoint policy revision number (elastic#83982)
  [Fleet] Integration Policies List view (elastic#83634)
  ...
@cee-chen
Copy link
Member

@constancecchen when you have some time (next week is totally fine) can you take a look at my approach here? No need to review the entire PR; just wanted to get your thoughts on how I implemented this particular thing.

Super late, but just wanted to say your approach in that commit looked good to me! 👍

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 release_note:skip Skip the PR/issue when compiling release notes v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants