File tree 3 files changed +8
-4
lines changed
3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ type WorkspaceAgent struct {
59
59
Version string `json:"version"`
60
60
Apps []WorkspaceApp `json:"apps"`
61
61
// DERPLatency is mapped by region name (e.g. "New York City", "Seattle").
62
- DERPLatency map [string ]DERPRegion `json:"latency"`
62
+ DERPLatency map [string ]DERPRegion `json:"latency,omitempty "`
63
63
}
64
64
65
65
type WorkspaceAgentResourceMetadata struct {
Original file line number Diff line number Diff line change @@ -536,7 +536,7 @@ export interface WorkspaceAgent {
536
536
readonly directory ?: string
537
537
readonly version : string
538
538
readonly apps : WorkspaceApp [ ]
539
- readonly latency : Record < string , DERPRegion >
539
+ readonly latency ? : Record < string , DERPRegion >
540
540
}
541
541
542
542
// From codersdk/workspaceagents.go
Original file line number Diff line number Diff line change @@ -10,9 +10,13 @@ export interface ResourceAgentLatencyProps {
10
10
11
11
export const ResourceAgentLatency : React . FC < ResourceAgentLatencyProps > = ( props ) => {
12
12
const styles = useStyles ( )
13
+ if ( ! props . latency ) {
14
+ return null
15
+ }
13
16
if ( Object . keys ( props . latency ) . length === 0 ) {
14
17
return null
15
18
}
19
+ const latency = props . latency
16
20
return (
17
21
< div className = { styles . root } >
18
22
< div className = { styles . title } >
@@ -24,10 +28,10 @@ export const ResourceAgentLatency: React.FC<ResourceAgentLatencyProps> = (props)
24
28
</ HelpTooltipText >
25
29
</ HelpTooltip >
26
30
</ div >
27
- { Object . keys ( props . latency )
31
+ { Object . keys ( latency )
28
32
. sort ( )
29
33
. map ( ( region ) => {
30
- const value = props . latency [ region ]
34
+ const value = latency [ region ]
31
35
return (
32
36
< div key = { region } className = { styles . region } >
33
37
< b > { region } :</ b > { Math . round ( value . latency_ms * 100 ) / 100 } ms
You can’t perform that action at this time.
0 commit comments