2019-10-31 22:23:17 +01:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-02-04 03:12:39 +01:00
|
|
|
* 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.
|
2019-10-31 22:23:17 +01:00
|
|
|
*/
|
2020-11-02 21:01:27 +01:00
|
|
|
|
2019-10-31 22:23:17 +01:00
|
|
|
import React from 'react';
|
2020-11-02 21:01:27 +01:00
|
|
|
import { render, unmountComponentAtNode } from 'react-dom';
|
|
|
|
import { HttpStart as Http, ToastsSetup } from 'kibana/public';
|
|
|
|
|
|
|
|
import { LicenseStatus } from '../../common';
|
|
|
|
import { App } from './app';
|
2019-10-31 22:23:17 +01:00
|
|
|
import { AppContextProvider } from './contexts/app_context';
|
|
|
|
import { ProfileContextProvider } from './contexts/profiler_context';
|
|
|
|
|
2020-11-02 21:01:27 +01:00
|
|
|
interface AppDependencies {
|
|
|
|
el: HTMLElement;
|
|
|
|
http: Http;
|
|
|
|
I18nContext: any;
|
|
|
|
notifications: ToastsSetup;
|
|
|
|
initialLicenseStatus: LicenseStatus;
|
|
|
|
}
|
2019-10-31 22:23:17 +01:00
|
|
|
|
2020-11-02 21:01:27 +01:00
|
|
|
export const renderApp = ({
|
|
|
|
el,
|
|
|
|
http,
|
|
|
|
I18nContext,
|
|
|
|
notifications,
|
|
|
|
initialLicenseStatus,
|
|
|
|
}: AppDependencies) => {
|
|
|
|
render(
|
2019-10-31 22:23:17 +01:00
|
|
|
<I18nContext>
|
2020-01-22 13:58:18 +01:00
|
|
|
<AppContextProvider args={{ initialLicenseStatus, notifications, http }}>
|
2019-10-31 22:23:17 +01:00
|
|
|
<ProfileContextProvider>
|
2020-11-02 21:01:27 +01:00
|
|
|
<App />
|
2019-10-31 22:23:17 +01:00
|
|
|
</ProfileContextProvider>
|
|
|
|
</AppContextProvider>
|
2020-11-02 21:01:27 +01:00
|
|
|
</I18nContext>,
|
|
|
|
el
|
2019-10-31 22:23:17 +01:00
|
|
|
);
|
2020-11-02 21:01:27 +01:00
|
|
|
|
|
|
|
return () => unmountComponentAtNode(el);
|
|
|
|
};
|