Skip to content

feat: Add deployment settings page #4590

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 17 commits into from
Oct 17, 2022
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
Format
  • Loading branch information
kylecarbs committed Oct 17, 2022
commit bf8c49e6ccaf1b2be40ec7efb799ec36d03c3bd6
9 changes: 4 additions & 5 deletions site/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,7 @@ export const getDeploymentFlags =
return response.data
}

export const getReplicas =
async (): Promise<TypesGen.Replica[]> => {
const response = await axios.get(`/api/v2/replicas`)
return response.data
}
export const getReplicas = async (): Promise<TypesGen.Replica[]> => {
const response = await axios.get(`/api/v2/replicas`)
return response.data
}
2 changes: 1 addition & 1 deletion site/src/components/DeploySettingsLayout/Option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const useStyles = makeStyles((theme) => ({
optionValue: {
fontSize: 14,
fontFamily: MONOSPACE_FONT_FAMILY,

"& ul": {
padding: theme.spacing(2),
},
Expand Down
30 changes: 28 additions & 2 deletions site/src/pages/DeploySettingsPage/NetworkSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@ 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 { useMachine } from "@xstate/react"
import {
Badges,
DisabledBadge,
EnabledBadge
EnabledBadge,
EnterpriseBadge,
} from "components/DeploySettingsLayout/Badges"
import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout"
import { Header } from "components/DeploySettingsLayout/Header"
import {
OptionDescription,
OptionName,
OptionValue
OptionValue,
} from "components/DeploySettingsLayout/Option"
import { ReplicasTable } from "components/ReplicasTable/ReplicasTable"
import { Stack } from "components/Stack/Stack"
import React from "react"
import { highAvailabilityMachine } from "xServices/deploymentFlags/highAvailabilityMachine"

const NetworkSettingsPage: React.FC = () => {
const { deploymentFlags } = useDeploySettings()
const [state] = useMachine(highAvailabilityMachine)

return (
<Stack direction="column" spacing={6}>
Expand Down Expand Up @@ -114,6 +120,26 @@ const NetworkSettingsPage: React.FC = () => {
</Table>
</TableContainer>
</div>

<div>
<Header
title="High Availability"
secondary
description="Deploy Coder multi regionally for high availability. Only active if more than one replica exists."
docsHref="https://coder.com/docs/coder-oss/latest/admin/auth#openid-connect-with-google"
/>

<Badges>
{deploymentFlags.derp_server_relay_address.value ? (
<EnabledBadge />
) : (
<DisabledBadge />
)}
<EnterpriseBadge />
</Badges>

<ReplicasTable replicas={state.context.replicas || []} />
</div>
</Stack>
)
}
Expand Down
15 changes: 11 additions & 4 deletions site/src/pages/DeploySettingsPage/SecuritySettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import TableContainer from "@material-ui/core/TableContainer"
import TableHead from "@material-ui/core/TableHead"
import TableRow from "@material-ui/core/TableRow"
import {
Badges, DisabledBadge, EnabledBadge, EnterpriseBadge
Badges,
DisabledBadge,
EnabledBadge,
EnterpriseBadge,
} from "components/DeploySettingsLayout/Badges"
import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout"
import { Header } from "components/DeploySettingsLayout/Header"
import {
OptionDescription,
OptionName,
OptionValue
OptionValue,
} from "components/DeploySettingsLayout/Option"
import { Stack } from "components/Stack/Stack"
import React from "react"
Expand Down Expand Up @@ -56,7 +59,9 @@ const SecuritySettingsPage: React.FC = () => {
</TableRow>
<TableRow>
<TableCell>
<OptionName>{deploymentFlags.secure_auth_cookie.name}</OptionName>
<OptionName>
{deploymentFlags.secure_auth_cookie.name}
</OptionName>
<OptionDescription>
{deploymentFlags.secure_auth_cookie.description}
</OptionDescription>
Expand Down Expand Up @@ -192,7 +197,9 @@ const SecuritySettingsPage: React.FC = () => {

<TableRow>
<TableCell>
<OptionName>{deploymentFlags.tls_min_version.name}</OptionName>
<OptionName>
{deploymentFlags.tls_min_version.name}
</OptionName>
<OptionDescription>
{deploymentFlags.tls_min_version.description}
</OptionDescription>
Expand Down
4 changes: 2 additions & 2 deletions site/src/xServices/auth/authXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ export const authMachine =
idle: {
on: {
GET_AUTH_METHODS: {
target: "gettingMethods"
},
target: "gettingMethods",
},
},
},
gettingMethods: {
Expand Down