1
1
import Link from "@mui/material/Link" ;
2
2
import Tooltip , { type TooltipProps } from "@mui/material/Tooltip" ;
3
- import type {
4
- Workspace ,
5
- WorkspaceAgentDevcontainer ,
6
- WorkspaceAgentDevcontainerPort ,
7
- } from "api/typesGenerated" ;
3
+ import type { Workspace , WorkspaceAgentDevcontainer } from "api/typesGenerated" ;
8
4
import { ExternalLinkIcon } from "lucide-react" ;
9
5
import type { FC } from "react" ;
10
6
import { portForwardURL } from "utils/portForward" ;
@@ -58,6 +54,16 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
58
54
const helperText = hasHostBind
59
55
?`${ port . host_ip } :${ port . host_port } `
60
56
:"Not bound to host" ;
57
+ const linkDest = hasHostBind
58
+ ?portForwardURL (
59
+ wildcardHostname ,
60
+ port . host_port ! ,
61
+ agentName ,
62
+ workspace . name ,
63
+ workspace . owner_name ,
64
+ location . protocol === "https" ?"https" :"http" ,
65
+ )
66
+ :"" ;
61
67
return (
62
68
< Tooltip key = { portLabel } title = { helperText } >
63
69
< span >
@@ -68,14 +74,7 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
68
74
underline = "none"
69
75
startIcon = { < ExternalLinkIcon className = "size-icon-sm" /> }
70
76
disabled = { ! hasHostBind }
71
- href = { portForwardURL (
72
- wildcardHostname ,
73
- port . host_port ! ,
74
- agentName ,
75
- workspace . name ,
76
- workspace . owner_name ,
77
- location . protocol === "https" ?"https" :"http" ,
78
- ) }
77
+ href = { linkDest }
79
78
>
80
79
{ portLabel }
81
80
</ Link >