-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Enterprise Search] Set up initial KibanaPageTemplate #102170
Conversation
x-pack/plugins/enterprise_search/public/applications/shared/layout/page_template.scss
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
@constancecchen I haven't pushed it up yet but deleting the |
Oooh, thanks Scotty, I totally missed that there's multiple headers on the same page. Super good call, let me rethink this and potentially run this by the EUI team for ideas. FWIW there is a semantic and accessibility cost to losing the page header - your heading hierarchy gets messed up (e.g., no single parent That being said it's also totally possible to just pass in custom rendered JSX to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm rubber-stamping this so that it can be merged after @elastic/workplace-search-frontend's review + approval since we are lacking @elastic/app-search-frontend reviewers until next Monday. I have not reviewed or QA'd this code. This was discussed in a recent App Search sync with @richkuz. I trust @constancecchen has represented the interests of the App Search team on this PR.
@constancecchen did me a solid and reviewed another PR of mine before I went away on PTO so I did a high level review and QA below and re-affirmed this approval
@byronhulcher If you have time after your Process Crawls work today to take a quick look at the API code example in the PR description and leave any developer experience feedback/requests that definitely would be appreciated, but if not please feel free to come back to this after your PTO and I can make any change requests retroactively/in a later PR 👍 |
Also, no idea what's going on with CI but those files aren't related to this PR 👊 |
@elasticmachine merge upstream |
+ misc tech debt - create AS components/layout/index.ts for imports
- Update react_router_helpers to pass back props as a plain JS obj instead of only working with React components (+ update react components to use new simpler helper) - Convert SideNavLink active logic to a plain JS helper
NYI: sub navigations (future separate PRs)
- primarily useful for rightSideItems, which often contain conditional logic
Minor refactors: + remove unnecessary type union + fix un-i18n'ed product names + add full stop to documentation sentence + add semantic HTML tags around various page landmarks (header, section)
77c72ef
to
4b1d526
Compare
Apologies for the force push, in light of Scotty's comment I thought it best to start over on the Role Mappings conversion and limit the amount of diffs in that commit. @scottybollinger take a look at 4b1d526 and let me know what you think! Here's new screenshots of the views: I think the only change in there now that I'm not sure will conflict with your current work is me removing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick review of this and also poked around locally. Code looks good and I didn't notice anything broken in QA. I left some non-blocking comments.
@@ -0,0 +1,36 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the filename of be closer to the exported component's name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel super strongly either way, since this is namespaced (folder-wise... folder-spaced?) to app_search/
I don't think it's too confusing, but I know there's IDE implications to file-finding or showing tab names 🤷
FWIW I was kinda copying Workplace Search's folder architecture pattern here (they already have a layout/nav.tsx
and layout/kibana_header_actions.tsx
which we also now have our own version of), so I thought layout/page_template.tsx
made sense as well 🤔
Definitely doesn't bother me either way though, so happy to revisit later if it's annoying down the road or if we want to circle back and do a vote
import { KibanaLogic } from '../kibana'; | ||
import { generateReactRouterProps, ReactRouterProps } from '../react_router_helpers'; | ||
|
||
interface Params { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this interface have a more specific name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been using more generic type names (e.g. Props
, Params
) if they're not getting exported or reused externally. If they're used in other files, that's when I namespace them (e.g. PageTemplateProps
, ReactRouterProps
).
But otherwise it's to me it's kinda like not having to namespace isDocumentsLoading
vs isAnalyticsLoading
- the isLoading
var name is scoped to the file or view, so it doesn't need to be overly specific.
The day I ever start using generic single letter variable names is the day you can hit me over the head with a shovel tho, gotta draw that line somewhere
id: 'engines', | ||
name: ENGINES_TITLE, | ||
...generateNavLink({ to: ENGINES_PATH, isRoot: true }), | ||
items: [], // TODO: Engine nav |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the plan for this TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upcoming PR!
/* | ||
* EnterpriseSearchPageTemplate is a light wrapper for KibanaPageTemplate (which | ||
* is a light wrapper for EuiPageTemplate). It should contain only concerns shared | ||
* between both AS & WS, which should have their own AppSearchPageTemplate & | ||
* WorkplaceSearchPageTemplate sitting on top of this template (:nesting_dolls:), | ||
* which in turn manages individual product-specific concerns (e.g. side navs, telemetry, etc.) | ||
* | ||
* @see https://github.com/elastic/kibana/tree/master/src/plugins/kibana_react/public/page_template | ||
* @see https://elastic.github.io/eui/#/layout/page | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1000000000000 for this comment, you love to see it
import { | ||
KibanaPageTemplate, | ||
KibanaPageTemplateProps, | ||
} from '../../../../../../../src/plugins/kibana_react/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer an absolute path if we can use one for this, I think this would read a lot better as src/plugins/kibana_react/public/
as if it was a yarn installed third-party module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+++, but I don't think we can sadly :( I copied this from the Observability folks and AFAIK Kibana's aliases mostly involve src/core
and not src/plugins
. Definitely would love to make that request though - I might ping the DevOps folks in a little bit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😻 Thanks for implementing this. I love your writeup and glad to see that this effort opens your application up for even more possibilities/flexibilities.
One quick thing about the side-nav. The pattern is to not have those root level items actually be clickable/navigable. Instead we want to be consistent throughout and keep them solely to describe sections. I couldn't completely deter this functionality in EUI because it would break a lot of existing implementations but you can work around it by simply creating an empty first item like this:
items = [
{
name: '',
items: [
{
name: 'Item 1',
id: '',
},
...etc
]
}
]
Ahhh I was wondering about that Caroline!! I just assumed that's how it was supposed to work, LOL. Probably should have pinged you at some point 🤦♀️ Awesome, testing this out now. Just to check, is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the great comments and test helpers! 🎉
- but shenanigans it a bit to take our i18n'd shared product names (requires as const assertion) - done to reduce merge conflicts for Scotty / make his life (hopefully) a bit easier between ent-search and Kibana
jenkins, test this (restarting due to jenkins upgrade) |
Thanks Spencer!! 🎊 |
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* Set up shared EnterpriseSearchPageTemplate component * Set up product-specific page templates + setPageChrome + misc tech debt - create AS components/layout/index.ts for imports * Set up navigation helpers for EuiSideNav usage - Update react_router_helpers to pass back props as a plain JS obj instead of only working with React components (+ update react components to use new simpler helper) - Convert SideNavLink active logic to a plain JS helper * Set up top-level product navigations NYI: sub navigations (future separate PRs) * Set up test_helpers for inspecting pageHeaders - primarily useful for rightSideItems, which often contain conditional logic * Initial example: Convert RoleMappings views to new page template Minor refactors: + remove unnecessary type union + fix un-i18n'ed product names + add full stop to documentation sentence + add semantic HTML tags around various page landmarks (header, section) * EUI feedback: add empty root parent section * Revert Role Mappings union type removal - but shenanigans it a bit to take our i18n'd shared product names (requires as const assertion) - done to reduce merge conflicts for Scotty / make his life (hopefully) a bit easier between ent-search and Kibana Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
) * Set up shared EnterpriseSearchPageTemplate component * Set up product-specific page templates + setPageChrome + misc tech debt - create AS components/layout/index.ts for imports * Set up navigation helpers for EuiSideNav usage - Update react_router_helpers to pass back props as a plain JS obj instead of only working with React components (+ update react components to use new simpler helper) - Convert SideNavLink active logic to a plain JS helper * Set up top-level product navigations NYI: sub navigations (future separate PRs) * Set up test_helpers for inspecting pageHeaders - primarily useful for rightSideItems, which often contain conditional logic * Initial example: Convert RoleMappings views to new page template Minor refactors: + remove unnecessary type union + fix un-i18n'ed product names + add full stop to documentation sentence + add semantic HTML tags around various page landmarks (header, section) * EUI feedback: add empty root parent section * Revert Role Mappings union type removal - but shenanigans it a bit to take our i18n'd shared product names (requires as const assertion) - done to reduce merge conflicts for Scotty / make his life (hopefully) a bit easier between ent-search and Kibana Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Constance <constancecchen@users.noreply.github.com>
…egrations-to-global-search * 'master' of github.com:elastic/kibana: (46 commits) [Lens] Add some more documentation for dynamic coloring (elastic#101369) hide not searchable results when no term (elastic#102401) [Lens] Fix Formula functional test with multiple suggestions (elastic#102378) Fix trusted apps modified by field displayed as a date field (elastic#102377) [Lens] Docs for time shift (elastic#102048) update readme of logs-metrics-ui (elastic#101968) Refactor observability plugin breadcrumbs (elastic#102290) [Index Patterns] Move rollup config to index pattern management v2 (elastic#102285) [Security Solution][Endpoint] Isolate Action should only be available to Platinum+ licenses (elastic#102374) [build] Updates Ironbank templates (elastic#102407) Update security best practices document (elastic#100814) [Enterprise Search] Set up initial KibanaPageTemplate (elastic#102170) [Reporting/Docs] Add section to troubleshooting guide to explain the StatusCodeError logs (elastic#102278) [DOCS] Updating Elastic Security Overview topic (elastic#101922) [Uptime] refactor Synthetics Integration package UI (elastic#102080) [Task Manager] Log at different levels based on the state (elastic#101751) [APM] Fixing time comparison types (elastic#101423) [RAC] Update alert documents in lifecycle rule type helper (elastic#101598) [ML] Functional tests - fix and re-activate alerting flyout test (elastic#102368) [Reporting] remove unused reference to path.data config (elastic#102267) ... # Conflicts: # x-pack/plugins/fleet/kibana.json
Summary
Despite my best attempts to make this a smaller PR, it's still on the larger side and should definitely be reviewed commit-by-commit.
<EnterpriseSearchPageTemplate />
which will replace the old<Layout />
component and provides some nicer/DRYer APIs for things like a loading state, empty state, flash messages, and a built-in read only mode callout<AppSearchPageTemplate />
and<WorkplaceSearchPageTemplate />
components which manage their own solution navs and provide some nicer/DRYer APIs for things like page chrome and page telemetrytest_helpers
for inspecting nested page headers within page templatesLayout
orSideNav
components - that will be its own separate PR at the end of everything to allow granularly migrating batches of views at a time instead of all at onceExample code of what all views should generally look like, going forward:
Screenshots
Checklist