-
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
[APM] Sets up APM with new shared Kibana core context #43920
Conversation
8a409a0
to
e497a82
Compare
💔 Build Failed |
e497a82
to
cca58f8
Compare
@@ -83,7 +83,8 @@ export class WatcherFlyout extends Component< | |||
WatcherFlyoutProps, | |||
WatcherFlyoutState | |||
> { | |||
static contextType = CoreContext; | |||
static contextType = KibanaCoreContext; | |||
context!: React.ContextType<typeof KibanaCoreContext>; |
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.
AFAICT this is the way to let TS know what type this.context
should be in the rest of the class, so that each reference to this.context
doesn't need to self-type.
It's weird and just another reason to eventually move all our shit away from classes :)
@@ -11,7 +11,7 @@ import { toastNotifications } from 'ui/notify'; | |||
import * as callApmApi from '../../../../services/rest/callApmApi'; | |||
import { ServiceOverview } from '..'; | |||
import * as urlParamsHooks from '../../../../hooks/useUrlParams'; | |||
import * as coreHooks from '../../../../hooks/useCore'; | |||
import * as kibanaCore from '../../../../../../observability/public/context/kibana_core'; |
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.
FWIW, we only export things from observability/public
by way of Kibana convention, but if you try to import from there and then use jest.spyOn()
, it blows up because the re-exported stuff in the public/index
file doesn't mesh with jest.spyOn
.
For more info, see: https://stackoverflow.com/a/53307822
💚 Build Succeeded |
💚 Build Succeeded |
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.
This LGTM 👍
I'll defer approval to @ogupte since he is the one working on platform migration on the APM side.
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.
This is great, glad that we can share this hook. Should we remove the APM-specific useCore and CoreContext code in this PR or a follow-up?
I'll do it now, thanks! |
💔 Build Failed |
retest |
💚 Build Succeeded |
Summary
In order to begin sharing utilities and components that rely on Kibana core functionality, we need to share a Kibana context provider that should wrap all of our apps. This PR swaps out the existing one in APM for a shared one that comes from the observability plugin so that it matches the same interface. This way we can share link utilities so that the link hrefs can be shared from a central place, with access to base path utilities, uiCapabilities, and other core utilities.
I'd like to get this in before moving onto the link work so that this doesn't become a merge nightmare with APM files.
If this is looking good, I can remove the APM core context and hook in this PR too.