mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
provisioner: don't pass CODER_ variables (#4638)
This commit is contained in:
@@ -68,8 +68,8 @@ export const AgentLatency: FC<{ agent: WorkspaceAgent }> = ({ agent }) => {
|
||||
>
|
||||
<HelpTooltipTitle>Latency</HelpTooltipTitle>
|
||||
<HelpTooltipText>
|
||||
Latency from relay servers, used when connections cannot connect
|
||||
peer-to-peer. Star indicates the preferred relay.
|
||||
This is the latency overhead on non peer to peer connections. The star
|
||||
indicates the preferred relay.
|
||||
</HelpTooltipText>
|
||||
|
||||
<HelpTooltipText>
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import { Story } from "@storybook/react"
|
||||
import {
|
||||
ResourceAgentLatency,
|
||||
ResourceAgentLatencyProps,
|
||||
} from "./ResourceAgentLatency"
|
||||
|
||||
export default {
|
||||
title: "components/ResourceAgentLatency",
|
||||
component: ResourceAgentLatency,
|
||||
}
|
||||
|
||||
const Template: Story<ResourceAgentLatencyProps> = (args) => (
|
||||
<ResourceAgentLatency {...args} />
|
||||
)
|
||||
|
||||
export const Single = Template.bind({})
|
||||
Single.args = {
|
||||
latency: {
|
||||
"Coder DERP": {
|
||||
latency_ms: 100.52,
|
||||
preferred: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export const Multiple = Template.bind({})
|
||||
Multiple.args = {
|
||||
latency: {
|
||||
Chicago: {
|
||||
latency_ms: 22.25551,
|
||||
preferred: false,
|
||||
},
|
||||
"New York": {
|
||||
latency_ms: 56.1111,
|
||||
preferred: true,
|
||||
},
|
||||
"San Francisco": {
|
||||
latency_ms: 125.11,
|
||||
preferred: false,
|
||||
},
|
||||
Tokyo: {
|
||||
latency_ms: 255,
|
||||
preferred: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
import { makeStyles } from "@material-ui/core/styles"
|
||||
import StarIcon from "@material-ui/icons/Star"
|
||||
import React from "react"
|
||||
import { WorkspaceAgent } from "../../api/typesGenerated"
|
||||
import { HelpTooltip, HelpTooltipText } from "../Tooltips/HelpTooltip"
|
||||
|
||||
export interface ResourceAgentLatencyProps {
|
||||
latency: WorkspaceAgent["latency"]
|
||||
}
|
||||
|
||||
export const ResourceAgentLatency: React.FC<ResourceAgentLatencyProps> = (
|
||||
props,
|
||||
) => {
|
||||
const styles = useStyles()
|
||||
if (!props.latency) {
|
||||
return null
|
||||
}
|
||||
if (Object.keys(props.latency).length === 0) {
|
||||
return null
|
||||
}
|
||||
const latency = props.latency
|
||||
return (
|
||||
<div className={styles.root}>
|
||||
<div className={styles.title}>
|
||||
<b>Latency</b>
|
||||
<HelpTooltip size="small">
|
||||
<HelpTooltipText>
|
||||
Latency from relay servers, used when connections cannot connect
|
||||
peer-to-peer. Star indicates the preferred relay.
|
||||
</HelpTooltipText>
|
||||
</HelpTooltip>
|
||||
</div>
|
||||
{Object.keys(latency)
|
||||
.sort()
|
||||
.map((region) => {
|
||||
const value = latency[region]
|
||||
return (
|
||||
<div key={region} className={styles.region}>
|
||||
<b>{region}:</b> {Math.round(value.latency_ms * 100) / 100}{" "}
|
||||
ms
|
||||
{value.preferred && <StarIcon className={styles.star} />}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
root: {
|
||||
display: "grid",
|
||||
gap: 6,
|
||||
},
|
||||
title: {
|
||||
fontSize: "Something",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
// This ensures that the latency aligns with other columns in the grid.
|
||||
height: 20,
|
||||
},
|
||||
region: {
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
},
|
||||
star: {
|
||||
width: 14,
|
||||
height: 14,
|
||||
marginLeft: 4,
|
||||
},
|
||||
}))
|
||||
Reference in New Issue
Block a user