Skip to content

feat: add storybook for /deployment/userauth #5609

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 4 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: add storybook for user auth
  • Loading branch information
jsjoeio committed Jan 6, 2023
commit d66bfa13184612d44db16199e0a1c63f9b49d80b
1 change: 1 addition & 0 deletions site/src/components/DeploySettingsLayout/OptionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const OptionsTable: React.FC<{
options: Record<string, DeploymentConfigField<Flaggable>>
}> = ({ options }) => {
const styles = useStyles()
console.log(options, "options")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to be here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Those keep slipping in. Fixing


return (
<TableContainer>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { ComponentMeta, Story } from "@storybook/react"
import {
UserAuthSettingsPageView,
UserAuthSettingsPageViewProps,
} from "./UserAuthSettingsPageView"

export default {
title: "pages/UserAuthSettingsPageView",
component: UserAuthSettingsPageView,
argTypes: {
deploymentConfig: {
defaultValue: {
oidc: {
client_id: {
name: "OIDC Client ID",
usage: "Client ID to use for Login with OIDC.",
value: "1234",
},
allow_signups: {
name: "OIDC Allow Signups",
usage: "Whether new users can sign up with OIDC.",
value: true,
},
email_domain: {
name: "OIDC Email Domain",
usage:
"Email domains that clients logging in with OIDC must match.",
value: "@coder.com",
},
issuer_url: {
name: "OIDC Issuer URL",
usage: "Issuer URL to use for Login with OIDC.",
value: "https://coder.com",
},
scopes: {
name: "OIDC Scopes",
usage: "Scopes to grant when authenticating with OIDC.",
value: ["idk"],
},
},
oauth2: {
github: {
client_id: {
name: "OAuth2 GitHub Client ID",
usage: "Client ID for Login with GitHub.",
value: "1224",
},
allow_signups: {
name: "OAuth2 GitHub Allow Signups",
usage: "Whether new users can sign up with GitHub.",
value: true,
},
enterprise_base_url: {
name: "OAuth2 GitHub Enterprise Base URL",
usage:
"Base URL of a GitHub Enterprise deployment to use for Login with GitHub.",
value: "https://google.com",
},
allowed_orgs: {
name: "OAuth2 GitHub Allowed Orgs",
usage:
"Organizations the user must be a member of to Login with GitHub.",
value: true,
},
allowed_teams: {
name: "OAuth2 GitHub Allowed Teams",
usage:
"Teams inside organizations the user must be a member of to Login with GitHub. Structured as: <organization-name>/<team-slug>.",
value: true,
},
},
},
},
},
},
} as ComponentMeta<typeof UserAuthSettingsPageView>

const Template: Story<UserAuthSettingsPageViewProps> = (args) => (
<UserAuthSettingsPageView {...args} />
)
export const Page = Template.bind({})
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Header } from "components/DeploySettingsLayout/Header"
import OptionsTable from "components/DeploySettingsLayout/OptionsTable"
import { Stack } from "components/Stack/Stack"

type UserAuthSettingsPageViewProps = {
export type UserAuthSettingsPageViewProps = {
deploymentConfig: Pick<DeploymentConfig, "oidc" | "oauth2">
}

Expand Down