Skip to content

Commit 5eba101

Browse files
committed
WIP
1 parent 99893ff commit 5eba101

File tree

3 files changed

+42
-24
lines changed

3 files changed

+42
-24
lines changed

site/src/api/api.ts

+3-12
Original file line numberDiff line numberDiff line change
@@ -1555,18 +1555,9 @@ export const getInsightsTemplate = async (
15551555
return response.data;
15561556
};
15571557

1558-
export interface Health {
1559-
healthy: boolean;
1560-
warning: boolean;
1561-
time: string;
1562-
coder_version: string;
1563-
access_url: { healthy: boolean; warning: boolean };
1564-
database: { healthy: boolean; warning: boolean };
1565-
derp: { healthy: boolean; warning: boolean };
1566-
websocket: { healthy: boolean; warning: boolean };
1567-
}
1568-
15691558
export const getHealth = async () => {
1570-
const response = await axios.get<Health>("/api/v2/debug/health");
1559+
const response = await axios.get<TypesGen.HealthcheckReport>(
1560+
"/api/v2/debug/health",
1561+
);
15711562
return response.data;
15721563
};

site/src/pages/HealthPage/HealthPage.tsx

+11-5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import { Stats, StatsItem } from "components/Stats/Stats";
2020
import { createDayString } from "utils/createDayString";
2121
import { DashboardFullPage } from "components/Dashboard/DashboardLayout";
22+
import { DerphealthReport } from "api/typesGenerated"
2223

2324
const sections = {
2425
derp: "DERP",
@@ -139,10 +140,12 @@ export function HealthPageView({
139140
.map((key) => {
140141
const label = sections[key as keyof typeof sections];
141142
const isActive = tab.value === key;
142-
const isHealthy =
143-
healthStatus[key as keyof typeof sections].healthy;
144-
const isWarning =
145-
healthStatus[key as keyof typeof sections].warning;
143+
const healthSection = healthStatus[key as keyof typeof sections]
144+
const isHealthy = healthSection.healthy;
145+
if (healthSection instanceof DerphealthReport) {
146+
147+
}
148+
const isWarning = (healthSection as DerphealthReport).warning;
146149
return (
147150
<Box
148151
component="button"
@@ -221,7 +224,10 @@ export function HealthPageView({
221224
</Box>
222225
</DashboardFullPage>
223226
);
224-
}
227+
};
228+
229+
export const getValidationErrorMessage = (error: unknown): string => {
230+
225231

226232
const styles = {
227233
stats: (theme) => ({

site/src/testHelpers/entities.ts

+28-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import {
22
withDefaultFeatures,
33
type GetLicensesResponse,
4-
type DeploymentConfig,
5-
type Health,
4+
type DeploymentConfig
65
} from "api/api";
76
import { FieldError } from "api/errors";
87
import * as TypesGen from "api/typesGenerated";
@@ -2809,12 +2808,34 @@ export const MockListeningPortsResponse: TypesGen.WorkspaceAgentListeningPortsRe
28092808
],
28102809
};
28112810

2812-
export const DeploymentHealthUnhealthy: Health = {
2811+
export const DeploymentHealthUnhealthy: TypesGen.HealthcheckReport = {
28132812
healthy: false,
2813+
warning: false,
2814+
failing_sections: [], // apparently this property is not used at all?
28142815
time: "2023-10-12T23:15:00.000000000Z",
28152816
coder_version: "v2.3.0-devel+8cca4915a",
2816-
access_url: { healthy: true },
2817-
database: { healthy: false },
2818-
derp: { healthy: false },
2819-
websocket: { healthy: false },
2817+
access_url: {
2818+
healthy: true,
2819+
access_url: "",
2820+
healthz_response: "",
2821+
reachable: true,
2822+
status_code: 0,
2823+
},
2824+
database: {
2825+
healthy: false,
2826+
latency: "",
2827+
latency_ms: 0,
2828+
reachable: true,
2829+
},
2830+
derp: {
2831+
healthy: false,
2832+
warning: false,
2833+
regions: [],
2834+
netcheck_logs: [],
2835+
},
2836+
websocket: {
2837+
healthy: false,
2838+
body: "",
2839+
code: 0,
2840+
},
28202841
};

0 commit comments

Comments
 (0)