2023-09-06 18:59:26 +00:00
|
|
|
import Box from "@mui/material/Box";
|
2023-10-17 18:49:19 +00:00
|
|
|
import {
|
|
|
|
ClibaseOption,
|
|
|
|
DAUsResponse,
|
|
|
|
Entitlements,
|
|
|
|
Experiments,
|
|
|
|
} from "api/typesGenerated";
|
2023-09-06 18:59:26 +00:00
|
|
|
import { ErrorAlert } from "components/Alert/ErrorAlert";
|
2023-10-03 18:14:11 +00:00
|
|
|
import {
|
|
|
|
ActiveUserChart,
|
|
|
|
ActiveUsersTitle,
|
|
|
|
} from "components/ActiveUserChart/ActiveUserChart";
|
2023-09-06 18:59:26 +00:00
|
|
|
import { Header } from "components/DeploySettingsLayout/Header";
|
|
|
|
import OptionsTable from "components/DeploySettingsLayout/OptionsTable";
|
|
|
|
import { Stack } from "components/Stack/Stack";
|
|
|
|
import { ChartSection } from "./ChartSection";
|
|
|
|
import { useDeploymentOptions } from "utils/deployOptions";
|
|
|
|
import { docs } from "utils/docs";
|
2022-10-17 17:22:59 +00:00
|
|
|
|
2023-01-05 23:06:16 +00:00
|
|
|
export type GeneralSettingsPageViewProps = {
|
2023-09-28 21:14:28 +00:00
|
|
|
deploymentOptions: ClibaseOption[];
|
2023-09-06 18:59:26 +00:00
|
|
|
deploymentDAUs?: DAUsResponse;
|
2023-09-14 21:49:23 +00:00
|
|
|
deploymentDAUsError: unknown;
|
2023-10-09 11:38:41 +00:00
|
|
|
entitlements: Entitlements | undefined;
|
2023-10-17 18:49:19 +00:00
|
|
|
safeExperiments: Experiments | undefined;
|
2023-09-06 18:59:26 +00:00
|
|
|
};
|
2023-01-05 23:06:16 +00:00
|
|
|
export const GeneralSettingsPageView = ({
|
2023-03-07 21:10:01 +00:00
|
|
|
deploymentOptions,
|
2023-01-26 01:03:47 +00:00
|
|
|
deploymentDAUs,
|
2023-09-14 21:49:23 +00:00
|
|
|
deploymentDAUsError,
|
2023-10-09 11:38:41 +00:00
|
|
|
entitlements,
|
2023-10-17 18:49:19 +00:00
|
|
|
safeExperiments,
|
2023-01-05 23:06:16 +00:00
|
|
|
}: GeneralSettingsPageViewProps): JSX.Element => {
|
2022-10-17 17:22:59 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Header
|
|
|
|
title="General"
|
2022-10-18 17:12:06 +00:00
|
|
|
description="Information about your Coder deployment."
|
2023-07-19 18:27:38 +00:00
|
|
|
docsHref={docs("/admin/configure")}
|
2022-10-17 17:22:59 +00:00
|
|
|
/>
|
2023-01-26 01:03:47 +00:00
|
|
|
<Stack spacing={4}>
|
2023-09-14 21:49:23 +00:00
|
|
|
{Boolean(deploymentDAUsError) && (
|
|
|
|
<ErrorAlert error={deploymentDAUsError} />
|
2023-01-26 01:03:47 +00:00
|
|
|
)}
|
2023-07-26 13:13:56 +00:00
|
|
|
{deploymentDAUs && (
|
|
|
|
<Box height={200} sx={{ mb: 3 }}>
|
2023-10-03 18:14:11 +00:00
|
|
|
<ChartSection title={<ActiveUsersTitle />}>
|
2023-10-09 11:38:41 +00:00
|
|
|
<ActiveUserChart
|
|
|
|
data={deploymentDAUs.entries}
|
|
|
|
interval="day"
|
|
|
|
userLimit={
|
|
|
|
entitlements?.features.user_limit.enabled
|
|
|
|
? entitlements?.features.user_limit.limit
|
|
|
|
: undefined
|
|
|
|
}
|
|
|
|
/>
|
2023-09-06 18:06:08 +00:00
|
|
|
</ChartSection>
|
2023-07-26 13:13:56 +00:00
|
|
|
</Box>
|
|
|
|
)}
|
2023-01-26 01:03:47 +00:00
|
|
|
<OptionsTable
|
2023-03-07 21:10:01 +00:00
|
|
|
options={useDeploymentOptions(
|
|
|
|
deploymentOptions,
|
|
|
|
"Access URL",
|
|
|
|
"Wildcard Access URL",
|
2023-08-08 20:33:08 +00:00
|
|
|
"Experiments",
|
2023-03-07 21:10:01 +00:00
|
|
|
)}
|
2023-10-17 18:49:19 +00:00
|
|
|
additionalValues={safeExperiments}
|
2023-01-26 01:03:47 +00:00
|
|
|
/>
|
|
|
|
</Stack>
|
2022-10-17 17:22:59 +00:00
|
|
|
</>
|
2023-09-06 18:59:26 +00:00
|
|
|
);
|
|
|
|
};
|