feat: add storybook for /deployment/gitauth (#5596)

* refactor: move GitAuthSettingsPage to dir

* refactor: split page and view GitAuthSettingsPage

* fixup!: formatting

* refactor: narrow props in git auth view

* feat: add storybook for GitAuthSettingsPageView

* fixup: formatting
This commit is contained in:
Joe Previte
2023-01-06 16:58:20 +00:00
committed by GitHub
parent aa68e0f8c9
commit 242676bac3
4 changed files with 64 additions and 13 deletions
+4 -1
View File
@@ -89,7 +89,10 @@ const UserAuthSettingsPage = lazy(
() => import("./pages/DeploySettingsPage/UserAuthSettingsPage"),
)
const GitAuthSettingsPage = lazy(
() => import("./pages/DeploySettingsPage/GitAuthSettingsPage"),
() =>
import(
"./pages/DeploySettingsPage/GitAuthSettingsPage/GitAuthSettingsPage"
),
)
const NetworkSettingsPage = lazy(
() => import("./pages/DeploySettingsPage/NetworkSettingsPage"),
@@ -0,0 +1,21 @@
import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout"
import React from "react"
import { Helmet } from "react-helmet-async"
import { pageTitle } from "util/page"
import { GitAuthSettingsPageView } from "./GitAuthSettingsPageView"
const GitAuthSettingsPage: React.FC = () => {
const { deploymentConfig: deploymentConfig } = useDeploySettings()
return (
<>
<Helmet>
<title>{pageTitle("Git Authentication Settings")}</title>
</Helmet>
<GitAuthSettingsPageView deploymentConfig={deploymentConfig} />
</>
)
}
export default GitAuthSettingsPage
@@ -0,0 +1,31 @@
import { ComponentMeta, Story } from "@storybook/react"
import {
GitAuthSettingsPageView,
GitAuthSettingsPageViewProps,
} from "./GitAuthSettingsPageView"
export default {
title: "pages/GitAuthSettingsPageView",
component: GitAuthSettingsPageView,
argTypes: {
deploymentConfig: {
defaultValue: {
gitauth: {
name: "Git Auth",
usage: "Automatically authenticate Git inside workspaces.",
value: [
{
id: "123",
client_id: "575",
},
],
},
},
},
},
} as ComponentMeta<typeof GitAuthSettingsPageView>
const Template: Story<GitAuthSettingsPageViewProps> = (args) => (
<GitAuthSettingsPageView {...args} />
)
export const Page = Template.bind({})
@@ -5,24 +5,22 @@ import TableCell from "@material-ui/core/TableCell"
import TableContainer from "@material-ui/core/TableContainer"
import TableHead from "@material-ui/core/TableHead"
import TableRow from "@material-ui/core/TableRow"
import { DeploymentConfig } from "api/typesGenerated"
import { AlertBanner } from "components/AlertBanner/AlertBanner"
import { EnterpriseBadge } from "components/DeploySettingsLayout/Badges"
import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout"
import { Header } from "components/DeploySettingsLayout/Header"
import React from "react"
import { Helmet } from "react-helmet-async"
import { pageTitle } from "util/page"
const GitAuthSettingsPage: React.FC = () => {
export type GitAuthSettingsPageViewProps = {
deploymentConfig: Pick<DeploymentConfig, "gitauth">
}
export const GitAuthSettingsPageView = ({
deploymentConfig,
}: GitAuthSettingsPageViewProps): JSX.Element => {
const styles = useStyles()
const { deploymentConfig: deploymentConfig } = useDeploySettings()
return (
<>
<Helmet>
<title>{pageTitle("Git Authentication Settings")}</title>
</Helmet>
<Header
title="Git Authentication"
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) => ({
textAlign: "center",
},
}))
export default GitAuthSettingsPage