mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Maps] Remove usage of deprecated modules for mounting React (#182193)
## Summary
Partially addresses https://github.com/elastic/kibana-team/issues/805
These changes come up from searching in the code and finding where
certain kinds of deprecated AppEx-SharedUX modules are imported.
**Reviewers: Please interact with critical paths through the UI
components touched in this PR, ESPECIALLY in terms of testing dark mode
and i18n.**
<img width="1196" alt="image"
src="7f8d3707
-94f0-4746-8dd5-dd858ce027f9">
Note: this also makes inclusion of `i18n` and `analytics` dependencies
consistent. Analytics is an optional dependency for the SharedUX
modules, which wrap `KibanaErrorBoundaryProvider` and is designed to
capture telemetry about errors that are caught in the error boundary.
### Checklist
Delete any items that are not applicable to this PR.
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)
This commit is contained in:
parent
f51c5c92bc
commit
cdd058637b
4 changed files with 48 additions and 45 deletions
|
@ -25,7 +25,7 @@ import type { PaletteRegistry } from '@kbn/coloring';
|
|||
import type { KibanaExecutionContext } from '@kbn/core/public';
|
||||
import { EuiEmptyPrompt } from '@elastic/eui';
|
||||
import { Query, type Filter } from '@kbn/es-query';
|
||||
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
||||
import {
|
||||
Embeddable,
|
||||
IContainer,
|
||||
|
@ -84,6 +84,7 @@ import {
|
|||
} from '../../common/constants';
|
||||
import { RenderToolTipContent } from '../classes/tooltips/tooltip_property';
|
||||
import {
|
||||
getAnalytics,
|
||||
getCharts,
|
||||
getCoreI18n,
|
||||
getCoreOverlays,
|
||||
|
@ -580,13 +581,14 @@ export class MapEmbeddable
|
|||
/>
|
||||
);
|
||||
|
||||
const I18nContext = getCoreI18n().Context;
|
||||
render(
|
||||
<Provider store={this._savedMap.getStore()}>
|
||||
<I18nContext>
|
||||
<KibanaThemeProvider theme$={getTheme().theme$}>{content}</KibanaThemeProvider>
|
||||
</I18nContext>
|
||||
</Provider>,
|
||||
<KibanaRenderContextProvider
|
||||
analytics={getAnalytics()}
|
||||
i18n={getCoreI18n()}
|
||||
theme={getTheme()}
|
||||
>
|
||||
<Provider store={this._savedMap.getStore()}>{content}</Provider>
|
||||
</KibanaRenderContextProvider>,
|
||||
this._domNode
|
||||
);
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ export const getUiActions = () => pluginsStart.uiActions;
|
|||
export const getCore = () => coreStart;
|
||||
export const getNavigation = () => pluginsStart.navigation;
|
||||
export const getCoreI18n = () => coreStart.i18n;
|
||||
export const getAnalytics = () => coreStart.analytics;
|
||||
export const getSearchService = () => pluginsStart.data.search;
|
||||
export const getEmbeddableService = () => pluginsStart.embeddable;
|
||||
export const getNavigateToApp = () => coreStart.application.navigateToApp;
|
||||
|
|
|
@ -12,13 +12,15 @@ import { Router, Routes, Route } from '@kbn/shared-ux-router';
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import type { CoreStart, AppMountParameters } from '@kbn/core/public';
|
||||
import { ExitFullScreenButtonKibanaProvider } from '@kbn/shared-ux-button-exit-full-screen';
|
||||
import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import { KibanaRenderContextProvider } from '@kbn/react-kibana-context-render';
|
||||
import { FormattedRelative } from '@kbn/i18n-react';
|
||||
import type { SavedObjectTaggingPluginStart } from '@kbn/saved-objects-tagging-plugin/public';
|
||||
import { TableListViewKibanaProvider } from '@kbn/content-management-table-list-view-table';
|
||||
import {
|
||||
getCoreChrome,
|
||||
getAnalytics,
|
||||
getCoreI18n,
|
||||
getTheme,
|
||||
getMapsCapabilities,
|
||||
getEmbeddableService,
|
||||
getDocLinks,
|
||||
|
@ -107,43 +109,40 @@ export async function renderApp(
|
|||
);
|
||||
}
|
||||
|
||||
const I18nContext = getCoreI18n().Context;
|
||||
render(
|
||||
<AppUsageTracker>
|
||||
<I18nContext>
|
||||
<KibanaThemeProvider theme$={theme$}>
|
||||
<TableListViewKibanaProvider
|
||||
{...{
|
||||
core: coreStart,
|
||||
savedObjectsTagging,
|
||||
FormattedRelative,
|
||||
}}
|
||||
>
|
||||
<Router history={history}>
|
||||
<Routes>
|
||||
<Route path={`/map/:savedMapId`} render={renderMapApp} />
|
||||
<Route exact path={`/map`} render={renderMapApp} />
|
||||
// Redirect other routes to list, or if hash-containing, their non-hash equivalents
|
||||
<Route
|
||||
path={``}
|
||||
render={({ location: { pathname, hash } }) => {
|
||||
if (hash) {
|
||||
// Remove leading hash
|
||||
const newPath = hash.substr(1);
|
||||
return <Redirect to={newPath} />;
|
||||
} else if (pathname === '/' || pathname === '') {
|
||||
return <ListPage history={history} stateTransfer={stateTransfer} />;
|
||||
} else {
|
||||
return <Redirect to="/" />;
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Routes>
|
||||
</Router>
|
||||
</TableListViewKibanaProvider>
|
||||
</KibanaThemeProvider>
|
||||
</I18nContext>
|
||||
</AppUsageTracker>,
|
||||
<KibanaRenderContextProvider analytics={getAnalytics()} i18n={getCoreI18n()} theme={getTheme()}>
|
||||
<AppUsageTracker>
|
||||
<TableListViewKibanaProvider
|
||||
{...{
|
||||
core: coreStart,
|
||||
savedObjectsTagging,
|
||||
FormattedRelative,
|
||||
}}
|
||||
>
|
||||
<Router history={history}>
|
||||
<Routes>
|
||||
<Route path={`/map/:savedMapId`} render={renderMapApp} />
|
||||
<Route exact path={`/map`} render={renderMapApp} />
|
||||
// Redirect other routes to list, or if hash-containing, their non-hash equivalents
|
||||
<Route
|
||||
path={``}
|
||||
render={({ location: { pathname, hash } }) => {
|
||||
if (hash) {
|
||||
// Remove leading hash
|
||||
const newPath = hash.substr(1);
|
||||
return <Redirect to={newPath} />;
|
||||
} else if (pathname === '/' || pathname === '') {
|
||||
return <ListPage history={history} stateTransfer={stateTransfer} />;
|
||||
} else {
|
||||
return <Redirect to="/" />;
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Routes>
|
||||
</Router>
|
||||
</TableListViewKibanaProvider>
|
||||
</AppUsageTracker>
|
||||
</KibanaRenderContextProvider>,
|
||||
element
|
||||
);
|
||||
|
||||
|
|
|
@ -88,7 +88,8 @@
|
|||
"@kbn/saved-objects-finder-plugin",
|
||||
"@kbn/esql-utils",
|
||||
"@kbn/apm-data-view",
|
||||
"@kbn/shared-ux-utility"
|
||||
"@kbn/shared-ux-utility",
|
||||
"@kbn/react-kibana-context-render"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue