-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SLO] Fix SLO plugin context (#183966)
Fixes #183967 This PR reverts the changes introduced in this [PR](#182195) regarding SLO Plugin context. --------- Co-authored-by: shahzad31 <[email protected]>
- Loading branch information
Showing
4 changed files
with
49 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...lugins/observability_solution/slo/public/embeddable/slo/common/slo_embeddable_context.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import React from 'react'; | ||
import { Router } from '@kbn/shared-ux-router'; | ||
import { createBrowserHistory } from 'history'; | ||
import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common'; | ||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import { PluginContext } from '../../../context/plugin_context'; | ||
import { SloEmbeddableDeps } from '../overview/types'; | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
export interface SloEmbeddableContextProps { | ||
deps: SloEmbeddableDeps; | ||
children: React.ReactNode; | ||
} | ||
|
||
export function SloEmbeddableContext({ deps, children }: SloEmbeddableContextProps) { | ||
const { observabilityRuleTypeRegistry } = deps.observability; | ||
const { navigation } = deps.observabilityShared; | ||
|
||
return ( | ||
<Router history={createBrowserHistory()}> | ||
<EuiThemeProvider darkMode={true}> | ||
<KibanaContextProvider services={deps}> | ||
<PluginContext.Provider | ||
value={{ | ||
observabilityRuleTypeRegistry, | ||
ObservabilityPageTemplate: navigation.PageTemplate, | ||
}} | ||
> | ||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider> | ||
</PluginContext.Provider> | ||
</KibanaContextProvider> | ||
</EuiThemeProvider> | ||
</Router> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters