Skip to content

Commit 59e919a

Browse files
jsjoeiocode-asher
andauthored
feat: add storybook for /deployments/general (#5595)
* refactor: split GeneralSettings page <> View * feat: add story for generalsettingspageview * Update site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx Co-authored-by: Asher <ash@coder.com> Co-authored-by: Asher <ash@coder.com>
1 parent 421e529 commit 59e919a

File tree

4 files changed

+64
-13
lines changed

4 files changed

+64
-13
lines changed

site/src/AppRouter.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ const SettingsGroupPage = lazy(
7171
() => import("./pages/GroupsPage/SettingsGroupPage"),
7272
)
7373
const GeneralSettingsPage = lazy(
74-
() => import("./pages/DeploySettingsPage/GeneralSettingsPage"),
74+
() =>
75+
import(
76+
"./pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPage"
77+
),
7578
)
7679
const SecuritySettingsPage = lazy(
7780
() => import("./pages/DeploySettingsPage/SecuritySettingsPage"),
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 { GeneralSettingsPageView } from "./GeneralSettingsPageView"
6+
7+
const GeneralSettingsPage: React.FC = () => {
8+
const { deploymentConfig: deploymentConfig } = useDeploySettings()
9+
10+
return (
11+
<>
12+
<Helmet>
13+
<title>{pageTitle("General Settings")}</title>
14+
</Helmet>
15+
<GeneralSettingsPageView deploymentConfig={deploymentConfig} />
16+
</>
17+
)
18+
}
19+
20+
export default GeneralSettingsPage
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { ComponentMeta, Story } from "@storybook/react"
2+
import {
3+
GeneralSettingsPageView,
4+
GeneralSettingsPageViewProps,
5+
} from "./GeneralSettingsPageView"
6+
7+
export default {
8+
title: "pages/GeneralSettingsPageView",
9+
component: GeneralSettingsPageView,
10+
argTypes: {
11+
deploymentConfig: {
12+
defaultValue: {
13+
access_url: {
14+
name: "Access URL",
15+
usage:
16+
"External URL to access your deployment. This must be accessible by all provisioned workspaces.",
17+
value: "https://dev.coder.com",
18+
},
19+
wildcard_access_url: {
20+
name: "Wildcard Access URL",
21+
usage:
22+
'Specifies the wildcard hostname to use for workspace applications in the form "*.example.com".',
23+
value: "*--apps.dev.coder.com",
24+
},
25+
},
26+
},
27+
},
28+
} as ComponentMeta<typeof GeneralSettingsPageView>
29+
30+
const Template: Story<GeneralSettingsPageViewProps> = (args) => (
31+
<GeneralSettingsPageView {...args} />
32+
)
33+
export const Page = Template.bind({})
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout"
1+
import { DeploymentConfig } from "api/typesGenerated"
22
import { Header } from "components/DeploySettingsLayout/Header"
33
import OptionsTable from "components/DeploySettingsLayout/OptionsTable"
4-
import React from "react"
5-
import { Helmet } from "react-helmet-async"
6-
import { pageTitle } from "util/page"
7-
8-
const GeneralSettingsPage: React.FC = () => {
9-
const { deploymentConfig: deploymentConfig } = useDeploySettings()
104

5+
export type GeneralSettingsPageViewProps = {
6+
deploymentConfig: Pick<DeploymentConfig, "access_url" | "wildcard_access_url">
7+
}
8+
export const GeneralSettingsPageView = ({
9+
deploymentConfig,
10+
}: GeneralSettingsPageViewProps): JSX.Element => {
1111
return (
1212
<>
13-
<Helmet>
14-
<title>{pageTitle("General Settings")}</title>
15-
</Helmet>
1613
<Header
1714
title="General"
1815
description="Information about your Coder deployment."
@@ -27,5 +24,3 @@ const GeneralSettingsPage: React.FC = () => {
2724
</>
2825
)
2926
}
30-
31-
export default GeneralSettingsPage

0 commit comments

Comments
 (0)