Skip to content

feat: add deployment-wide DAU chart #5810

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 27 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
Move DAUs to General Settings for now
  • Loading branch information
presleyp committed Jan 20, 2023
commit f1a29c11aa6069b2bcf22a80fabef2490f25002f
4 changes: 0 additions & 4 deletions site/src/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ const NetworkSettingsPage = lazy(
"./pages/DeploySettingsPage/NetworkSettingsPage/NetworkSettingsPage"
),
)
const MetricsPage = lazy(
() => import("./pages/DeploySettingsPage/MetricsPage/MetricsPage"),
)
const GitAuthPage = lazy(() => import("./pages/GitAuthPage/GitAuthPage"))
const TemplateVersionPage = lazy(
() => import("./pages/TemplateVersionPage/TemplateVersionPage"),
Expand Down Expand Up @@ -195,7 +192,6 @@ export const AppRouter: FC = () => {
<Route path="network" element={<NetworkSettingsPage />} />
<Route path="userauth" element={<UserAuthSettingsPage />} />
<Route path="gitauth" element={<GitAuthSettingsPage />} />
<Route path="metrics" element={<MetricsPage />} />
</Route>

<Route path="settings" element={<SettingsLayout />}>
Expand Down
7 changes: 0 additions & 7 deletions site/src/components/DeploySettingsLayout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Stack } from "components/Stack/Stack"
import { ElementType, PropsWithChildren, ReactNode, FC } from "react"
import { NavLink } from "react-router-dom"
import { combineClasses } from "util/combineClasses"
import TrendingUpIcon from "@material-ui/icons/ShowChart"

const SidebarNavItem: FC<
PropsWithChildren<{ href: string; icon: ReactNode }>
Expand Down Expand Up @@ -76,12 +75,6 @@ export const Sidebar: React.FC = () => {
>
Security
</SidebarNavItem>
<SidebarNavItem
href="metrics"
icon={<SidebarNavItemIcon icon={TrendingUpIcon} />}
>
Metrics
</SidebarNavItem>
</nav>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ import { pageTitle } from "util/page"
import { GeneralSettingsPageView } from "./GeneralSettingsPageView"

const GeneralSettingsPage: FC = () => {
const { deploymentConfig: deploymentConfig } = useDeploySettings()
const { deploymentConfig, deploymentDAUs, getDeploymentDAUsError } =
useDeploySettings()

return (
<>
<Helmet>
<title>{pageTitle("General Settings")}</title>
</Helmet>
<GeneralSettingsPageView deploymentConfig={deploymentConfig} />
<GeneralSettingsPageView
deploymentConfig={deploymentConfig}
deploymentDAUs={deploymentDAUs}
getDeploymentDAUsError={getDeploymentDAUsError}
/>
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { ComponentMeta, Story } from "@storybook/react"
import {
makeMockApiError,
MockDeploymentDAUResponse,
} from "testHelpers/entities"
import {
GeneralSettingsPageView,
GeneralSettingsPageViewProps,
Expand All @@ -24,10 +28,24 @@ export default {
},
},
},
deploymentDAUs: {
defaultValue: MockDeploymentDAUResponse,
},
},
} as ComponentMeta<typeof GeneralSettingsPageView>

const Template: Story<GeneralSettingsPageViewProps> = (args) => (
<GeneralSettingsPageView {...args} />
)
export const Page = Template.bind({})

export const NoDAUs = Template.bind({})
NoDAUs.args = {
deploymentDAUs: undefined,
}

export const DAUError = Template.bind({})
DAUError.args = {
deploymentDAUs: undefined,
getDeploymentDAUsError: makeMockApiError({ message: "Error fetching DAUs." }),
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { DeploymentConfig } from "api/typesGenerated"
import { DeploymentConfig, DeploymentDAUsResponse } from "api/typesGenerated"
import { AlertBanner } from "components/AlertBanner/AlertBanner"
import { DAUChart } from "components/DAUChart/DAUChart"
import { Header } from "components/DeploySettingsLayout/Header"
import OptionsTable from "components/DeploySettingsLayout/OptionsTable"
import { Stack } from "components/Stack/Stack"

export type GeneralSettingsPageViewProps = {
deploymentConfig: Pick<DeploymentConfig, "access_url" | "wildcard_access_url">
deploymentDAUs?: DeploymentDAUsResponse
getDeploymentDAUsError: unknown
}
export const GeneralSettingsPageView = ({
deploymentConfig,
deploymentDAUs,
getDeploymentDAUsError,
}: GeneralSettingsPageViewProps): JSX.Element => {
return (
<>
Expand All @@ -15,12 +22,18 @@ export const GeneralSettingsPageView = ({
description="Information about your Coder deployment."
docsHref="https://coder.com/docs/coder-oss/latest/admin/configure"
/>
<OptionsTable
options={{
access_url: deploymentConfig.access_url,
wildcard_access_url: deploymentConfig.wildcard_access_url,
}}
/>
<Stack spacing={4}>
{Boolean(getDeploymentDAUsError) && (
<AlertBanner error={getDeploymentDAUsError} severity="error" />
)}
{deploymentDAUs && <DAUChart daus={deploymentDAUs} />}
<OptionsTable
options={{
access_url: deploymentConfig.access_url,
wildcard_access_url: deploymentConfig.wildcard_access_url,
}}
/>
</Stack>
</>
)
}
22 changes: 0 additions & 22 deletions site/src/pages/DeploySettingsPage/MetricsPage/MetricsPage.tsx

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions site/src/pages/DeploySettingsPage/MetricsPage/MetricsPageView.tsx

This file was deleted.