go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/web/rpcexplorer/src/app.tsx (about) 1 // Copyright 2022 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 import { 16 Route, 17 Routes, 18 Navigate, 19 } from 'react-router-dom'; 20 21 import Alert from '@mui/material/Alert'; 22 23 import { GlobalsProvider } from './context/globals'; 24 25 import Layout from './layout'; 26 import ServicesList from './views/services_list'; 27 import MethodsList from './views/methods_list'; 28 import Method from './views/method'; 29 30 31 const App = () => { 32 return ( 33 <GlobalsProvider> 34 <Routes> 35 <Route path='/' element={<Layout />}> 36 <Route index element={<Navigate replace to='/services/' />} /> 37 <Route path='services'> 38 <Route index element={<ServicesList />} /> 39 <Route path=':serviceName'> 40 <Route index element={<MethodsList />} /> 41 <Route path=':methodName' element={<Method />} /> 42 </Route> 43 </Route> 44 <Route path='*' element={ 45 <Alert severity='error'>Unrecognized URL format.</Alert> 46 } /> 47 </Route> 48 </Routes> 49 </GlobalsProvider> 50 ); 51 }; 52 53 54 export default App;