|
| 1 | +import { makeStyles } from "@material-ui/core/styles" |
| 2 | +import Table from "@material-ui/core/Table" |
| 3 | +import TableBody from "@material-ui/core/TableBody" |
| 4 | +import TableCell from "@material-ui/core/TableCell" |
| 5 | +import TableContainer from "@material-ui/core/TableContainer" |
| 6 | +import TableHead from "@material-ui/core/TableHead" |
| 7 | +import TableRow from "@material-ui/core/TableRow" |
| 8 | +import { AlertBanner } from "components/AlertBanner/AlertBanner" |
| 9 | +import { EnterpriseBadge } from "components/DeploySettingsLayout/Badges" |
| 10 | +import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout" |
| 11 | +import { Header } from "components/DeploySettingsLayout/Header" |
| 12 | +import React from "react" |
| 13 | +import { Helmet } from "react-helmet-async" |
| 14 | +import { pageTitle } from "util/page" |
| 15 | + |
| 16 | +const GitAuthSettingsPage: React.FC = () => { |
| 17 | + const styles = useStyles() |
| 18 | + const { deploymentConfig: deploymentConfig } = useDeploySettings() |
| 19 | + |
| 20 | + return ( |
| 21 | + <> |
| 22 | + <Helmet> |
| 23 | + <title>{pageTitle("Git Authentication Settings")}</title> |
| 24 | + </Helmet> |
| 25 | + |
| 26 | + <Header |
| 27 | + title="Git Authentication" |
| 28 | + description="Coder integrates with GitHub, GitLab, BitBucket, and Azure Repos to authenticate developers with your Git provider." |
| 29 | + docsHref="https://coder.com/docs/coder-oss/latest/admin/git" |
| 30 | + /> |
| 31 | + |
| 32 | + <video |
| 33 | + autoPlay |
| 34 | + muted |
| 35 | + loop |
| 36 | + playsInline |
| 37 | + src="/gitauth.mp4" |
| 38 | + style={{ |
| 39 | + maxWidth: "100%", |
| 40 | + borderRadius: 4, |
| 41 | + }} |
| 42 | + /> |
| 43 | + |
| 44 | + <div className={styles.description}> |
| 45 | + <AlertBanner |
| 46 | + severity="info" |
| 47 | + text="Integrating with multiple Git providers is an Enterprise feature." |
| 48 | + actions={[<EnterpriseBadge key="enterprise" />]} |
| 49 | + /> |
| 50 | + </div> |
| 51 | + |
| 52 | + <TableContainer> |
| 53 | + <Table className={styles.table}> |
| 54 | + <TableHead> |
| 55 | + <TableRow> |
| 56 | + <TableCell width="25%">Type</TableCell> |
| 57 | + <TableCell width="25%">Client ID</TableCell> |
| 58 | + <TableCell width="25%">Match</TableCell> |
| 59 | + </TableRow> |
| 60 | + </TableHead> |
| 61 | + <TableBody> |
| 62 | + {deploymentConfig.gitauth.value.length === 0 && ( |
| 63 | + <TableRow> |
| 64 | + <TableCell colSpan={999}> |
| 65 | + <div className={styles.empty}> |
| 66 | + No providers have been configured! |
| 67 | + </div> |
| 68 | + </TableCell> |
| 69 | + </TableRow> |
| 70 | + )} |
| 71 | + |
| 72 | + {deploymentConfig.gitauth.value.map((git) => { |
| 73 | + const name = git.id || git.type |
| 74 | + return ( |
| 75 | + <TableRow key={name}> |
| 76 | + <TableCell>{name}</TableCell> |
| 77 | + <TableCell>{git.client_id}</TableCell> |
| 78 | + <TableCell>{git.regex || "Not Set"}</TableCell> |
| 79 | + </TableRow> |
| 80 | + ) |
| 81 | + })} |
| 82 | + </TableBody> |
| 83 | + </Table> |
| 84 | + </TableContainer> |
| 85 | + </> |
| 86 | + ) |
| 87 | +} |
| 88 | + |
| 89 | +const useStyles = makeStyles((theme) => ({ |
| 90 | + table: { |
| 91 | + "& td": { |
| 92 | + paddingTop: theme.spacing(3), |
| 93 | + paddingBottom: theme.spacing(3), |
| 94 | + }, |
| 95 | + |
| 96 | + "& td:last-child, & th:last-child": { |
| 97 | + paddingLeft: theme.spacing(4), |
| 98 | + }, |
| 99 | + }, |
| 100 | + description: { |
| 101 | + marginTop: theme.spacing(3), |
| 102 | + marginBottom: theme.spacing(3), |
| 103 | + }, |
| 104 | + empty: { |
| 105 | + textAlign: "center", |
| 106 | + }, |
| 107 | +})) |
| 108 | + |
| 109 | +export default GitAuthSettingsPage |
0 commit comments