Skip to content

Commit 7a2e78e

Browse files
committed
Make fmt
1 parent f78935f commit 7a2e78e

File tree

14 files changed

+132
-120
lines changed

14 files changed

+132
-120
lines changed

site/src/AppRouter.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ const TokensPage = lazy(
3939
() => import("./pages/UserSettingsPage/TokensPage/TokensPage"),
4040
)
4141
const WorkspaceProxyPage = lazy(
42-
() => import("./pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyPage"),
42+
() =>
43+
import("./pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyPage"),
4344
)
4445
const CreateUserPage = lazy(
4546
() => import("./pages/UsersPage/CreateUserPage/CreateUserPage"),
@@ -262,7 +263,10 @@ export const AppRouter: FC = () => {
262263
<Route index element={<TokensPage />} />
263264
<Route path="new" element={<CreateTokenPage />} />
264265
</Route>
265-
<Route path="workspace-proxies" element={<WorkspaceProxyPage />} />
266+
<Route
267+
path="workspace-proxies"
268+
element={<WorkspaceProxyPage />}
269+
/>
266270
</Route>
267271

268272
<Route path="/@:username">

site/src/api/api.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -897,15 +897,14 @@ export const getFile = async (fileId: string): Promise<ArrayBuffer> => {
897897
return response.data
898898
}
899899

900-
901-
export const getWorkspaceProxies = async (): Promise<TypesGen.RegionsResponse> => {
902-
const response = await axios.get<TypesGen.RegionsResponse>(
903-
`/api/v2/regions`,
904-
{},
905-
)
906-
return response.data
907-
}
908-
900+
export const getWorkspaceProxies =
901+
async (): Promise<TypesGen.RegionsResponse> => {
902+
const response = await axios.get<TypesGen.RegionsResponse>(
903+
`/api/v2/regions`,
904+
{},
905+
)
906+
return response.data
907+
}
909908

910909
export const getAppearance = async (): Promise<TypesGen.AppearanceConfig> => {
911910
try {

site/src/components/AppLink/AppLink.tsx

+13-11
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ export const AppLink: FC<AppLinkProps> = ({
4949

5050
// The backend redirects if the trailing slash isn't included, so we add it
5151
// here to avoid extra roundtrips.
52-
let href = `${preferredPathBase}/@${username}/${workspace.name}.${agent.name
53-
}/apps/${encodeURIComponent(appSlug)}/`
52+
let href = `${preferredPathBase}/@${username}/${workspace.name}.${
53+
agent.name
54+
}/apps/${encodeURIComponent(appSlug)}/`
5455
if (app.command) {
55-
href = `${preferredPathBase}/@${username}/${workspace.name}.${agent.name
56-
}/terminal?command=${encodeURIComponent(app.command)}`
56+
href = `${preferredPathBase}/@${username}/${workspace.name}.${
57+
agent.name
58+
}/terminal?command=${encodeURIComponent(app.command)}`
5759
}
5860

5961
// TODO: @emyrk handle proxy subdomains.
@@ -110,13 +112,13 @@ export const AppLink: FC<AppLinkProps> = ({
110112
onClick={
111113
canClick
112114
? (event) => {
113-
event.preventDefault()
114-
window.open(
115-
href,
116-
Language.appTitle(appDisplayName, generateRandomString(12)),
117-
"width=900,height=600",
118-
)
119-
}
115+
event.preventDefault()
116+
window.open(
117+
href,
118+
Language.appTitle(appDisplayName, generateRandomString(12)),
119+
"width=900,height=600",
120+
)
121+
}
120122
: undefined
121123
}
122124
>

site/src/components/PortForwardButton/PortForwardButton.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ export const portForwardURL = (
3535
): string => {
3636
const { location } = window
3737

38-
const subdomain = `${isNaN(port) ? 3000 : port
39-
}--${agentName}--${workspaceName}--${username}`
38+
const subdomain = `${
39+
isNaN(port) ? 3000 : port
40+
}--${agentName}--${workspaceName}--${username}`
4041
return `${location.protocol}//${host}`.replace("*", subdomain)
4142
}
4243

site/src/components/SettingsLayout/Sidebar.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { NavLink } from "react-router-dom"
99
import { combineClasses } from "utils/combineClasses"
1010
import AccountIcon from "@material-ui/icons/Person"
1111
import SecurityIcon from "@material-ui/icons/LockOutlined"
12-
import PublicIcon from '@material-ui/icons/Public';
12+
import PublicIcon from "@material-ui/icons/Public"
1313
import { useDashboard } from "components/Dashboard/DashboardProvider"
1414

1515
const SidebarNavItem: FC<
@@ -79,14 +79,14 @@ export const Sidebar: React.FC<{ user: User }> = ({ user }) => {
7979
>
8080
Tokens
8181
</SidebarNavItem>
82-
{
83-
dashboard.experiments.includes("moons") && <SidebarNavItem
82+
{dashboard.experiments.includes("moons") && (
83+
<SidebarNavItem
8484
href="workspace-proxies"
8585
icon={<SidebarNavItemIcon icon={PublicIcon} />}
8686
>
8787
Workspace Proxy
8888
</SidebarNavItem>
89-
}
89+
)}
9090
</nav>
9191
)
9292
}

site/src/components/TerminalLink/TerminalLink.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ export const TerminalLink: FC<React.PropsWithChildren<TerminalLinkProps>> = ({
3131
const preferredProxy = usePreferredProxy()
3232
const preferredPathBase = preferredProxy ? preferredProxy.path_app_url : ""
3333

34-
const href = `${preferredPathBase}/@${userName}/${workspaceName}${agentName ? `.${agentName}` : ""
35-
}/terminal`
34+
const href = `${preferredPathBase}/@${userName}/${workspaceName}${
35+
agentName ? `.${agentName}` : ""
36+
}/terminal`
3637

3738
return (
3839
<Link

site/src/hooks/usePreferredProxy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useDashboard } from "components/Dashboard/DashboardProvider"
44
export const usePreferredProxy = (): Region | undefined => {
55
const dashboard = useDashboard()
66
// Only use preferred proxy if the user has the moons experiment enabled
7-
if(!dashboard?.experiments.includes("moons")) {
7+
if (!dashboard?.experiments.includes("moons")) {
88
return undefined
99
}
1010

site/src/pages/TemplatesPage/TemplatesPageView.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ import { Avatar } from "components/Avatar/Avatar"
4545

4646
export const Language = {
4747
developerCount: (activeCount: number): string => {
48-
return `${formatTemplateActiveDevelopers(activeCount)} developer${activeCount !== 1 ? "s" : ""
49-
}`
48+
return `${formatTemplateActiveDevelopers(activeCount)} developer${
49+
activeCount !== 1 ? "s" : ""
50+
}`
5051
},
5152
nameLabel: "Name",
5253
buildTimeLabel: "Build time",

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

+5-6
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export const WorkspaceProxyPage: FC<PropsWithChildren<unknown>> = () => {
1818

1919
const description = (
2020
<Trans values={{}}>
21-
Workspace proxies are used to reduce the latency of connections to a workspace.
22-
To get the best experience, choose the workspace proxy that is closest located to
23-
you.
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.
2424
</Trans>
2525
)
2626

@@ -52,11 +52,11 @@ export const WorkspaceProxyPage: FC<PropsWithChildren<unknown>> = () => {
5252
displayError("Please select a healthy workspace proxy.")
5353
return
5454
}
55-
// normProxy is a normalized proxy to
55+
// normProxy is a normalized proxy to
5656
const normProxy = {
5757
...proxy,
5858
// Trim trailing slashes to be consistent
59-
path_app_url: proxy.path_app_url.replace(/\/$/, ''),
59+
path_app_url: proxy.path_app_url.replace(/\/$/, ""),
6060
}
6161

6262
savePreferredProxy(normProxy)
@@ -82,7 +82,6 @@ const useStyles = makeStyles((theme) => ({
8282

8383
export default WorkspaceProxyPage
8484

85-
8685
// Exporting to be used in the tests
8786
export const savePreferredProxy = (proxy: Region): void => {
8887
window.localStorage.setItem("preferred-proxy", JSON.stringify(proxy))

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

+33-27
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ import { useClickableTableRow } from "hooks/useClickableTableRow"
55
import TableCell from "@material-ui/core/TableCell"
66
import TableRow from "@material-ui/core/TableRow"
77
import { FC } from "react"
8-
import { HealthyBadge, NotHealthyBadge } from "components/DeploySettingsLayout/Badges"
8+
import {
9+
HealthyBadge,
10+
NotHealthyBadge,
11+
} from "components/DeploySettingsLayout/Badges"
912
import { makeStyles } from "@material-ui/core/styles"
1013
import { combineClasses } from "utils/combineClasses"
1114

12-
1315
export const ProxyRow: FC<{
1416
proxy: Region
1517
onSelectRegion: (proxy: Region) => void
@@ -21,37 +23,41 @@ export const ProxyRow: FC<{
2123
onSelectRegion(proxy)
2224
})
2325

24-
const classes = [
25-
clickable.className,
26-
]
26+
const classes = [clickable.className]
2727

2828
if (preferred) {
2929
classes.push(styles.preferredrow)
3030
}
3131

32-
return <TableRow
33-
key={proxy.name}
34-
data-testid={`${proxy.name}`}
35-
{...clickable}
36-
// Make sure to include our classname here.
37-
className={combineClasses(classes)}
38-
>
39-
<TableCell>
40-
<AvatarData
41-
title={
42-
proxy.display_name && proxy.display_name.length > 0
43-
? proxy.display_name
44-
: proxy.name
45-
}
46-
avatar={
47-
proxy.icon_url !== "" && <Avatar src={proxy.icon_url} variant="square" fitImage />
48-
}
49-
/>
50-
</TableCell>
32+
return (
33+
<TableRow
34+
key={proxy.name}
35+
data-testid={`${proxy.name}`}
36+
{...clickable}
37+
// Make sure to include our classname here.
38+
className={combineClasses(classes)}
39+
>
40+
<TableCell>
41+
<AvatarData
42+
title={
43+
proxy.display_name && proxy.display_name.length > 0
44+
? proxy.display_name
45+
: proxy.name
46+
}
47+
avatar={
48+
proxy.icon_url !== "" && (
49+
<Avatar src={proxy.icon_url} variant="square" fitImage />
50+
)
51+
}
52+
/>
53+
</TableCell>
5154

52-
<TableCell>{proxy.path_app_url}</TableCell>
53-
<TableCell><ProxyStatus proxy={proxy} /></TableCell>
54-
</TableRow>
55+
<TableCell>{proxy.path_app_url}</TableCell>
56+
<TableCell>
57+
<ProxyStatus proxy={proxy} />
58+
</TableCell>
59+
</TableRow>
60+
)
5561
}
5662

5763
const ProxyStatus: FC<{

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

+44-44
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import { AlertBanner } from "components/AlertBanner/AlertBanner"
1313
import { Region } from "api/typesGenerated"
1414
import { ProxyRow } from "./WorkspaceProxyRow"
1515

16-
17-
1816
export interface WorkspaceProxyPageViewProps {
1917
proxies?: Region[]
2018
getWorkspaceProxiesError?: Error | unknown
@@ -36,45 +34,47 @@ export const WorkspaceProxyPageView: FC<
3634
selectProxyError,
3735
preferredProxy,
3836
}) => {
39-
return (
40-
<Stack>
41-
{Boolean(getWorkspaceProxiesError) && (
42-
<AlertBanner severity="error" error={getWorkspaceProxiesError} />
43-
)}
44-
{Boolean(selectProxyError) && (
45-
<AlertBanner severity="error" error={selectProxyError} />
46-
)}
47-
<TableContainer>
48-
<Table>
49-
<TableHead>
50-
<TableRow>
51-
<TableCell width="40%">Proxy</TableCell>
52-
<TableCell width="30%">URL</TableCell>
53-
<TableCell width="10%">Status</TableCell>
54-
</TableRow>
55-
</TableHead>
56-
<TableBody>
57-
<ChooseOne>
58-
<Cond condition={isLoading}>
59-
<TableLoader />
60-
</Cond>
61-
<Cond condition={hasLoaded && proxies?.length === 0}>
62-
<TableEmpty message="No workspace proxies found" />
63-
</Cond>
64-
<Cond>
65-
{proxies?.map((proxy) => (
66-
< ProxyRow
67-
key={proxy.id}
68-
proxy={proxy}
69-
onSelectRegion={onSelect}
70-
preferred={preferredProxy ? proxy.id === preferredProxy.id : false}
71-
/>
72-
))}
73-
</Cond>
74-
</ChooseOne>
75-
</TableBody>
76-
</Table>
77-
</TableContainer>
78-
</Stack>
79-
)
80-
}
37+
return (
38+
<Stack>
39+
{Boolean(getWorkspaceProxiesError) && (
40+
<AlertBanner severity="error" error={getWorkspaceProxiesError} />
41+
)}
42+
{Boolean(selectProxyError) && (
43+
<AlertBanner severity="error" error={selectProxyError} />
44+
)}
45+
<TableContainer>
46+
<Table>
47+
<TableHead>
48+
<TableRow>
49+
<TableCell width="40%">Proxy</TableCell>
50+
<TableCell width="30%">URL</TableCell>
51+
<TableCell width="10%">Status</TableCell>
52+
</TableRow>
53+
</TableHead>
54+
<TableBody>
55+
<ChooseOne>
56+
<Cond condition={isLoading}>
57+
<TableLoader />
58+
</Cond>
59+
<Cond condition={hasLoaded && proxies?.length === 0}>
60+
<TableEmpty message="No workspace proxies found" />
61+
</Cond>
62+
<Cond>
63+
{proxies?.map((proxy) => (
64+
<ProxyRow
65+
key={proxy.id}
66+
proxy={proxy}
67+
onSelectRegion={onSelect}
68+
preferred={
69+
preferredProxy ? proxy.id === preferredProxy.id : false
70+
}
71+
/>
72+
))}
73+
</Cond>
74+
</ChooseOne>
75+
</TableBody>
76+
</Table>
77+
</TableContainer>
78+
</Stack>
79+
)
80+
}

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

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { Story } from "@storybook/react"
22
import { makeMockApiError, MockRegions } from "testHelpers/entities"
3-
import { WorkspaceProxyPageView, WorkspaceProxyPageViewProps } from "./WorkspaceProxyView"
3+
import {
4+
WorkspaceProxyPageView,
5+
WorkspaceProxyPageViewProps,
6+
} from "./WorkspaceProxyView"
47

58
export default {
69
title: "components/WorkspaceProxyPageView",
@@ -10,9 +13,9 @@ export default {
1013
},
1114
}
1215

13-
const Template: Story<WorkspaceProxyPageViewProps> = (args: WorkspaceProxyPageViewProps) => (
14-
<WorkspaceProxyPageView {...args} />
15-
)
16+
const Template: Story<WorkspaceProxyPageViewProps> = (
17+
args: WorkspaceProxyPageViewProps,
18+
) => <WorkspaceProxyPageView {...args} />
1619

1720
export const Example = Template.bind({})
1821
Example.args = {

0 commit comments

Comments
 (0)