Skip to content

Commit bf1bd47

Browse files
committed
Fix FE to use singulare DAUsResponse
1 parent d7e8b25 commit bf1bd47

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

site/src/api/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,13 +826,13 @@ export const getAuditLogs = async (
826826

827827
export const getTemplateDAUs = async (
828828
templateId: string,
829-
): Promise<TypesGen.TemplateDAUsResponse> => {
829+
): Promise<TypesGen.DAUsResponse> => {
830830
const response = await axios.get(`/api/v2/templates/${templateId}/daus`)
831831
return response.data
832832
}
833833

834834
export const getDeploymentDAUs =
835-
async (): Promise<TypesGen.DeploymentDAUsResponse> => {
835+
async (): Promise<TypesGen.DAUsResponse> => {
836836
const response = await axios.get(`/api/v2/insights/daus`)
837837
return response.data
838838
}

site/src/components/DAUChart/DAUChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ChartJS.register(
3838
)
3939

4040
export interface DAUChartProps {
41-
daus: TypesGen.TemplateDAUsResponse | TypesGen.DeploymentDAUsResponse
41+
daus: TypesGen.DAUsResponse
4242
}
4343
export const Language = {
4444
loadingText: "DAU stats are loading. Check back later.",

site/src/components/DeploySettingsLayout/DeploySettingsLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Sidebar } from "./Sidebar"
55
import { createContext, Suspense, useContext, FC } from "react"
66
import { useMachine } from "@xstate/react"
77
import { Loader } from "components/Loader/Loader"
8-
import { DeploymentDAUsResponse } from "api/typesGenerated"
8+
import { DAUsResponse } from "api/typesGenerated"
99
import { deploymentConfigMachine } from "xServices/deploymentConfig/deploymentConfigMachine"
1010
import { RequirePermission } from "components/RequirePermission/RequirePermission"
1111
import { usePermissions } from "hooks/usePermissions"
@@ -15,7 +15,7 @@ import { DeploymentConfig } from "api/types"
1515
type DeploySettingsContextValue = {
1616
deploymentValues: DeploymentConfig
1717
getDeploymentValuesError: unknown
18-
deploymentDAUs?: DeploymentDAUsResponse
18+
deploymentDAUs?: DAUsResponse
1919
getDeploymentDAUsError: unknown
2020
}
2121

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DeploymentOption } from "api/types"
2-
import { DeploymentDAUsResponse } from "api/typesGenerated"
2+
import { DAUsResponse } from "api/typesGenerated"
33
import { ErrorAlert } from "components/Alert/ErrorAlert"
44
import { DAUChart } from "components/DAUChart/DAUChart"
55
import { Header } from "components/DeploySettingsLayout/Header"
@@ -9,7 +9,7 @@ import { useDeploymentOptions } from "utils/deployOptions"
99

1010
export type GeneralSettingsPageViewProps = {
1111
deploymentOptions: DeploymentOption[]
12-
deploymentDAUs?: DeploymentDAUsResponse
12+
deploymentDAUs?: DAUsResponse
1313
getDeploymentDAUsError: unknown
1414
}
1515
export const GeneralSettingsPageView = ({

site/src/testHelpers/entities.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ export const MockOrganization: TypesGen.Organization = {
1616
updated_at: "",
1717
}
1818

19-
export const MockTemplateDAUResponse: TypesGen.TemplateDAUsResponse = {
19+
export const MockTemplateDAUResponse: TypesGen.DAUsResponse = {
20+
tz_hour_offset: 0,
2021
entries: [
2122
{ date: "2022-08-27T00:00:00Z", amount: 1 },
2223
{ date: "2022-08-29T00:00:00Z", amount: 2 },
2324
{ date: "2022-08-30T00:00:00Z", amount: 1 },
2425
],
2526
}
26-
export const MockDeploymentDAUResponse: TypesGen.DeploymentDAUsResponse = {
27+
export const MockDeploymentDAUResponse: TypesGen.DAUsResponse = {
28+
tz_hour_offset: 0,
2729
entries: [
2830
{ date: "2022-08-27T00:00:00Z", amount: 1 },
2931
{ date: "2022-08-29T00:00:00Z", amount: 2 },

site/src/xServices/deploymentConfig/deploymentConfigMachine.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DeploymentDAUsResponse } from "./../../api/typesGenerated"
1+
import { DAUsResponse } from "./../../api/typesGenerated"
22
import { getDeploymentValues, getDeploymentDAUs } from "api/api"
33
import { createMachine, assign } from "xstate"
44
import { DeploymentConfig } from "api/types"
@@ -12,7 +12,7 @@ export const deploymentConfigMachine = createMachine(
1212
context: {} as {
1313
deploymentValues?: DeploymentConfig
1414
getDeploymentValuesError?: unknown
15-
deploymentDAUs?: DeploymentDAUsResponse
15+
deploymentDAUs?: DAUsResponse
1616
getDeploymentDAUsError?: unknown
1717
},
1818
events: {} as { type: "LOAD" },
@@ -21,7 +21,7 @@ export const deploymentConfigMachine = createMachine(
2121
data: DeploymentConfig
2222
}
2323
getDeploymentDAUs: {
24-
data: DeploymentDAUsResponse
24+
data: DAUsResponse
2525
}
2626
},
2727
},

0 commit comments

Comments
 (0)