4584a8b570
* Updating everything except the license headers themselves * Applying ESLint rules * Manually replacing the stragglers
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
/*
|
|
* 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 { render, unmountComponentAtNode } from 'react-dom';
|
|
import { HttpStart as Http, ToastsSetup } from 'kibana/public';
|
|
|
|
import { LicenseStatus } from '../../common';
|
|
import { App } from './app';
|
|
import { AppContextProvider } from './contexts/app_context';
|
|
import { ProfileContextProvider } from './contexts/profiler_context';
|
|
|
|
interface AppDependencies {
|
|
el: HTMLElement;
|
|
http: Http;
|
|
I18nContext: any;
|
|
notifications: ToastsSetup;
|
|
initialLicenseStatus: LicenseStatus;
|
|
}
|
|
|
|
export const renderApp = ({
|
|
el,
|
|
http,
|
|
I18nContext,
|
|
notifications,
|
|
initialLicenseStatus,
|
|
}: AppDependencies) => {
|
|
render(
|
|
<I18nContext>
|
|
<AppContextProvider args={{ initialLicenseStatus, notifications, http }}>
|
|
<ProfileContextProvider>
|
|
<App />
|
|
</ProfileContextProvider>
|
|
</AppContextProvider>
|
|
</I18nContext>,
|
|
el
|
|
);
|
|
|
|
return () => unmountComponentAtNode(el);
|
|
};
|