- Notifications
You must be signed in to change notification settings - Fork1k
fix(agent/agentcontainers): improve testing of convertDockerInspect, return correct host port#16887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
80ac9a3
0ecceb0
55998d0
fb78d33
a7d1ea4
393f6e9
95b156e
f8f3000
999469f
8338af3
2f0180e
1ae6015
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import Link from "@mui/material/Link"; | ||
import type { | ||
Workspace, | ||
WorkspaceAgentDevcontainer, | ||
WorkspaceAgentDevcontainerPort, | ||
} from "api/typesGenerated"; | ||
import { ExternalLinkIcon } from "lucide-react"; | ||
import type { FC } from "react"; | ||
import { portForwardURL } from "utils/portForward"; | ||
import { AgentButton } from "./AgentButton"; | ||
import { AgentDevcontainerSSHButton } from "./SSHButton/SSHButton"; | ||
import { TerminalLink } from "./TerminalLink/TerminalLink"; | ||
import Tooltip, { type TooltipProps } from "@mui/material/Tooltip"; | ||
type AgentDevcontainerCardProps = { | ||
container: WorkspaceAgentDevcontainer; | ||
@@ -47,25 +52,38 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({ | ||
/> | ||
{wildcardHostname !== "" && | ||
container.ports.map((port) => { | ||
let portLabel = `${port.port}/${port.network.toUpperCase()}`; | ||
let hasHostBind = | ||
port.host_port !== undefined && | ||
port.host_port !== null && | ||
port.host_ip !== undefined && | ||
port.host_ip !== null; | ||
| ||
let helperText = hasHostBind | ||
? `${port.host_ip}:${port.host_port}` | ||
: "Not bound to host"; | ||
return ( | ||
<Tooltip key={portLabel} title={helperText}> | ||
<span> | ||
Comment on lines +68 to +69 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Two questions:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more.
Copy-pasta, most likely!
The tooltip wouldn't display if the link was disabled; the | ||
<Link | ||
key={portLabel} | ||
color="inherit" | ||
component={AgentButton} | ||
underline="none" | ||
startIcon={<ExternalLinkIcon className="size-icon-sm" />} | ||
disabled={!hasHostBind} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Is the value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It could change if the user bound the remote port to a local port and rebuilt the container. My reasoning for including the non-interactive variants was that if they simply didn't show up in the UI, it would be more confusing to users. Having it show up with a tooltip explaining why it was not enabled felt "right" to me. Member
| ||
href={portForwardURL( | ||
wildcardHostname, | ||
port.host_port!, | ||
| ||
agentName, | ||
workspace.name, | ||
workspace.owner_name, | ||
location.protocol === "https" ? "https" : "http", | ||
| ||
)} | ||
> | ||
{portLabel} | ||
</Link> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. @BrunoQuaresma Have we switched over to Shad for link variants like this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It depends. I would not expect BE folks migrating the components to be honest, but in this case I think would make more sense to replace them by the new button component like this: <ButtonasChild><ahref="..."onClick={...}/></Button> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Oh wait, sorry – got mixed up by the diff. Didn't realize the link was already here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I'd suggest we make this a follow-up? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Yeah, that's totally fine with me | ||
</span> | ||
</Tooltip> | ||
); | ||
})} | ||
</div> | ||