Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add storybook for /deployments/general #5595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion site/src/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ const SettingsGroupPage = lazy(
() => import("./pages/GroupsPage/SettingsGroupPage"),
)
const GeneralSettingsPage = lazy(
() => import("./pages/DeploySettingsPage/GeneralSettingsPage"),
() =>
import(
"./pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPage"
),
)
const SecuritySettingsPage = lazy(
() => import("./pages/DeploySettingsPage/SecuritySettingsPage"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout"
import React from "react"
import { Helmet } from "react-helmet-async"
import { pageTitle } from "util/page"
import { GeneralSettingsPageView } from "./GeneralSettingsPageView"

const GeneralSettingsPage: React.FC = () => {
const { deploymentConfig: deploymentConfig } = useDeploySettings()

return (
<>
<Helmet>
<title>{pageTitle("General Settings")}</title>
</Helmet>
<GeneralSettingsPageView deploymentConfig={deploymentConfig} />
</>
)
}

export default GeneralSettingsPage
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ComponentMeta, Story } from "@storybook/react"
import {
GeneralSettingsPageView,
GeneralSettingsPageViewProps,
} from "./GeneralSettingsPageView"

export default {
title: "pages/GeneralSettingsPageView",
component: GeneralSettingsPageView,
argTypes: {
deploymentConfig: {
defaultValue: {
access_url: {
name: "Access URL",
usage:
"External URL to access your deployment. This must be accessible by all provisioned workspaces.",
value: "https://dev.coder.com",
},
wildcard_access_url: {
name: "Wildcard Access URL",
usage:
'Specifies the wildcard hostname to use for workspace applications in the form "*.example.com".',
value: "*--apps.dev.coder.com",
},
},
},
},
} as ComponentMeta<typeof GeneralSettingsPageView>

const Template: Story<GeneralSettingsPageViewProps> = (args) => (
<GeneralSettingsPageView {...args} />
)
export const Page = Template.bind({})
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout"
import { DeploymentConfig } from "api/typesGenerated"
import { Header } from "components/DeploySettingsLayout/Header"
import OptionsTable from "components/DeploySettingsLayout/OptionsTable"
import React from "react"
import { Helmet } from "react-helmet-async"
import { pageTitle } from "util/page"

const GeneralSettingsPage: React.FC = () => {
const { deploymentConfig: deploymentConfig } = useDeploySettings()

export type GeneralSettingsPageViewProps = {
deploymentConfig: Pick<DeploymentConfig, "access_url" | "wildcard_access_url">
}
export const GeneralSettingsPageView = ({
deploymentConfig,
}: GeneralSettingsPageViewProps): JSX.Element => {
return (
<>
<Helmet>
<title>{pageTitle("General Settings")}</title>
</Helmet>
<Header
title="General"
description="Information about your Coder deployment."
Expand All @@ -27,5 +24,3 @@ const GeneralSettingsPage: React.FC = () => {
</>
)
}

export default GeneralSettingsPage