@@ -19,7 +19,6 @@ import {
19
19
useRef ,
20
20
useState ,
21
21
} from "react"
22
- import { useTranslation } from "react-i18next"
23
22
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"
24
23
import { darcula } from "react-syntax-highlighter/dist/cjs/styles/prism"
25
24
import AutoSizer from "react-virtualized-auto-sizer"
@@ -41,8 +40,8 @@ import { Stack } from "../Stack/Stack"
41
40
import { TerminalLink } from "../TerminalLink/TerminalLink"
42
41
import { AgentLatency } from "./AgentLatency"
43
42
import { AgentMetadata } from "./AgentMetadata"
44
- import { AgentStatus } from "./AgentStatus"
45
43
import { AgentVersion } from "./AgentVersion"
44
+ import { AgentStatus } from "./AgentStatus"
46
45
47
46
export interface AgentRowProps {
48
47
agent : WorkspaceAgent
@@ -72,7 +71,6 @@ export const AgentRow: FC<AgentRowProps> = ({
72
71
sshPrefix,
73
72
} ) => {
74
73
const styles = useStyles ( )
75
- const { t } = useTranslation ( "agent" )
76
74
const [ logsMachine , sendLogsEvent ] = useMachine ( workspaceAgentLogsMachine , {
77
75
context : { agentID : agent . id } ,
78
76
services : process . env . STORYBOOK
@@ -89,7 +87,11 @@ export const AgentRow: FC<AgentRowProps> = ({
89
87
const theme = useTheme ( )
90
88
const startupScriptAnchorRef = useRef < HTMLButtonElement > ( null )
91
89
const [ startupScriptOpen , setStartupScriptOpen ] = useState ( false )
92
-
90
+ const hasAppsToDisplay = ! hideVSCodeDesktopButton || agent . apps . length > 0
91
+ const shouldDisplayApps =
92
+ showApps &&
93
+ ( ( agent . status === "connected" && hasAppsToDisplay ) ||
94
+ agent . status === "connecting" )
93
95
const hasStartupFeatures =
94
96
Boolean ( agent . startup_logs_length ) ||
95
97
Boolean ( logsMachine . context . startupLogs ?. length )
@@ -173,6 +175,7 @@ export const AgentRow: FC<AgentRowProps> = ({
173
175
className = { combineClasses ( [
174
176
styles . agentRow ,
175
177
styles [ `agentRow-${ agent . status } ` ] ,
178
+ styles [ `agentRow-lifecycle-${ agent . lifecycle_state } ` ] ,
176
179
] ) }
177
180
>
178
181
< Stack
@@ -183,18 +186,14 @@ export const AgentRow: FC<AgentRowProps> = ({
183
186
>
184
187
< div className = { styles . agentNameAndStatus } >
185
188
< Stack alignItems = "center" direction = "row" spacing = { 3 } >
189
+ < AgentStatus agent = { agent } />
186
190
< div className = { styles . agentName } > { agent . name } </ div >
187
191
< Stack
188
192
direction = "row"
189
193
spacing = { 2 }
190
194
alignItems = "baseline"
191
195
className = { styles . agentDescription }
192
196
>
193
- { agent . status === "timeout" && (
194
- < div className = { styles . agentErrorMessage } >
195
- { t ( "unableToConnect" ) }
196
- </ div >
197
- ) }
198
197
{ agent . status === "connected" && (
199
198
< >
200
199
< span className = { styles . agentOS } >
@@ -262,14 +261,9 @@ export const AgentRow: FC<AgentRowProps> = ({
262
261
) }
263
262
</ Stack >
264
263
265
- < div className = { styles . agentMetadata } >
266
- < AgentMetadata
267
- storybookMetadata = { storybookAgentMetadata }
268
- agent = { agent }
269
- />
270
- </ div >
264
+ < AgentMetadata storybookMetadata = { storybookAgentMetadata } agent = { agent } />
271
265
272
- { showApps && (
266
+ { shouldDisplayApps && (
273
267
< div className = { styles . apps } >
274
268
{ agent . status === "connected" && (
275
269
< >
@@ -419,22 +413,60 @@ const useStyles = makeStyles((theme) => ({
419
413
backgroundColor : theme . palette . background . paperLight ,
420
414
fontSize : 16 ,
421
415
borderLeft : `2px solid ${ theme . palette . text . secondary } ` ,
416
+
417
+ "&:not(:first-child)" : {
418
+ borderTop : `2px solid ${ theme . palette . divider } ` ,
419
+ } ,
422
420
} ,
423
421
424
422
"agentRow-connected" : {
425
- borderColor : theme . palette . success . light ,
423
+ borderLeftColor : theme . palette . success . light ,
426
424
} ,
427
425
428
426
"agentRow-disconnected" : {
429
- borderColor : theme . palette . text . secondary ,
427
+ borderLeftColor : theme . palette . text . secondary ,
430
428
} ,
431
429
432
430
"agentRow-connecting" : {
433
- borderColor : theme . palette . info . light ,
431
+ borderLeftColor : theme . palette . info . light ,
434
432
} ,
435
433
436
434
"agentRow-timeout" : {
437
- borderColor : theme . palette . warning . light ,
435
+ borderLeftColor : theme . palette . warning . light ,
436
+ } ,
437
+
438
+ "agentRow-lifecycle-created" : { } ,
439
+
440
+ "agentRow-lifecycle-starting" : {
441
+ borderLeftColor : theme . palette . info . light ,
442
+ } ,
443
+
444
+ "agentRow-lifecycle-ready" : {
445
+ borderLeftColor : theme . palette . success . light ,
446
+ } ,
447
+
448
+ "agentRow-lifecycle-start_timeout" : {
449
+ borderLeftColor : theme . palette . warning . light ,
450
+ } ,
451
+
452
+ "agentRow-lifecycle-start_error" : {
453
+ borderLeftColor : theme . palette . error . light ,
454
+ } ,
455
+
456
+ "agentRow-lifecycle-shutting_down" : {
457
+ borderLeftColor : theme . palette . info . light ,
458
+ } ,
459
+
460
+ "agentRow-lifecycle-shutdown_timeout" : {
461
+ borderLeftColor : theme . palette . warning . light ,
462
+ } ,
463
+
464
+ "agentRow-lifecycle-shutdown_error" : {
465
+ borderLeftColor : theme . palette . error . light ,
466
+ } ,
467
+
468
+ "agentRow-lifecycle-off" : {
469
+ borderLeftColor : theme . palette . text . secondary ,
438
470
} ,
439
471
440
472
agentInfo : {
@@ -564,10 +596,4 @@ const useStyles = makeStyles((theme) => ({
564
596
agentOS : {
565
597
textTransform : "capitalize" ,
566
598
} ,
567
-
568
- agentMetadata : {
569
- padding : theme . spacing ( 2.5 , 4 ) ,
570
- borderTop : `1px solid ${ theme . palette . divider } ` ,
571
- background : theme . palette . background . paper ,
572
- } ,
573
599
} ) )
0 commit comments