import ReactDOM , { unmountComponentAtNode } from 'react-dom' ; import React from 'react' ; import type { CoreSetup , CoreStart } from 'kibana/public' ; import type { DataPublicPluginStart } from 'src/plugins/data/public' ; import type { UsageCollectionSetup } from 'src/plugins/usage_collection/public' ; import type { ManagementAppMountParams } from '../../../../../../../src/plugins/management/public/' ; import type { MlStartDependencies } from '../../../plugin' ; import { JobsListPage } from './components' ; import { getJobsListBreadcrumbs } from '../breadcrumbs' ; import { setDependencyCache , clearCache } from '../../util/dependency_cache' ; import './_index.scss' ; import type { SharePluginStart } from '../../../../../../../src/plugins/share/public' ; import type { SpacesPluginStart } from '../../../../../spaces/public' ; const renderApp = ( element , history , coreStart , share , data , spacesApi ? , usageCollection ? ) => { ReactDOM . render ( React . createElement ( JobsListPage , { coreStart , history , share , data , spacesApi , usageCollection , } ) , element ) ; return ( ) => { unmountComponentAtNode ( element ) ; clearCache ( ) ; } ; } ; export async function mountApp ( core , params , deps ) { const [ coreStart , pluginsStart ] = await core . getStartServices ( ) ; setDependencyCache ( { docLinks : coreStart . docLinks ! , basePath : coreStart . http . basePath , http : coreStart . http , i18n : coreStart . i18n , } ) ; params . setBreadcrumbs ( getJobsListBreadcrumbs ( ) ) ; return renderApp ( params . element , params . history , coreStart , pluginsStart . share , pluginsStart . data , pluginsStart . spaces , deps . usageCollection ) ; }