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

Upgrade EUI to v63.0.6 - updates to new EuiPageTemplate and deprecates old page components #138546

Closed
wants to merge 42 commits into from

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Aug 10, 2022

Summary

[email protected][email protected]


63.0.163.0.6
Patch releases containing bugfixes for EuiPageTemplate and release fixes already present in the previous EUI PR

63.0.6

  • Added a new component prop to EuiPageSection, allowing overriding of the default section tag (#6192)

Deprecations

  • Added @deprecated flags to EuiPageContent_Deprecated, EuiPageContentBody_Deprecated, EuiPageContentHeader_Deprecated, EuiPageContentHeaderSection_Deprecated, EuiPageSideBar_Deprecated and EuiPageTemplate_Deprecated, which will provide helpful hints to IDEs that support jsdoc flags. Consumers will have until August 2023 to migrate from these deprecated components. (#6194)

63.0.5

Bug fixes

  • Fixed missing data-fixed-headers property in some layout configurations using EuiPageTemplate. (#6140)
  • Fixed an EuiPageSidebar bug where inline styles were not correctly updating (#6191)

63.0.4

Bug fixes

  • Fixed the text size of EuiDescriptionListTitle when EuiDescriptionList is compressed (#6160)

63.0.3

Bug fixes

  • Fixed CollapsedItemActions ref callback not accounting for null value (#6145)

63.0.2

Bug fixes

  • Fixed eui.d.ts containing @testing-library type definitions (#6142)

63.0.1

Bug fixes

  • Fixed server-side rendering and test-env errors caused by useCurrentEuiBreakpoint (#6117)
63.0.0 - Main EuiPageTemplate release changelog

63.0.0

  • Added new EuiPageTemplate namespaced component that uses context to pass through props (#5768)
  • Added EuiPageSection component for easier section stacking (#5768)
  • Added EuiPageSidebar component that is an upgrade to EuiPageSideBar (#5768)
  • Extended bottomBorder prop to add 'extended' on EuiPageHeader (#5768)
  • Added paddingSize and restrictWidth directly on EuiPageHeaderContent (#5768)
  • Added data-fixed-headers attribute to <body> with the count of fixed EuiHeader components (#5768)
  • Extended usePortal prop on EuiBottomBar to accept EuiPortalProps (#5768)
  • Increased paddingSize support by EuiPage for xl and xs sizes (#5768)
  • Moved restrictWidth default true style to style attribute on EuiPage and EuiPageBody (#5768)
  • Added optional height parameter to euiYScroll(), useEuiYScroll, euiYScrollWithShadows(), and useEuiYScrollWithShadows (#5768)
  • Added repositionOnScroll directly to EuiPopover rendered by mobile version of EuiHeaderLinks (#5768)

Bug fixes

  • Fixed missing render of breadcrumbs on EuiPageHeader when alignItems = 'top' (#5768)
  • Fixed logicalStyle() to return the same value type as was passed in (instead of converting to string) (#5768)

Deprecations

  • Deprecated the old EuiPageTemplate component and renamed to EuiPageTemplate_Deprecated (#5768)
  • Deprecated EuiPageContent and EuiPageContentBody in favor of new EuiPageSection (#5768)
  • Deprecated EuiPageContent and renamed to EuiPageContent_Deprecated (#5768)
  • Deprecated EuiPageContentBody and renamed to EuiPageContentBody_Deprecated (#5768)
  • Deprecated EuiPageContentHeader and renamed to EuiPageContentHeader_Deprecated (#5768)
  • Deprecated EuiPageContentHeaderSection and renamed to EuiPageContentHeaderSection_Deprecated (#5768)
  • Deprecated EuiPageSideBar and renamed to EuiPageSideBar_Deprecated (#5768)

Breaking changes

  • Removed nested EuiPageHeader styles when a child of EuiPageBody (#5768)
  • Changed default paddingSize of EuiPage from m to none (#5768)

CSS-in-JS conversion

  • Converted EuiPage and EuiPageBody to Emotion (#5768)
  • Converted EuiPageHeader and EuiPageHeaderContent to Emotion (#5768)
  • Removed euiPageRestrictWidth() Sass mixin (#5768)

EuiPageTemplate

This component has been replaced (in EUI) with a new flexible namespaced component that utilizes React context to pass through top level props and a new sectioning component that makes it easier to stack page contents including headers in any order.

👉 New component docs: https://elastic.github.io/eui/#/templates/page-template
👉 EUI PR with details: elastic/eui#5768
👉 Guidelines: https://elastic.github.io/eui/#/templates/page-template/guidelines

In addition, the latest update deprecates a lot of (now defunct) page components like EuiPageContent and renames then with _Deprecated. This will hopefully alert owners that they should be switching to the latest template paradigm.

Tasks performed

✅ Updated deprecated page component imports

Example:

import {
-  EuiPageContent,
-  EuiPageContentBody,
+  EuiPageContent_Deprecated as EuiPageContent,
+  EuiPageContentBody_Deprecated as EuiPageContentBody,
} from '@elastic/eui';

✅ Updated the @kbn/shared-ux-page-kibana-template version of KibanaPageTemplate

This is mostly done and even re-exports the namespaced components so that consumers in Kibana don't have to mis-match Kibana vs EUI prefixed components.

export const KibanaPageTemplate = Object.assign(_KibanaPageTemplate, {
Sidebar: EuiPageTemplate.Sidebar,
Header: EuiPageTemplate.Header,
Section: EuiPageTemplate.Section,
BottomBar: EuiPageTemplate.BottomBar,
EmptyPrompt: EuiPageTemplate.EmptyPrompt,
});

✅ Updated the tutorial documentation page

New version found here: https://github.com/elastic/kibana/blob/2829dea45c970ef21188e399c4004ca40a02dca9/dev_docs/tutorials/kibana_page_template.mdx

✅ Fixed current usages of the Shared-UX KibanaPageTemplate

Only those consuming KibanaPageTemplate from @kbn/shared-ux-page-kibana-template have been fixed / updated to the new paradigm.

✅ Converted a few examples from old template to new

See comment review below: #138546 (review)

✅ Updated snapshots and FTR tests

The snapshots and tests caught some amount of bugs, but can't catch every possible UI bug or regression. Please take the time to manually QA/regression test your app.

🚨 Affected apps/teams 🚨

If your app/solution is in the below list list, it was affected by the new EuiPageTemplate/KibanaPageTemplate updates. Please take the time to manually QA/UI regression test your app.

  • Observability Solution
  • Security Solution
  • Enterprise Search Solution
  • Kibana Overview plugin
  • Home plugin
  • Management plugin
  • Security plugin - API keys

⚠️ Teams that should eventually migrate from deprecated components ⚠️

Apps importing KibanaPageTemplate from @kbn/kibana-react-plugin/public are using the old/deprecated EuiPageTemplate and should convert to the KibanaPageTemplate from @kbn/shared-ux-page-kibana-template as soon as possible. This applies to the following apps:

  • Canvas plugin
  • ML plugin
  • OSQuery plugin
  • Spaces plugin - spaces selector

Teams that were directly using the now-deprecated EuiPageTemplate/EuiPageContent components (as noted by an _Deprecated import from EUI) should generally convert to using KibanaPageTemplate, or at minimum the new non-deprecated EuiPage* equivalents. There are too many applications to list of these usages (222 files total), so we cannot call these teams out individually, but please consider doing a grep for _Deprecated as in your team codebase to check for them and start planning to migrate over.

The deprecated page components will be removed by August 2023.

Copy link
Contributor Author

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Commit 2d6e6e3 contains the overall conversion of Stack Management application and a set of examples in the API Keys page

solutionNav={solution}
// @ts-expect-error Techincally `paddingSize` isn't supported but it is passed through,
// this is a stop-gap for Stack managmement specifically until page components can be converted to template components
mainProps={{ paddingSize: 'l' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typically the paddingSize is passed to the sections and header elements so each can be tweaked individually, however, Since most of the page contents don't contain padding themselves, we need to force it until all pages are updated.

@@ -118,14 +115,12 @@ export class APIKeysGridPage extends Component<Props, State> {
if (!apiKeys) {
if (isLoadingApp) {
return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="subdued">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The KibanaPageTemplate.EmptyPrompt now takes care default coloring based on overall layout and centering.

);
}

const concatenated = `${this.state.createdApiKey?.id}:${this.state.createdApiKey?.api_key}`;

return (
<>
<EuiPageHeader
<KibanaPageTemplate.Header
paddingSize="none"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

paddingSize is another temporary fix here for the addition of the padding at the top level

<EuiPageContentBody>{this.renderTable()}</EuiPageContentBody>
<EuiSpacer size="l" />

<KibanaPageTemplate.Section paddingSize="none">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

paddingSize is another temporary fix here for the addition of the padding at the top level

@cla-checker-service
Copy link

cla-checker-service bot commented Aug 25, 2022

💚 CLA has been signed

@cee-chen cee-chen force-pushed the test/page_template branch 2 times, most recently from 7096f8f to 4dfe7dc Compare August 26, 2022 15:43
@elastic elastic deleted a comment from kibana-ci Aug 30, 2022
@cee-chen cee-chen changed the title [WIP] Update to new EuiPageTemplate and fix page deprecations Upgrade EUI to v63.0.6 - updates to new EuiPageTemplate and deprecates old page components Aug 31, 2022
cchaos and others added 21 commits August 30, 2022 19:02
- Pushes existing `pageHeader` prompts onto created EuiPageTemplate.PageHeader
- Uses `isEmptyState` to push `pageHeader` props to EuiPageTemplate.EmptyPrompt instead (if `children` are not supplied)
- Collapsing isn’t working (minWidth isn’t updating)
- Moved `bottomBar` to EuiPageTemplate.BottomBar (now contained in just the page contents)
- Change EuiPanel children wrapper with EuiPageTemplate.Section
cchaos and others added 21 commits August 30, 2022 19:02
- Updated `docs/tutorials` mdx page
- Fixed SolutionNav prop types
- Some temporary props applied for BWC until all other pages can be converted
- Converted `API Keys` page’s layout (and especially prompt usags) to new paradigm
- copying and pasting types from KibanaPageTemplateProps, but ah well
- converts pageBodyProps
- fixes non-centered loading template
- fix layouts by auto-wrapping an EuiPageSection for padding, while adding a `customPageSections` prop for more custom sections/layouts

- re-center 404 errors

- update tests
- drop shadow changed slightly in EUI
- Modifies ObservabilityPageTemplate to accept a `bottomBar` prop (a la the old EuiPageTemplate behavior)

NOTE: This opinionated page layout structure is starting to feel like it could be potentially limiting / have all the same pitfalls the previous EuiPageTemplate did. If so, consider something closer to the Enterprise Search page template conversion (`customPageSections`).

- Misc cleanup: Use `KibanaPageTemplate` over `EuiPageTemplate`
- Since theObservabilityPageTemplate is using the new Eui/KibanaPageTemplate, its child templates and types need to be updated accordingly
- was an EUI issue that required a patch release
+ update snapshots
- Fix empty state logic removed in a previous commit
- bogarts KibanaPageTemplate's `isEmptyState` prop instead of using `template="noData"`

- extend template wrappers to past ...rest to underlying Kibana/EuiPageTemplate

+ replace EuiPageTemplate with KibanaPageTemplate for consistency
- for deprecation tags and section tag support
@cee-chen
Copy link
Member

Closing this PR on recommendation of Kibana Ops - unfortunately kibana-ci is no longer making reports on this PR 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants