Skip to content

Commit 058c204

Browse files
committed
Merge branch 'main' of github.com:coder/coder into bq/refact-port-forwarding
2 parents 165ec63 + 763147e commit 058c204

File tree

8 files changed

+192
-76
lines changed

8 files changed

+192
-76
lines changed

site/src/AppRouter.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,16 @@ const UserAuthSettingsPage = lazy(
8989
() => import("./pages/DeploySettingsPage/UserAuthSettingsPage"),
9090
)
9191
const GitAuthSettingsPage = lazy(
92-
() => import("./pages/DeploySettingsPage/GitAuthSettingsPage"),
92+
() =>
93+
import(
94+
"./pages/DeploySettingsPage/GitAuthSettingsPage/GitAuthSettingsPage"
95+
),
9396
)
9497
const NetworkSettingsPage = lazy(
95-
() => import("./pages/DeploySettingsPage/NetworkSettingsPage"),
98+
() =>
99+
import(
100+
"./pages/DeploySettingsPage/NetworkSettingsPage/NetworkSettingsPage"
101+
),
96102
)
97103
const GitAuthPage = lazy(() => import("./pages/GitAuthPage/GitAuthPage"))
98104
const TemplateVersionPage = lazy(
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout"
2+
import React from "react"
3+
import { Helmet } from "react-helmet-async"
4+
import { pageTitle } from "util/page"
5+
import { GitAuthSettingsPageView } from "./GitAuthSettingsPageView"
6+
7+
const GitAuthSettingsPage: React.FC = () => {
8+
const { deploymentConfig: deploymentConfig } = useDeploySettings()
9+
10+
return (
11+
<>
12+
<Helmet>
13+
<title>{pageTitle("Git Authentication Settings")}</title>
14+
</Helmet>
15+
16+
<GitAuthSettingsPageView deploymentConfig={deploymentConfig} />
17+
</>
18+
)
19+
}
20+
21+
export default GitAuthSettingsPage
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { ComponentMeta, Story } from "@storybook/react"
2+
import {
3+
GitAuthSettingsPageView,
4+
GitAuthSettingsPageViewProps,
5+
} from "./GitAuthSettingsPageView"
6+
7+
export default {
8+
title: "pages/GitAuthSettingsPageView",
9+
component: GitAuthSettingsPageView,
10+
argTypes: {
11+
deploymentConfig: {
12+
defaultValue: {
13+
gitauth: {
14+
name: "Git Auth",
15+
usage: "Automatically authenticate Git inside workspaces.",
16+
value: [
17+
{
18+
id: "123",
19+
client_id: "575",
20+
},
21+
],
22+
},
23+
},
24+
},
25+
},
26+
} as ComponentMeta<typeof GitAuthSettingsPageView>
27+
28+
const Template: Story<GitAuthSettingsPageViewProps> = (args) => (
29+
<GitAuthSettingsPageView {...args} />
30+
)
31+
export const Page = Template.bind({})

site/src/pages/DeploySettingsPage/GitAuthSettingsPage.tsx renamed to site/src/pages/DeploySettingsPage/GitAuthSettingsPage/GitAuthSettingsPageView.tsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,22 @@ import TableCell from "@material-ui/core/TableCell"
55
import TableContainer from "@material-ui/core/TableContainer"
66
import TableHead from "@material-ui/core/TableHead"
77
import TableRow from "@material-ui/core/TableRow"
8+
import { DeploymentConfig } from "api/typesGenerated"
89
import { AlertBanner } from "components/AlertBanner/AlertBanner"
910
import { EnterpriseBadge } from "components/DeploySettingsLayout/Badges"
10-
import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout"
1111
import { Header } from "components/DeploySettingsLayout/Header"
12-
import React from "react"
13-
import { Helmet } from "react-helmet-async"
14-
import { pageTitle } from "util/page"
1512

16-
const GitAuthSettingsPage: React.FC = () => {
13+
export type GitAuthSettingsPageViewProps = {
14+
deploymentConfig: Pick<DeploymentConfig, "gitauth">
15+
}
16+
17+
export const GitAuthSettingsPageView = ({
18+
deploymentConfig,
19+
}: GitAuthSettingsPageViewProps): JSX.Element => {
1720
const styles = useStyles()
18-
const { deploymentConfig: deploymentConfig } = useDeploySettings()
1921

2022
return (
2123
<>
22-
<Helmet>
23-
<title>{pageTitle("Git Authentication Settings")}</title>
24-
</Helmet>
25-
2624
<Header
2725
title="Git Authentication"
2826
description="Coder integrates with GitHub, GitLab, BitBucket, and Azure Repos to authenticate developers with your Git provider."
@@ -105,5 +103,3 @@ const useStyles = makeStyles((theme) => ({
105103
textAlign: "center",
106104
},
107105
}))
108-
109-
export default GitAuthSettingsPage

site/src/pages/DeploySettingsPage/NetworkSettingsPage.tsx

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout"
2+
import React from "react"
3+
import { Helmet } from "react-helmet-async"
4+
import { pageTitle } from "util/page"
5+
import { NetworkSettingsPageView } from "./NetworkSettingsPageView"
6+
7+
const NetworkSettingsPage: React.FC = () => {
8+
const { deploymentConfig: deploymentConfig } = useDeploySettings()
9+
10+
return (
11+
<>
12+
<Helmet>
13+
<title>{pageTitle("Network Settings")}</title>
14+
</Helmet>
15+
16+
<NetworkSettingsPageView deploymentConfig={deploymentConfig} />
17+
</>
18+
)
19+
}
20+
21+
export default NetworkSettingsPage
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { ComponentMeta, Story } from "@storybook/react"
2+
import {
3+
NetworkSettingsPageView,
4+
NetworkSettingsPageViewProps,
5+
} from "./NetworkSettingsPageView"
6+
7+
export default {
8+
title: "pages/NetworkSettingsPageView",
9+
component: NetworkSettingsPageView,
10+
argTypes: {
11+
deploymentConfig: {
12+
defaultValue: {
13+
derp: {
14+
server: {
15+
enable: {
16+
name: "DERP Server Enable",
17+
usage:
18+
"Whether to enable or disable the embedded DERP relay server.",
19+
value: true,
20+
},
21+
region_name: {
22+
name: "DERP Server Region Name",
23+
usage: "Region name that for the embedded DERP server.",
24+
value: "aws-east",
25+
},
26+
stun_addresses: {
27+
name: "DERP Server STUN Addresses",
28+
usage:
29+
"Addresses for STUN servers to establish P2P connections. Set empty to disable P2P connections.",
30+
value: ["stun.l.google.com:19302", "stun.l.google.com:19301"],
31+
},
32+
},
33+
config: {
34+
url: {
35+
name: "DERP Config URL",
36+
usage:
37+
"URL to fetch a DERP mapping on startup. See: https://tailscale.com/kb/1118/custom-derp-servers/",
38+
value: "https://coder.com",
39+
},
40+
},
41+
},
42+
},
43+
},
44+
},
45+
} as ComponentMeta<typeof NetworkSettingsPageView>
46+
47+
const Template: Story<NetworkSettingsPageViewProps> = (args) => (
48+
<NetworkSettingsPageView {...args} />
49+
)
50+
export const Page = Template.bind({})
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { DeploymentConfig } from "api/typesGenerated"
2+
import {
3+
Badges,
4+
EnabledBadge,
5+
DisabledBadge,
6+
} from "components/DeploySettingsLayout/Badges"
7+
import { Header } from "components/DeploySettingsLayout/Header"
8+
import OptionsTable from "components/DeploySettingsLayout/OptionsTable"
9+
import { Stack } from "components/Stack/Stack"
10+
11+
export type NetworkSettingsPageViewProps = {
12+
deploymentConfig: Pick<DeploymentConfig, "derp" | "wildcard_access_url">
13+
}
14+
15+
export const NetworkSettingsPageView = ({
16+
deploymentConfig,
17+
}: NetworkSettingsPageViewProps): JSX.Element => (
18+
<Stack direction="column" spacing={6}>
19+
<div>
20+
<Header
21+
title="Network"
22+
description="Configure your deployment connectivity."
23+
docsHref="https://coder.com/docs/coder-oss/latest/networking"
24+
/>
25+
<OptionsTable
26+
options={{
27+
derp_server_enable: deploymentConfig.derp.server.enable,
28+
derp_server_region_name: deploymentConfig.derp.server.region_name,
29+
derp_server_stun_addresses:
30+
deploymentConfig.derp.server.stun_addresses,
31+
derp_config_url: deploymentConfig.derp.config.url,
32+
}}
33+
/>
34+
</div>
35+
36+
<div>
37+
<Header
38+
title="Port Forwarding"
39+
secondary
40+
description="Port forwarding lets developers securely access processes on their Coder workspace from a local machine."
41+
docsHref="https://coder.com/docs/coder-oss/latest/networking/port-forwarding"
42+
/>
43+
44+
<Badges>
45+
{deploymentConfig.wildcard_access_url.value !== "" ? (
46+
<EnabledBadge />
47+
) : (
48+
<DisabledBadge />
49+
)}
50+
</Badges>
51+
</div>
52+
</Stack>
53+
)

0 commit comments

Comments
 (0)