github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/webapp/javascript/index.tsx (about) 1 import './globals'; 2 3 import ReactDOM from 'react-dom'; 4 import React from 'react'; 5 import { Provider } from 'react-redux'; 6 import { Router, Switch, Route } from 'react-router-dom'; 7 import { isAdhocUIEnabled, isAuthRequired } from '@webapp/util/features'; 8 import Notifications from '@webapp/ui/Notifications'; 9 import { PersistGate } from 'redux-persist/integration/react'; 10 import Footer from '@webapp/components/Footer'; 11 import PageTitle from '@webapp/components/PageTitle'; 12 import store, { persistor } from './redux/store'; 13 14 import ContinuousSingleView from './pages/ContinuousSingleView'; 15 import ContinuousComparisonView from './pages/ContinuousComparisonView'; 16 import ContinuousDiffView from './pages/ContinuousDiffView'; 17 import TagExplorerView from './pages/TagExplorerView'; 18 import Continuous from './components/Continuous'; 19 import Settings from './components/Settings'; 20 import Sidebar from './components/Sidebar'; 21 import AdhocSingle from './pages/adhoc/AdhocSingle'; 22 import AdhocComparison from './pages/adhoc/AdhocComparison'; 23 import AdhocDiff from './pages/adhoc/AdhocDiff'; 24 import ServiceDiscoveryApp from './pages/ServiceDiscovery'; 25 import ServerNotifications from './components/ServerNotifications'; 26 import Protected from './components/Protected'; 27 import SignInPage from './pages/IntroPages/SignIn'; 28 import SignUpPage from './pages/IntroPages/SignUp'; 29 import Forbidden from './pages/IntroPages/Forbidden'; 30 import NotFound from './pages/IntroPages/NotFound'; 31 import { PAGES } from './pages/constants'; 32 import history from './util/history'; 33 import TracingSingleView from './pages/TracingSingleView'; 34 import ExemplarsSingleView from './pages/exemplars/ExemplarsSingleView'; 35 36 function App() { 37 return ( 38 <div className="app"> 39 <Sidebar /> 40 <div className="pyroscope-app"> 41 <Switch> 42 <Route exact path={PAGES.LOGIN}> 43 <SignInPage /> 44 </Route> 45 <Route exact path={PAGES.SIGNUP}> 46 <SignUpPage /> 47 </Route> 48 <Route exact path={PAGES.CONTINOUS_SINGLE_VIEW}> 49 <Protected> 50 <Continuous> 51 <ContinuousSingleView /> 52 </Continuous> 53 </Protected> 54 </Route> 55 <Route path={PAGES.COMPARISON_VIEW}> 56 <Protected> 57 <Continuous> 58 <ContinuousComparisonView /> 59 </Continuous> 60 </Protected> 61 </Route> 62 <Route path={PAGES.COMPARISON_DIFF_VIEW}> 63 <Protected> 64 <Continuous> 65 <ContinuousDiffView /> 66 </Continuous> 67 </Protected> 68 </Route> 69 <Route path={PAGES.TRACING_EXEMPLARS_MERGE}> 70 <Protected> 71 <Continuous> 72 <TracingSingleView /> 73 </Continuous> 74 </Protected> 75 </Route> 76 <Route path={PAGES.TRACING_EXEMPLARS_SINGLE}> 77 <Protected> 78 <Continuous> 79 <ExemplarsSingleView /> 80 </Continuous> 81 </Protected> 82 </Route> 83 {isAuthRequired && ( 84 <Route path={PAGES.SETTINGS}> 85 <Protected> 86 <Continuous> 87 <Settings /> 88 </Continuous> 89 </Protected> 90 </Route> 91 )} 92 <Route path={PAGES.SERVICE_DISCOVERY}> 93 <Protected> 94 <PageTitle title="Pull Targets" /> 95 <ServiceDiscoveryApp /> 96 </Protected> 97 </Route> 98 <Route exact path={PAGES.TAG_EXPLORER}> 99 <Protected> 100 <Continuous> 101 <TagExplorerView /> 102 </Continuous> 103 </Protected> 104 </Route> 105 {isAdhocUIEnabled && ( 106 <Route path={PAGES.ADHOC_SINGLE}> 107 <Protected> 108 <PageTitle title="Adhoc Single" /> 109 <AdhocSingle /> 110 </Protected> 111 </Route> 112 )} 113 {isAdhocUIEnabled && ( 114 <Route path={PAGES.ADHOC_COMPARISON}> 115 <Protected> 116 <PageTitle title="Adhoc Comparison" /> 117 <AdhocComparison /> 118 </Protected> 119 </Route> 120 )} 121 {isAdhocUIEnabled && ( 122 <Route path={PAGES.ADHOC_COMPARISON_DIFF}> 123 <Protected> 124 <PageTitle title="Adhoc Diff" /> 125 <AdhocDiff /> 126 </Protected> 127 </Route> 128 )} 129 <Route path={PAGES.FORBIDDEN}> 130 <> 131 <PageTitle title="Forbidden" /> 132 <Forbidden /> 133 </> 134 </Route> 135 136 <Route path="*" exact> 137 <> 138 <PageTitle title="Not Found" /> 139 <NotFound /> 140 </> 141 </Route> 142 </Switch> 143 <Footer /> 144 </div> 145 </div> 146 ); 147 } 148 149 ReactDOM.render( 150 <Provider store={store}> 151 <PersistGate persistor={persistor} loading={null}> 152 <Router history={history}> 153 <ServerNotifications /> 154 <Notifications /> 155 <App /> 156 </Router> 157 </PersistGate> 158 </Provider>, 159 document.getElementById('root') 160 );