@@ -3,6 +3,7 @@ import Button from "@mui/material/Button";
3
3
import Collapse from "@mui/material/Collapse" ;
4
4
import Divider from "@mui/material/Divider" ;
5
5
import Skeleton from "@mui/material/Skeleton" ;
6
+ import { API } from "api/api" ;
6
7
import { xrayScan } from "api/queries/integrations" ;
7
8
import type {
8
9
Template ,
@@ -25,6 +26,7 @@ import {
25
26
import { useQuery } from "react-query" ;
26
27
import AutoSizer from "react-virtualized-auto-sizer" ;
27
28
import type { FixedSizeList as List , ListOnScrollProps } from "react-window" ;
29
+ import { AgentDevcontainerCard } from "./AgentDevcontainerCard" ;
28
30
import { AgentLatency } from "./AgentLatency" ;
29
31
import { AGENT_LOG_LINE_HEIGHT } from "./AgentLogs/AgentLogLine" ;
30
32
import { AgentLogs } from "./AgentLogs/AgentLogs" ;
@@ -35,7 +37,7 @@ import { AgentVersion } from "./AgentVersion";
35
37
import { AppLink } from "./AppLink/AppLink" ;
36
38
import { DownloadAgentLogsButton } from "./DownloadAgentLogsButton" ;
37
39
import { PortForwardButton } from "./PortForwardButton" ;
38
- import { SSHButton } from "./SSHButton/SSHButton" ;
40
+ import { AgentSSHButton } from "./SSHButton/SSHButton" ;
39
41
import { TerminalLink } from "./TerminalLink/TerminalLink" ;
40
42
import { VSCodeDesktopButton } from "./VSCodeDesktopButton/VSCodeDesktopButton" ;
41
43
import { XRayScanAlert } from "./XRayScanAlert" ;
@@ -152,6 +154,18 @@ export const AgentRow: FC<AgentRowProps> = ({
152
154
setBottomOfLogs ( distanceFromBottom < AGENT_LOG_LINE_HEIGHT ) ;
153
155
} , [ ] ) ;
154
156
157
+ const { data : containers } = useQuery ( {
158
+ queryKey : [ "agents" , agent . id , "containers" ] ,
159
+ queryFn : ( ) =>
160
+ // Only return devcontainers
161
+ API . getAgentContainers ( agent . id , [
162
+ "devcontainer.config_file=" ,
163
+ "devcontainer.local_folder=" ,
164
+ ] ) ,
165
+ enabled : agent . status === "connected" ,
166
+ select : ( res ) => res . containers . filter ( ( c ) => c . status === "running" ) ,
167
+ } ) ;
168
+
155
169
return (
156
170
< Stack
157
171
key = { agent . id }
@@ -191,14 +205,13 @@ export const AgentRow: FC<AgentRowProps> = ({
191
205
{ showBuiltinApps && (
192
206
< div css = { { display : "flex" } } >
193
207
{ ! hideSSHButton && agent . display_apps . includes ( "ssh_helper" ) && (
194
- < SSHButton
208
+ < AgentSSHButton
195
209
workspaceName = { workspace . name }
196
210
agentName = { agent . name }
197
211
sshPrefix = { sshPrefix }
198
212
/>
199
213
) }
200
- { proxy . preferredWildcardHostname &&
201
- proxy . preferredWildcardHostname !== "" &&
214
+ { proxy . preferredWildcardHostname !== "" &&
202
215
agent . display_apps . includes ( "port_forwarding_helper" ) && (
203
216
< PortForwardButton
204
217
host = { proxy . preferredWildcardHostname }
@@ -267,6 +280,22 @@ export const AgentRow: FC<AgentRowProps> = ({
267
280
</ section >
268
281
) }
269
282
283
+ { containers && containers . length > 0 && (
284
+ < section className = "flex flex-col gap-4" >
285
+ { containers . map ( ( container ) => {
286
+ return (
287
+ < AgentDevcontainerCard
288
+ key = { container . id }
289
+ container = { container }
290
+ workspace = { workspace }
291
+ wildcardHostname = { proxy . preferredWildcardHostname }
292
+ agentName = { agent . name }
293
+ />
294
+ ) ;
295
+ } ) }
296
+ </ section >
297
+ ) }
298
+
270
299
< AgentMetadata
271
300
storybookMetadata = { storybookAgentMetadata }
272
301
agent = { agent }
0 commit comments