@@ -139,68 +139,77 @@ export const AgentDevcontainerCard: FC<AgentDevcontainerCardProps> = ({
139
139
workspace={workspace.name}
140
140
container={devcontainer.container?.name || devcontainer.name}
141
141
/> */ }
142
- { agent . display_apps . includes ( "ssh_helper" ) && ( // TODO agent
142
+ { /* TODO(mafredri): Sub agent display apps. */ }
143
+ { devcontainer . agent && agent . display_apps . includes ( "ssh_helper" ) && (
143
144
< AgentSSHButton
144
145
workspaceName = { workspace . name }
145
- agentName = { devcontainer . name }
146
+ agentName = { devcontainer . agent . name || devcontainer . name }
146
147
workspaceOwnerUsername = { workspace . owner_name }
147
148
/>
148
149
) }
149
150
</ div >
150
151
</ header >
151
152
152
- < h4 className = "m-0 text-xl font-semibold mb-2" > Forwarded ports</ h4 >
153
+ { devcontainer . agent && (
154
+ < >
155
+ < h4 className = "m-0 text-xl font-semibold mb-2" > Forwarded ports</ h4 >
156
+ < div className = "flex gap-4 flex-wrap mt-4" >
157
+ { devcontainer . container && (
158
+ < VSCodeDevContainerButton
159
+ userName = { workspace . owner_name }
160
+ workspaceName = { workspace . name }
161
+ devContainerName = { devcontainer . container . name }
162
+ devContainerFolder = { devcontainer . agent . directory }
163
+ displayApps = { agent . display_apps } // TODO(mafredri): Sub agent display apps.
164
+ agentName = { agent . name } // This must be set to the parent agent.
165
+ />
166
+ ) }
153
167
154
- < div className = "flex gap-4 flex-wrap mt-4" >
155
- < VSCodeDevContainerButton
156
- userName = { workspace . owner_name }
157
- workspaceName = { workspace . name }
158
- devContainerName = { devcontainer . name }
159
- devContainerFolder = { devcontainer . workspace_folder }
160
- displayApps = { agent . display_apps } // TODO agent
161
- agentName = { devcontainer . name }
162
- />
168
+ { devcontainer . agent && (
169
+ < TerminalLink
170
+ workspaceName = { workspace . name }
171
+ agentName = { devcontainer . agent . name }
172
+ userName = { workspace . owner_name }
173
+ />
174
+ ) }
163
175
164
- < TerminalLink
165
- workspaceName = { workspace . name }
166
- agentName = { devcontainer . name }
167
- userName = { workspace . owner_name }
168
- />
169
- { wildcardHostname !== "" &&
170
- devcontainer . container ?. ports . map ( ( port ) => {
171
- const portLabel = `${ port . port } /${ port . network . toUpperCase ( ) } ` ;
172
- const hasHostBind =
173
- port . host_port !== undefined && port . host_ip !== undefined ;
174
- const helperText = hasHostBind
175
- ? `${ port . host_ip } :${ port . host_port } `
176
- : "Not bound to host" ;
177
- const linkDest = hasHostBind
178
- ? portForwardURL (
179
- wildcardHostname ,
180
- port . host_port ,
181
- agent . name ,
182
- workspace . name ,
183
- workspace . owner_name ,
184
- location . protocol === "https" ? "https" : "http" ,
185
- )
186
- : "" ;
187
- return (
188
- < TooltipProvider key = { portLabel } >
189
- < Tooltip >
190
- < TooltipTrigger asChild >
191
- < AgentButton disabled = { ! hasHostBind } asChild >
192
- < a href = { linkDest } >
193
- < ExternalLinkIcon />
194
- { portLabel }
195
- </ a >
196
- </ AgentButton >
197
- </ TooltipTrigger >
198
- < TooltipContent > { helperText } </ TooltipContent >
199
- </ Tooltip >
200
- </ TooltipProvider >
201
- ) ;
202
- } ) }
203
- </ div >
176
+ { wildcardHostname !== "" &&
177
+ devcontainer . container ?. ports . map ( ( port ) => {
178
+ const portLabel = `${ port . port } /${ port . network . toUpperCase ( ) } ` ;
179
+ const hasHostBind =
180
+ port . host_port !== undefined && port . host_ip !== undefined ;
181
+ const helperText = hasHostBind
182
+ ? `${ port . host_ip } :${ port . host_port } `
183
+ : "Not bound to host" ;
184
+ const linkDest = hasHostBind
185
+ ? portForwardURL (
186
+ wildcardHostname ,
187
+ port . host_port ,
188
+ devcontainer . agent ?. name || agent . name ,
189
+ workspace . name ,
190
+ workspace . owner_name ,
191
+ location . protocol === "https" ? "https" : "http" ,
192
+ )
193
+ : "" ;
194
+ return (
195
+ < TooltipProvider key = { portLabel } >
196
+ < Tooltip >
197
+ < TooltipTrigger asChild >
198
+ < AgentButton disabled = { ! hasHostBind } asChild >
199
+ < a href = { linkDest } >
200
+ < ExternalLinkIcon />
201
+ { portLabel }
202
+ </ a >
203
+ </ AgentButton >
204
+ </ TooltipTrigger >
205
+ < TooltipContent > { helperText } </ TooltipContent >
206
+ </ Tooltip >
207
+ </ TooltipProvider >
208
+ ) ;
209
+ } ) }
210
+ </ div >
211
+ </ >
212
+ ) }
204
213
</ section >
205
214
) ;
206
215
} ;
0 commit comments