@@ -3,6 +3,7 @@ import Button from "@mui/material/Button";
33import Collapse from "@mui/material/Collapse" ;
44import Divider from "@mui/material/Divider" ;
55import Skeleton from "@mui/material/Skeleton" ;
6+ import { API } from "api/api" ;
67import { xrayScan } from "api/queries/integrations" ;
78import type {
89 Template ,
@@ -25,6 +26,7 @@ import {
2526import { useQuery } from "react-query" ;
2627import AutoSizer from "react-virtualized-auto-sizer" ;
2728import type { FixedSizeList as List , ListOnScrollProps } from "react-window" ;
29+ import { AgentDevcontainerCard } from "./AgentDevcontainerCard" ;
2830import { AgentLatency } from "./AgentLatency" ;
2931import { AGENT_LOG_LINE_HEIGHT } from "./AgentLogs/AgentLogLine" ;
3032import { AgentLogs } from "./AgentLogs/AgentLogs" ;
@@ -35,7 +37,7 @@ import { AgentVersion } from "./AgentVersion";
3537import { AppLink } from "./AppLink/AppLink" ;
3638import { DownloadAgentLogsButton } from "./DownloadAgentLogsButton" ;
3739import { PortForwardButton } from "./PortForwardButton" ;
38- import { SSHButton } from "./SSHButton/SSHButton" ;
40+ import { AgentSSHButton } from "./SSHButton/SSHButton" ;
3941import { TerminalLink } from "./TerminalLink/TerminalLink" ;
4042import { VSCodeDesktopButton } from "./VSCodeDesktopButton/VSCodeDesktopButton" ;
4143import { XRayScanAlert } from "./XRayScanAlert" ;
@@ -152,6 +154,18 @@ export const AgentRow: FC<AgentRowProps> = ({
152154 setBottomOfLogs ( distanceFromBottom < AGENT_LOG_LINE_HEIGHT ) ;
153155 } , [ ] ) ;
154156
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+
155169 return (
156170 < Stack
157171 key = { agent . id }
@@ -191,14 +205,13 @@ export const AgentRow: FC<AgentRowProps> = ({
191205 { showBuiltinApps && (
192206 < div css = { { display : "flex" } } >
193207 { ! hideSSHButton && agent . display_apps . includes ( "ssh_helper" ) && (
194- < SSHButton
208+ < AgentSSHButton
195209 workspaceName = { workspace . name }
196210 agentName = { agent . name }
197211 sshPrefix = { sshPrefix }
198212 />
199213 ) }
200- { proxy . preferredWildcardHostname &&
201- proxy . preferredWildcardHostname !== "" &&
214+ { proxy . preferredWildcardHostname !== "" &&
202215 agent . display_apps . includes ( "port_forwarding_helper" ) && (
203216 < PortForwardButton
204217 host = { proxy . preferredWildcardHostname }
@@ -267,6 +280,22 @@ export const AgentRow: FC<AgentRowProps> = ({
267280 </ section >
268281 ) }
269282
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+
270299 < AgentMetadata
271300 storybookMetadata = { storybookAgentMetadata }
272301 agent = { agent }
0 commit comments