Skip to content

Commit 163bbff

Browse files
committed
PR comment cleanup
1 parent 6ed5fe4 commit 163bbff

File tree

3 files changed

+29
-46
lines changed

3 files changed

+29
-46
lines changed

site/src/api/api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,6 @@ export const getWorkspaceProxies =
901901
async (): Promise<TypesGen.RegionsResponse> => {
902902
const response = await axios.get<TypesGen.RegionsResponse>(
903903
`/api/v2/regions`,
904-
{},
905904
)
906905
return response.data
907906
}

site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyPage.tsx

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,51 @@ import { FC, PropsWithChildren } from "react"
22
import { Section } from "components/SettingsLayout/Section"
33
import { WorkspaceProxyView } from "./WorkspaceProxyView"
44
import makeStyles from "@material-ui/core/styles/makeStyles"
5-
import { Trans } from "react-i18next"
65
import { useWorkspaceProxiesData } from "./hooks"
76
import { displayError } from "components/GlobalSnackbar/utils"
87
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"
158

169
export const WorkspaceProxyPage: FC<PropsWithChildren<unknown>> = () => {
1710
const styles = useStyles()
1811

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."
2616

2717
const { proxy, setProxy } = useProxy()
2818

2919
const {
30-
data: response,
20+
data: proxiesResposne,
3121
error: getProxiesError,
3222
isFetching,
3323
isFetched,
3424
} = useWorkspaceProxiesData()
3525

3626
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+
}
5544

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>
6250
)
6351
}
6452

site/src/pages/UserSettingsPage/WorkspaceProxyPage/hooks.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ import { getWorkspaceProxies } from "api/api"
44
// Loads all workspace proxies
55
export const useWorkspaceProxiesData = () => {
66
const queryKey = ["workspace-proxies"]
7-
const result = useQuery({
7+
return useQuery({
88
queryKey,
9-
queryFn: () => getWorkspaceProxies(),
9+
queryFn: getWorkspaceProxies,
1010
})
11-
12-
return {
13-
...result,
14-
}
1511
}

0 commit comments

Comments
 (0)