@@ -2,63 +2,51 @@ import { FC, PropsWithChildren } from "react"
2
2
import { Section } from "components/SettingsLayout/Section"
3
3
import { WorkspaceProxyView } from "./WorkspaceProxyView"
4
4
import makeStyles from "@material-ui/core/styles/makeStyles"
5
- import { Trans } from "react-i18next"
6
5
import { useWorkspaceProxiesData } from "./hooks"
7
6
import { displayError } from "components/GlobalSnackbar/utils"
8
7
import { useProxy } from "contexts/ProxyContext"
9
- // import { ConfirmDeleteDialog } from "./components"
10
- // import { Stack } from "components/Stack/Stack"
11
- // import Button from "@material-ui/core/Button"
12
- // import { Link as RouterLink } from "react-router-dom"
13
- // import AddIcon from "@material-ui/icons/AddOutlined"
14
- // import { APIKeyWithOwner } from "api/typesGenerated"
15
8
16
9
export const WorkspaceProxyPage : FC < PropsWithChildren < unknown > > = ( ) => {
17
10
const styles = useStyles ( )
18
11
19
- const description = (
20
- < Trans values = { { } } >
21
- Workspace proxies are used to reduce the latency of connections to a
22
- workspace. To get the best experience, choose the workspace proxy that is
23
- closest located to you.
24
- </ Trans >
25
- )
12
+ const description =
13
+ "Workspace proxies are used to reduce the latency of connections to a" +
14
+ "workspace. To get the best experience, choose the workspace proxy that is" +
15
+ "closest located to you."
26
16
27
17
const { proxy, setProxy } = useProxy ( )
28
18
29
19
const {
30
- data : response ,
20
+ data : proxiesResposne ,
31
21
error : getProxiesError ,
32
22
isFetching,
33
23
isFetched,
34
24
} = useWorkspaceProxiesData ( )
35
25
36
26
return (
37
- < >
38
- < Section
39
- title = "Workspace Proxies"
40
- className = { styles . section }
41
- description = { description }
42
- layout = "fluid"
43
- >
44
- < WorkspaceProxyView
45
- proxies = { response ? response . regions : [ ] }
46
- isLoading = { isFetching }
47
- hasLoaded = { isFetched }
48
- getWorkspaceProxiesError = { getProxiesError }
49
- preferredProxy = { proxy . selectedRegion }
50
- onSelect = { ( proxy ) => {
51
- if ( ! proxy . healthy ) {
52
- displayError ( "Please select a healthy workspace proxy." )
53
- return
54
- }
27
+ < Section
28
+ title = "Workspace Proxies"
29
+ className = { styles . section }
30
+ description = { description }
31
+ layout = "fluid"
32
+ >
33
+ < WorkspaceProxyView
34
+ proxies = { proxiesResposne ?. regions }
35
+ isLoading = { isFetching }
36
+ hasLoaded = { isFetched }
37
+ getWorkspaceProxiesError = { getProxiesError }
38
+ preferredProxy = { proxy . selectedRegion }
39
+ onSelect = { ( proxy ) => {
40
+ if ( ! proxy . healthy ) {
41
+ displayError ( "Please select a healthy workspace proxy." )
42
+ return
43
+ }
55
44
56
- // Set the fetched regions + the selected proxy
57
- setProxy ( response ? response . regions : [ ] , proxy )
58
- } }
59
- />
60
- </ Section >
61
- </ >
45
+ // Set the fetched regions + the selected proxy
46
+ setProxy ( proxiesResposne ? proxiesResposne . regions : [ ] , proxy )
47
+ } }
48
+ />
49
+ </ Section >
62
50
)
63
51
}
64
52
0 commit comments