[Enterprise Search] Support active nav links that have both subnav & non-subnav child routes#103036
Conversation
There was a problem hiding this comment.
[AS] /engines/new is the same route used in the standalone UI
There was a problem hiding this comment.
[AS] This is not the same route as the old standalone UI - I think it was /meta_engines/new there.
I'm not 100% sold on /engines/new_meta_engine myself - do folks prefer something more like /engines/new/meta_engine?
There was a problem hiding this comment.
I'm thinking about DRYing out an importable mock for shared/layout/generateNavLink at some point since a few different nav files use it, but might save that for the final page template PR
|
@elasticmachine merge upstream |
|
^ Master has a broken commit. Nothing I can do until it gets reverted by devops |
|
@elasticmachine merge upstream |
scottybollinger
left a comment
There was a problem hiding this comment.
Changes LGTM! Thanks for knocking this out and for the great, easy to read refactor 💯
…ine isSelected + change getNavLinkActive to early returns + tweak tests for readability
- to show active on creation routes but not on single source routes
- should eventually show active on creation routes but not on single engine routes
- so that it correctly shows as a child route of the Engines link + update breadcrumbs
bf437ad to
31dab28
Compare
💛 Build succeeded, but was flaky
Test FailuresKibana Pipeline / general / Firefox XPack UI Functional Tests.x-pack/test/functional/apps/grok_debugger/grok_debugger·js.logstash grok debugger app "before all" hook in "grok debugger app"Standard OutStack TraceMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
|
Thanks y'all! |
…non-subnav child routes (elastic#103036) * Update generateNavlink to take an `items` subNav and use it to determine isSelected + change getNavLinkActive to early returns + tweak tests for readability * Update WS nav Sources link - to show active on creation routes but not on single source routes * Update AS nav Engines link - should eventually show active on creation routes but not on single engine routes * Update AS engine creation routing - so that it correctly shows as a child route of the Engines link + update breadcrumbs
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
…non-subnav child routes (#103036) (#103142) * Update generateNavlink to take an `items` subNav and use it to determine isSelected + change getNavLinkActive to early returns + tweak tests for readability * Update WS nav Sources link - to show active on creation routes but not on single source routes * Update AS nav Engines link - should eventually show active on creation routes but not on single engine routes * Update AS engine creation routing - so that it correctly shows as a child route of the Engines link + update breadcrumbs Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Summary
This functionality was requested by Vadim in #102592 (comment), but it benefits both Workplace Search (Sources) and App Search (Engines).
In the case of both WS Sources and AS Engines, their side nav links have a subnav (the
itemsarray) for single Source or single Engine navigation, but it also has a "Create Source"/"Create Engine" link or route of some sort that should not show a subnav, but should still highlight the parent Sources/Engines link as active.The problem prior to this PR is that we cannot simply throw on an
shouldShowActiveForSubroutesflag, because the parent link shouldn't show active for subroutes while its subnav is open/has active links:Left: Behavior with only

shouldShowActiveForSubroutes; Right: how EUI demonstrates active nested linksThis PR addresses that problem by passing the
itemssubnav into ourgenerateNavLinkhelper, which then usesitemsto determine whether or not the nav link should be shown as active (isSelected) or not.Screencaps
Workplace Search
Before
After
App Search
Before
After
Checklist