Remove react references from core OverlayService apis#48431
Remove react references from core OverlayService apis#48431pgayvallet merged 27 commits intoelastic:masterfrom
OverlayService apis#48431Conversation
|
Pinging @elastic/kibana-platform (Team:Platform) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
16fe10c to
98d87e3
Compare
This comment has been minimized.
This comment has been minimized.
98d87e3 to
7667b28
Compare
This comment has been minimized.
This comment has been minimized.
7667b28 to
9d80529
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b17ec7f to
f467e48
Compare
This comment has been minimized.
This comment has been minimized.
f467e48 to
c2b90c9
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
92873f2 to
7e03f01
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
52309a2 to
3bdf701
Compare
This comment has been minimized.
This comment has been minimized.
|
retest |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
626ce2e to
75ab490
Compare
…stic-overlay-service
💚 Build Succeeded |
|
PR in standby until #49573 has been merged. |
…stic-overlay-service
💚 Build Succeeded |
walterra
left a comment
There was a problem hiding this comment.
transform/ml change LGTM
…rom overlayService
|
@chandlerprall following our discussion on this PR, could you just confirm that the changes are ok for |
|
#49573 has been merged, PR now integrates these changes and is ready for review |
💚 Build Succeeded |
| } from '@elastic/eui'; | ||
| import { EuiSpacer } from '@elastic/eui'; | ||
| import { FormattedMessage } from '@kbn/i18n/react'; | ||
| import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; |
There was a problem hiding this comment.
At some point, this stateful import will probably go away. Can we pass this Provider down from the I18n service to future-proof this a bit?
There was a problem hiding this comment.
Sure. However, the stateful import is also used in kibana_react'stoMountPoint
kibana/src/plugins/kibana_react/public/util/react_mount.tsx
Lines 22 to 40 in e04adbe
Should this be a concern?
| /** {@link OverlayFlyoutStart#open} */ | ||
| openFlyout: OverlayFlyoutStart['open']; | ||
| /** {@link OverlayModalStart#open} */ | ||
| openModal: OverlayModalStart['open']; |
There was a problem hiding this comment.
Are we going to make these APIs a bit more consistent with banners in a separate change? (eg. overlays.flyout.open)
There was a problem hiding this comment.
I did, but reverted it in e26120b following discussion with @rudolf starting at #48431 (comment) as there was no consensus. What should we do?
chandlerprall
left a comment
There was a problem hiding this comment.
Discussion has addressed @elastic/kibana-design concerns
💚 Build Succeeded |
* move/rename overlay mount and unmount types from banner to parent module Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * migrate openModal / modalService Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> fix I18nProvider import path Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * updates core doc Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> update doc bis Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * migrate openFlyout / flyout service Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * remove CoreStart export from kibana-react Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * adapt some calls to new signature Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * adapt new calls Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * adapt js call Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * add flex layout on mountWrapper component to avoid losing scroll on overlays Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * create proper flyout/modal services * update generated doc * update snapshot on data/query_bar * use ReactNode instead of ReactElement * rename mountForComponent to reactMount * change reactMount usages to toMountPoint * remove duplicate MountPoint type in overlays * remove duplicate mount utilities from overlays * allow to specify custom class name to MountWrapper * Allow to specialize MountPoint on HTMLElement subtypes * updates generated doc * undeprecates openFlyout/openModal & remove direct subservice access from overlayService * adapt toast api to get i18n context from service * use MountPoint instead of inline definition
So @pgayvallet @joshdover and I decided we'll try to apply the following principle in deciding how we expose API's: |
) * move/rename overlay mount and unmount types from banner to parent module Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * migrate openModal / modalService Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> fix I18nProvider import path Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * updates core doc Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> update doc bis Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * migrate openFlyout / flyout service Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * remove CoreStart export from kibana-react Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * adapt some calls to new signature Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * adapt new calls Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * adapt js call Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * add flex layout on mountWrapper component to avoid losing scroll on overlays Signed-off-by: pgayvallet <pierre.gayvallet@elastic.co> * create proper flyout/modal services * update generated doc * update snapshot on data/query_bar * use ReactNode instead of ReactElement * rename mountForComponent to reactMount * change reactMount usages to toMountPoint * remove duplicate MountPoint type in overlays * remove duplicate mount utilities from overlays * allow to specify custom class name to MountWrapper * Allow to specialize MountPoint on HTMLElement subtypes * updates generated doc * undeprecates openFlyout/openModal & remove direct subservice access from overlayService * adapt toast api to get i18n context from service * use MountPoint instead of inline definition
Summary
Refactor the
OverlayServiceto use framework agnosticMountPointinstead of react components.OverlayService.openModalandOverlayService.openFlyoutto use the newMountPointinterface introduced in Remove react references from coreNotificationsapis #49573 instead of direct react components usagemodalsandflyoutstoMountPointadapterFixes #37894
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support- [ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
- [ ] This was checked for breaking API changes and was labeled appropriately- [ ] This includes a feature addition or change that requires a release note and was labeled appropriatelyDev Docs
The core
OverlayServicemethods are now framework agnostic and no longer accept react components as input. Please usekibana_react'stoMountPointutility to convert a react component to a mountPoint.For exemple:
Becomes: