Skip to content

Commit f1a29c1

Browse files
committed
Move DAUs to General Settings for now
1 parent 11f6c40 commit f1a29c1

File tree

8 files changed

+45
-93
lines changed

8 files changed

+45
-93
lines changed

site/src/AppRouter.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ const NetworkSettingsPage = lazy(
103103
"./pages/DeploySettingsPage/NetworkSettingsPage/NetworkSettingsPage"
104104
),
105105
)
106-
const MetricsPage = lazy(
107-
() => import("./pages/DeploySettingsPage/MetricsPage/MetricsPage"),
108-
)
109106
const GitAuthPage = lazy(() => import("./pages/GitAuthPage/GitAuthPage"))
110107
const TemplateVersionPage = lazy(
111108
() => import("./pages/TemplateVersionPage/TemplateVersionPage"),
@@ -195,7 +192,6 @@ export const AppRouter: FC = () => {
195192
<Route path="network" element={<NetworkSettingsPage />} />
196193
<Route path="userauth" element={<UserAuthSettingsPage />} />
197194
<Route path="gitauth" element={<GitAuthSettingsPage />} />
198-
<Route path="metrics" element={<MetricsPage />} />
199195
</Route>
200196

201197
<Route path="settings" element={<SettingsLayout />}>

site/src/components/DeploySettingsLayout/Sidebar.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Stack } from "components/Stack/Stack"
99
import { ElementType, PropsWithChildren, ReactNode, FC } from "react"
1010
import { NavLink } from "react-router-dom"
1111
import { combineClasses } from "util/combineClasses"
12-
import TrendingUpIcon from "@material-ui/icons/ShowChart"
1312

1413
const SidebarNavItem: FC<
1514
PropsWithChildren<{ href: string; icon: ReactNode }>
@@ -76,12 +75,6 @@ export const Sidebar: React.FC = () => {
7675
>
7776
Security
7877
</SidebarNavItem>
79-
<SidebarNavItem
80-
href="metrics"
81-
icon={<SidebarNavItemIcon icon={TrendingUpIcon} />}
82-
>
83-
Metrics
84-
</SidebarNavItem>
8578
</nav>
8679
)
8780
}

site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPage.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ import { pageTitle } from "util/page"
55
import { GeneralSettingsPageView } from "./GeneralSettingsPageView"
66

77
const GeneralSettingsPage: FC = () => {
8-
const { deploymentConfig: deploymentConfig } = useDeploySettings()
8+
const { deploymentConfig, deploymentDAUs, getDeploymentDAUsError } =
9+
useDeploySettings()
910

1011
return (
1112
<>
1213
<Helmet>
1314
<title>{pageTitle("General Settings")}</title>
1415
</Helmet>
15-
<GeneralSettingsPageView deploymentConfig={deploymentConfig} />
16+
<GeneralSettingsPageView
17+
deploymentConfig={deploymentConfig}
18+
deploymentDAUs={deploymentDAUs}
19+
getDeploymentDAUsError={getDeploymentDAUsError}
20+
/>
1621
</>
1722
)
1823
}

site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.stories.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import { ComponentMeta, Story } from "@storybook/react"
2+
import {
3+
makeMockApiError,
4+
MockDeploymentDAUResponse,
5+
} from "testHelpers/entities"
26
import {
37
GeneralSettingsPageView,
48
GeneralSettingsPageViewProps,
@@ -24,10 +28,24 @@ export default {
2428
},
2529
},
2630
},
31+
deploymentDAUs: {
32+
defaultValue: MockDeploymentDAUResponse,
33+
},
2734
},
2835
} as ComponentMeta<typeof GeneralSettingsPageView>
2936

3037
const Template: Story<GeneralSettingsPageViewProps> = (args) => (
3138
<GeneralSettingsPageView {...args} />
3239
)
3340
export const Page = Template.bind({})
41+
42+
export const NoDAUs = Template.bind({})
43+
NoDAUs.args = {
44+
deploymentDAUs: undefined,
45+
}
46+
47+
export const DAUError = Template.bind({})
48+
DAUError.args = {
49+
deploymentDAUs: undefined,
50+
getDeploymentDAUsError: makeMockApiError({ message: "Error fetching DAUs." }),
51+
}
Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
import { DeploymentConfig } from "api/typesGenerated"
1+
import { DeploymentConfig, DeploymentDAUsResponse } from "api/typesGenerated"
2+
import { AlertBanner } from "components/AlertBanner/AlertBanner"
3+
import { DAUChart } from "components/DAUChart/DAUChart"
24
import { Header } from "components/DeploySettingsLayout/Header"
35
import OptionsTable from "components/DeploySettingsLayout/OptionsTable"
6+
import { Stack } from "components/Stack/Stack"
47

58
export type GeneralSettingsPageViewProps = {
69
deploymentConfig: Pick<DeploymentConfig, "access_url" | "wildcard_access_url">
10+
deploymentDAUs?: DeploymentDAUsResponse
11+
getDeploymentDAUsError: unknown
712
}
813
export const GeneralSettingsPageView = ({
914
deploymentConfig,
15+
deploymentDAUs,
16+
getDeploymentDAUsError,
1017
}: GeneralSettingsPageViewProps): JSX.Element => {
1118
return (
1219
<>
@@ -15,12 +22,18 @@ export const GeneralSettingsPageView = ({
1522
description="Information about your Coder deployment."
1623
docsHref="https://coder.com/docs/coder-oss/latest/admin/configure"
1724
/>
18-
<OptionsTable
19-
options={{
20-
access_url: deploymentConfig.access_url,
21-
wildcard_access_url: deploymentConfig.wildcard_access_url,
22-
}}
23-
/>
25+
<Stack spacing={4}>
26+
{Boolean(getDeploymentDAUsError) && (
27+
<AlertBanner error={getDeploymentDAUsError} severity="error" />
28+
)}
29+
{deploymentDAUs && <DAUChart daus={deploymentDAUs} />}
30+
<OptionsTable
31+
options={{
32+
access_url: deploymentConfig.access_url,
33+
wildcard_access_url: deploymentConfig.wildcard_access_url,
34+
}}
35+
/>
36+
</Stack>
2437
</>
2538
)
2639
}

site/src/pages/DeploySettingsPage/MetricsPage/MetricsPage.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

site/src/pages/DeploySettingsPage/MetricsPage/MetricsPageView.stories.tsx

Lines changed: 0 additions & 24 deletions
This file was deleted.

site/src/pages/DeploySettingsPage/MetricsPage/MetricsPageView.tsx

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)