diff --git a/x-pack/examples/alerting_example/kibana.json b/x-pack/examples/alerting_example/kibana.json index 0b2c2bdb3f6a7..0ddb3d2412f6d 100644 --- a/x-pack/examples/alerting_example/kibana.json +++ b/x-pack/examples/alerting_example/kibana.json @@ -4,6 +4,7 @@ "kibanaVersion": "kibana", "server": true, "ui": true, - "requiredPlugins": ["triggersActionsUi", "charts", "data", "alerts", "actions", "features", "developerExamples"], - "optionalPlugins": [] + "requiredPlugins": ["triggersActionsUi", "charts", "data", "alerts", "actions", "kibanaReact", "features", "developerExamples"], + "optionalPlugins": [], + "requiredBundles": ["kibanaReact"] } diff --git a/x-pack/examples/alerting_example/public/application.tsx b/x-pack/examples/alerting_example/public/application.tsx index e229c1c1e6dad..4bc46081ec6a7 100644 --- a/x-pack/examples/alerting_example/public/application.tsx +++ b/x-pack/examples/alerting_example/public/application.tsx @@ -8,16 +8,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter as Router, Route, RouteComponentProps } from 'react-router-dom'; import { EuiPage } from '@elastic/eui'; -import { - AppMountParameters, - CoreStart, - IUiSettingsClient, - DocLinksStart, - ToastsSetup, - ApplicationStart, -} from '../../../../src/core/public'; -import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; -import { ChartsPluginStart } from '../../../../src/plugins/charts/public'; +import { AppMountParameters, CoreStart } from '../../../../src/core/public'; import { Page } from './components/page'; import { DocumentationPage } from './components/documentation'; @@ -25,22 +16,19 @@ import { ViewAlertPage } from './components/view_alert'; import { TriggersAndActionsUIPublicPluginStart } from '../../../plugins/triggers_actions_ui/public'; import { AlertingExamplePublicStartDeps } from './plugin'; import { ViewPeopleInSpaceAlertPage } from './components/view_astros_alert'; +import { KibanaContextProvider } from '../../../../src/plugins/kibana_react/public'; export interface AlertingExampleComponentParams { - application: CoreStart['application']; http: CoreStart['http']; basename: string; triggersActionsUi: TriggersAndActionsUIPublicPluginStart; - data: DataPublicPluginStart; - charts: ChartsPluginStart; - uiSettings: IUiSettingsClient; - docLinks: DocLinksStart; - toastNotifications: ToastsSetup; - capabilities: ApplicationStart['capabilities']; } -const AlertingExampleApp = (deps: AlertingExampleComponentParams) => { - const { basename, http } = deps; +const AlertingExampleApp = ({ + basename, + http, + triggersActionsUi, +}: AlertingExampleComponentParams) => { return ( @@ -49,7 +37,7 @@ const AlertingExampleApp = (deps: AlertingExampleComponentParams) => { exact={true} render={() => ( - + )} /> @@ -79,21 +67,19 @@ const AlertingExampleApp = (deps: AlertingExampleComponentParams) => { }; export const renderApp = ( - { application, notifications, http, uiSettings, docLinks }: CoreStart, + core: CoreStart, deps: AlertingExamplePublicStartDeps, { appBasePath, element }: AppMountParameters ) => { + const { http } = core; ReactDOM.render( - , + + + , element ); diff --git a/x-pack/examples/alerting_example/public/components/create_alert.tsx b/x-pack/examples/alerting_example/public/components/create_alert.tsx index ade2cdbbbd4a9..db7667411a27e 100644 --- a/x-pack/examples/alerting_example/public/components/create_alert.tsx +++ b/x-pack/examples/alerting_example/public/components/create_alert.tsx @@ -11,7 +11,9 @@ import { EuiIcon, EuiFlexItem, EuiCard, EuiFlexGroup } from '@elastic/eui'; import { AlertingExampleComponentParams } from '../application'; import { ALERTING_EXAMPLE_APP_ID } from '../../common/constants'; -export const CreateAlert = ({ triggersActionsUi }: AlertingExampleComponentParams) => { +export const CreateAlert = ({ + triggersActionsUi, +}: Pick) => { const [alertFlyoutVisible, setAlertFlyoutVisibility] = useState(false); const onCloseAlertFlyout = useCallback(() => setAlertFlyoutVisibility(false), [ diff --git a/x-pack/examples/alerting_example/public/components/documentation.tsx b/x-pack/examples/alerting_example/public/components/documentation.tsx index 73896fdb8fc92..ca6e28fbc5ad8 100644 --- a/x-pack/examples/alerting_example/public/components/documentation.tsx +++ b/x-pack/examples/alerting_example/public/components/documentation.tsx @@ -21,7 +21,9 @@ import { import { CreateAlert } from './create_alert'; import { AlertingExampleComponentParams } from '../application'; -export const DocumentationPage = (deps: AlertingExampleComponentParams) => ( +export const DocumentationPage = ( + deps: Pick +) => (