mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: make preferred region the first in list (#9014)
This commit is contained in:
@@ -69,14 +69,9 @@ export const AgentLatency: FC<{ agent: WorkspaceAgent }> = ({ agent }) => {
|
||||
|
||||
<HelpTooltipText>
|
||||
<Stack direction="column" spacing={1} className={styles.regions}>
|
||||
{Object.keys(agent.latency).map((regionName) => {
|
||||
if (!agent.latency) {
|
||||
throw new Error("No latency found on agent")
|
||||
}
|
||||
|
||||
const region = agent.latency[regionName]
|
||||
|
||||
return (
|
||||
{Object.entries(agent.latency)
|
||||
.sort(([, a], [, b]) => (a.preferred ? -1 : b.preferred ? 1 : 0))
|
||||
.map(([regionName, region]) => (
|
||||
<Stack
|
||||
direction="row"
|
||||
key={regionName}
|
||||
@@ -87,8 +82,7 @@ export const AgentLatency: FC<{ agent: WorkspaceAgent }> = ({ agent }) => {
|
||||
<strong>{regionName}</strong>
|
||||
{Math.round(region.latency_ms)}ms
|
||||
</Stack>
|
||||
)
|
||||
})}
|
||||
))}
|
||||
</Stack>
|
||||
</HelpTooltipText>
|
||||
</HelpPopover>
|
||||
|
||||
Reference in New Issue
Block a user