Skip to content

Commit

Permalink
[grid] Upgrading to react-router-dom v6
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed Apr 14, 2022
1 parent b4c8d63 commit f3094e7
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 351 deletions.
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/grid/web/GridUiRoute.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public GridUiRoute() {
ResourceHandler uiHandler = new ResourceHandler(new ClassPathResource(uiRoot, GRID_RESOURCE));
HttpResponse uiRedirect = new HttpResponse()
.setStatus(HTTP_MOVED_TEMP)
.addHeader("Location", "/ui/index.html");
.addHeader("Location", "/ui");
routes = Route.combine(
get("/").to(() -> req -> uiRedirect),
get("/grid/console").to(() -> req -> uiRedirect),
Expand Down
187 changes: 30 additions & 157 deletions javascript/grid-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion javascript/grid-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-modal": "^3.14.3",
"react-router-dom": "^5.3.0",
"react-router-dom": "^6.3.0",
"source-map-explorer": "^2.5.2"
},
"scripts": {
Expand Down
24 changes: 8 additions & 16 deletions javascript/grid-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
InMemoryCache,
NormalizedCacheObject
} from '@apollo/client'
import { Route, Switch } from 'react-router-dom'
import { Route, Routes } from 'react-router-dom'
import React, { ReactNode } from 'react'
import ReactModal from 'react-modal'
import { GridConfig } from './config'
Expand Down Expand Up @@ -154,22 +154,14 @@ class App extends React.Component<AppProps, AppState> {
)}
<main className={classes.content}>
<Container maxWidth={false} className={classes.container}>
<Switch>
<Route exact path="/sessions">
<Sessions {...this.props}/>
</Route>
<Route exact path="/help">
<Help {...this.props}/>
</Route>
<Route exact path="/">
<Overview {...this.props}/>
</Route>
<Route>
<Help {...this.props}/>
</Route>
</Switch>
<Routes>
<Route path="/sessions" element={<Sessions {...this.props}/>}/>
<Route path="/help" element={<Help {...this.props}/>}/>
<Route path="/" element={<Overview {...this.props}/>}/>
<Route path="*" element={<Help {...this.props}/>}/>
</Routes>
</Container>
<Footer />
<Footer/>
</main>
</div>
</ApolloProvider>
Expand Down
Loading

0 comments on commit f3094e7

Please sign in to comment.