From 2a7934a18cd4fec724442ad2fe5c6cea7b916ec8 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 6 Oct 2020 17:43:36 -0600 Subject: [PATCH] [Maps] fix use correct mount-context (#79688) (#79778) Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../plugins/maps/public/lazy_load_bundle/index.ts | 4 ++-- x-pack/plugins/maps/public/plugin.ts | 5 +++-- x-pack/plugins/maps/public/routing/maps_router.tsx | 13 ++++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/maps/public/lazy_load_bundle/index.ts b/x-pack/plugins/maps/public/lazy_load_bundle/index.ts index 9bced75b613d..9fbe09063374 100644 --- a/x-pack/plugins/maps/public/lazy_load_bundle/index.ts +++ b/x-pack/plugins/maps/public/lazy_load_bundle/index.ts @@ -7,7 +7,7 @@ import { AnyAction } from 'redux'; // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { IndexPatternsContract } from 'src/plugins/data/public/index_patterns'; -import { AppMountContext, AppMountParameters } from 'kibana/public'; +import { AppMountParameters } from 'kibana/public'; import { IndexPattern } from 'src/plugins/data/public'; import { Embeddable, IContainer } from '../../../../../src/plugins/embeddable/public'; import { LayerDescriptor } from '../../common/descriptor_types'; @@ -40,7 +40,7 @@ interface LazyLoadedMapModules { initialLayers?: LayerDescriptor[] ) => LayerDescriptor[]; mergeInputWithSavedMap: any; - renderApp: (context: AppMountContext, params: AppMountParameters) => Promise<() => void>; + renderApp: (params: AppMountParameters) => Promise<() => void>; createSecurityLayerDescriptors: ( indexPatternId: string, indexPatternTitle: string diff --git a/x-pack/plugins/maps/public/plugin.ts b/x-pack/plugins/maps/public/plugin.ts index 5b79863d0dd9..a2b629bdd498 100644 --- a/x-pack/plugins/maps/public/plugin.ts +++ b/x-pack/plugins/maps/public/plugin.ts @@ -9,6 +9,7 @@ import { UiActionsStart } from 'src/plugins/ui_actions/public'; import { NavigationPublicPluginStart } from 'src/plugins/navigation/public'; import { Start as InspectorStartContract } from 'src/plugins/inspector/public'; import { + AppMountParameters, CoreSetup, CoreStart, Plugin, @@ -131,9 +132,9 @@ export class MapsPlugin icon: `plugins/${APP_ID}/icon.svg`, euiIconType: APP_ICON_SOLUTION, category: DEFAULT_APP_CATEGORIES.kibana, - async mount(context, params) { + async mount(params: AppMountParameters) { const { renderApp } = await lazyLoadMapModules(); - return renderApp(context, params); + return renderApp(params); }, }); } diff --git a/x-pack/plugins/maps/public/routing/maps_router.tsx b/x-pack/plugins/maps/public/routing/maps_router.tsx index a28c293a2f32..d7e6e6e07995 100644 --- a/x-pack/plugins/maps/public/routing/maps_router.tsx +++ b/x-pack/plugins/maps/public/routing/maps_router.tsx @@ -9,7 +9,7 @@ import { render, unmountComponentAtNode } from 'react-dom'; import { Router, Switch, Route, Redirect, RouteComponentProps } from 'react-router-dom'; import { i18n } from '@kbn/i18n'; import { Provider } from 'react-redux'; -import { AppMountContext, AppMountParameters } from 'kibana/public'; +import { AppMountParameters } from 'kibana/public'; import { getCoreChrome, getCoreI18n, @@ -29,10 +29,13 @@ import { LoadMapAndRender } from './routes/maps_app/load_map_and_render'; export let goToSpecifiedPath: (path: string) => void; export let kbnUrlStateStorage: IKbnUrlStateStorage; -export async function renderApp( - context: AppMountContext, - { appBasePath, element, history, onAppLeave, setHeaderActionMenu }: AppMountParameters -) { +export async function renderApp({ + appBasePath, + element, + history, + onAppLeave, + setHeaderActionMenu, +}: AppMountParameters) { goToSpecifiedPath = (path) => history.push(path); kbnUrlStateStorage = createKbnUrlStateStorage({ useHash: false,