vitess.io/vitess@v0.16.2/web/vtadmin/src/components/App.tsx (about) 1 /** 2 * Copyright 2021 The Vitess Authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 import * as React from 'react'; 17 import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom'; 18 19 import style from './App.module.scss'; 20 import { Tablets } from './routes/Tablets'; 21 import { Settings } from './routes/Settings'; 22 import { NavRail } from './NavRail'; 23 import { Error404 } from './routes/Error404'; 24 import { Clusters } from './routes/Clusters'; 25 import { Gates } from './routes/Gates'; 26 import { Keyspaces } from './routes/Keyspaces'; 27 import { Schemas } from './routes/Schemas'; 28 import { Schema } from './routes/schema/Schema'; 29 import { Stream } from './routes/stream/Stream'; 30 import { Workflows } from './routes/Workflows'; 31 import { Workflow } from './routes/workflow/Workflow'; 32 import { VTExplain } from './routes/VTExplain'; 33 import { Keyspace } from './routes/keyspace/Keyspace'; 34 import { Tablet } from './routes/tablet/Tablet'; 35 import { Backups } from './routes/Backups'; 36 import { Shard } from './routes/shard/Shard'; 37 import { Vtctlds } from './routes/Vtctlds'; 38 import { SnackbarContainer } from './Snackbar'; 39 import { isReadOnlyMode } from '../util/env'; 40 import { CreateKeyspace } from './routes/createKeyspace/CreateKeyspace'; 41 import { Topology } from './routes/topology/Topology'; 42 import { ClusterTopology } from './routes/topology/ClusterTopology'; 43 44 export const App = () => { 45 return ( 46 <Router> 47 <div className={style.container}> 48 <div className={style.navContainer}> 49 <NavRail /> 50 </div> 51 <SnackbarContainer /> 52 <div className={style.mainContainer}> 53 <Switch> 54 <Route path="/backups"> 55 <Backups /> 56 </Route> 57 58 <Route path="/clusters"> 59 <Clusters /> 60 </Route> 61 62 <Route path="/gates"> 63 <Gates /> 64 </Route> 65 66 <Route exact path="/keyspaces"> 67 <Keyspaces /> 68 </Route> 69 70 {!isReadOnlyMode() && ( 71 <Route exact path="/keyspaces/create"> 72 <CreateKeyspace /> 73 </Route> 74 )} 75 76 <Route path="/keyspace/:clusterID/:keyspace/shard/:shard"> 77 <Shard /> 78 </Route> 79 80 <Route path="/keyspace/:clusterID/:name"> 81 <Keyspace /> 82 </Route> 83 84 <Route path="/schemas"> 85 <Schemas /> 86 </Route> 87 88 <Route path="/schema/:clusterID/:keyspace/:table"> 89 <Schema /> 90 </Route> 91 92 <Route path="/tablets"> 93 <Tablets /> 94 </Route> 95 96 <Route path="/tablet/:clusterID/:alias"> 97 <Tablet /> 98 </Route> 99 100 <Route path="/vtctlds"> 101 <Vtctlds /> 102 </Route> 103 104 <Route path="/vtexplain"> 105 <VTExplain /> 106 </Route> 107 108 <Route path="/workflows"> 109 <Workflows /> 110 </Route> 111 112 <Route path="/workflow/:clusterID/:keyspace/:workflowName/stream/:tabletCell/:tabletUID/:streamID"> 113 <Stream /> 114 </Route> 115 116 <Route path="/workflow/:clusterID/:keyspace/:name"> 117 <Workflow /> 118 </Route> 119 120 <Route path="/topology/:clusterID"> 121 <ClusterTopology /> 122 </Route> 123 124 <Route path="/topology"> 125 <Topology /> 126 </Route> 127 128 <Route path="/settings"> 129 <Settings /> 130 </Route> 131 132 <Redirect exact from="/" to="/schemas" /> 133 134 <Route> 135 <Error404 /> 136 </Route> 137 </Switch> 138 </div> 139 </div> 140 </Router> 141 ); 142 };