/* * 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 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter as Router, Route, RouteComponentProps, withRouter } from 'react-router-dom'; import { EuiPage, EuiPageContent, EuiPageContentBody, EuiPageSideBar, EuiSideNav, } from '@elastic/eui'; import 'brace/mode/json'; import { AppMountParameters, IUiSettingsClient } from '../../../src/core/public'; import { DashboardEmbeddableByValue } from './by_value/embeddable'; import { DashboardStart } from '../../../src/plugins/dashboard/public'; import { KibanaContextProvider } from '../../../src/plugins/kibana_react/public'; interface PageDef { title: string; id: string; component: React.ReactNode; } type NavProps = RouteComponentProps & { pages: PageDef[]; }; const Nav = withRouter(({ history, pages }: NavProps) => { const navItems = pages.map((page) => ({ id: page.id, name: page.title, onClick: () => history.push(`/${page.id}`), 'data-test-subj': page.id, })); return ( ); }); interface Props { basename: string; DashboardContainerByValueRenderer: ReturnType< DashboardStart['getDashboardContainerByValueRenderer'] >; uiSettings: IUiSettingsClient; } const DashboardEmbeddableExplorerApp = ({ basename, DashboardContainerByValueRenderer, uiSettings, }: Props) => { const pages: PageDef[] = [ { title: 'By value dashboard embeddable', id: 'dashboardEmbeddableByValue', component: ( ), }, { title: 'By ref dashboard embeddable', id: 'dashboardEmbeddableByRef', component:
TODO: Not implemented, but coming soon...
, }, ]; const routes = pages.map((page, i) => ( page.component} /> )); return (