mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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>
This commit is contained in:
@@ -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"),
|
||||
|
||||
@@ -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
|
||||
+33
@@ -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({})
|
||||
+7
-12
@@ -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."
|
||||
@@ -27,5 +24,3 @@ const GeneralSettingsPage: React.FC = () => {
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default GeneralSettingsPage
|
||||
Reference in New Issue
Block a user