@@ -105,7 +105,7 @@ export const DeploymentBannerView: FC<DeploymentBannerViewProps> = ({
105
105
// eslint-disable-next-line react-hooks/exhaustive-deps -- We want this to periodically update!
106
106
} , [ timeUntilRefresh , stats ] ) ;
107
107
108
- const unhealthy = health && ! health . healthy ;
108
+ const healthErrors = health ? getHealthErrors ( health ) : [ ] ;
109
109
const displayLatency = stats ?. workspaces . connection_latency_ms . P50 || - 1 ;
110
110
111
111
return (
@@ -131,30 +131,15 @@ export const DeploymentBannerView: FC<DeploymentBannerViewProps> = ({
131
131
< Tooltip
132
132
classes = { { tooltip : summaryTooltip } }
133
133
title = {
134
- unhealthy ? (
134
+ healthErrors . length > 0 ? (
135
135
< >
136
136
< HelpTooltipTitle >
137
137
We have detected problems with your Coder deployment.
138
138
</ HelpTooltipTitle >
139
139
< Stack spacing = { 1 } >
140
- { ! health . access_url . healthy && (
141
- < HealthIssue >
142
- Your access URL may be configured incorrectly.
143
- </ HealthIssue >
144
- ) }
145
- { ! health . database . healthy && (
146
- < HealthIssue > Your database is unhealthy.</ HealthIssue >
147
- ) }
148
- { ! health . derp . healthy && (
149
- < HealthIssue >
150
- We're noticing DERP proxy issues.
151
- </ HealthIssue >
152
- ) }
153
- { ! health . websocket . healthy && (
154
- < HealthIssue >
155
- We're noticing websocket issues.
156
- </ HealthIssue >
157
- ) }
140
+ { healthErrors . map ( ( error ) => (
141
+ < HealthIssue key = { error } > { error } </ HealthIssue >
142
+ ) ) }
158
143
</ Stack >
159
144
</ >
160
145
) : (
@@ -164,7 +149,7 @@ export const DeploymentBannerView: FC<DeploymentBannerViewProps> = ({
164
149
open = { process . env . STORYBOOK === "true" ? true : undefined }
165
150
css = { { marginRight : - 16 } }
166
151
>
167
- { unhealthy ? (
152
+ { healthErrors . length > 0 ? (
168
153
< Link
169
154
component = { RouterLink }
170
155
to = "/health"
@@ -380,6 +365,32 @@ const HealthIssue: FC<PropsWithChildren> = ({ children }) => {
380
365
) ;
381
366
} ;
382
367
368
+ const getHealthErrors = ( health : HealthcheckReport ) => {
369
+ const warnings : string [ ] = [ ] ;
370
+ const sections = [
371
+ "access_url" ,
372
+ "database" ,
373
+ "derp" ,
374
+ "websocket" ,
375
+ "workspace_proxy" ,
376
+ ] as const ;
377
+ const messages : Record < ( typeof sections ) [ number ] , string > = {
378
+ access_url : "Your access URL may be configured incorrectly." ,
379
+ database : "Your database is unhealthy." ,
380
+ derp : "We're noticing DERP proxy issues." ,
381
+ websocket : "We're noticing websocket issues." ,
382
+ workspace_proxy : "We're noticing workspace proxy issues." ,
383
+ } as const ;
384
+
385
+ sections . forEach ( ( section ) => {
386
+ if ( health [ section ] . severity === "error" && ! health [ section ] . dismissed ) {
387
+ warnings . push ( messages [ section ] ) ;
388
+ }
389
+ } ) ;
390
+
391
+ return warnings ;
392
+ } ;
393
+
383
394
const classNames = {
384
395
summaryTooltip : ( css , theme ) => css `
385
396
${ theme . typography . body2 as CSSObject }
0 commit comments