From aedc6a30402ba3d8dbbfe450b2f6b5bd6be09cab Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 6 Oct 2020 09:42:10 -0600 Subject: [PATCH] [Maps] fix use correct mount-context --- .../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 9bced75b613d7..9fbe090633747 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 5b79863d0dd97..a2b629bdd4989 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 a28c293a2f32f..d7e6e6e079953 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,