@@ -18,6 +18,7 @@ import { Avatar } from "components/Avatar/Avatar";
18
18
import { AvatarData } from "components/Avatar/AvatarData" ;
19
19
import { AvatarDataSkeleton } from "components/Avatar/AvatarDataSkeleton" ;
20
20
import { Button } from "components/Button/Button" ;
21
+ import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog" ;
21
22
import { ExternalImage } from "components/ExternalImage/ExternalImage" ;
22
23
import { VSCodeIcon } from "components/Icons/VSCodeIcon" ;
23
24
import { VSCodeInsidersIcon } from "components/Icons/VSCodeInsidersIcon" ;
@@ -49,6 +50,7 @@ import {
49
50
BanIcon ,
50
51
PlayIcon ,
51
52
RefreshCcwIcon ,
53
+ SquareIcon ,
52
54
SquareTerminalIcon ,
53
55
} from "lucide-react" ;
54
56
import {
@@ -74,6 +76,7 @@ import {
74
76
type PropsWithChildren ,
75
77
type ReactNode ,
76
78
useMemo ,
79
+ useState ,
77
80
} from "react" ;
78
81
import { useMutation , useQuery , useQueryClient } from "react-query" ;
79
82
import { useNavigate } from "react-router-dom" ;
@@ -491,6 +494,9 @@ const WorkspaceActionsCell: FC<WorkspaceActionsCellProps> = ({
491
494
onError : onActionError ,
492
495
} ) ;
493
496
497
+ // State for stop confirmation dialog
498
+ const [ isStopConfirmOpen , setIsStopConfirmOpen ] = useState ( false ) ;
499
+
494
500
const isRetrying =
495
501
startWorkspaceMutation . isPending ||
496
502
stopWorkspaceMutation . isPending ||
@@ -535,6 +541,16 @@ const WorkspaceActionsCell: FC<WorkspaceActionsCellProps> = ({
535
541
</ PrimaryAction >
536
542
) }
537
543
544
+ { abilities . actions . includes ( "stop" ) && (
545
+ < PrimaryAction
546
+ onClick = { ( ) => setIsStopConfirmOpen ( true ) }
547
+ isLoading = { stopWorkspaceMutation . isPending }
548
+ label = "Stop workspace"
549
+ >
550
+ < SquareIcon />
551
+ </ PrimaryAction >
552
+ ) }
553
+
538
554
{ abilities . actions . includes ( "updateAndStart" ) && (
539
555
< >
540
556
< PrimaryAction
@@ -573,6 +589,21 @@ const WorkspaceActionsCell: FC<WorkspaceActionsCellProps> = ({
573
589
disabled = { ! abilities . canAcceptJobs }
574
590
/>
575
591
</ div >
592
+
593
+ { /* Stop workspace confirmation dialog */ }
594
+ < ConfirmDialog
595
+ open = { isStopConfirmOpen }
596
+ title = "Stop workspace"
597
+ description = { `Are you sure you want to stop the workspace "${ workspace . name } "? This will terminate all running processes and disconnect any active sessions.` }
598
+ confirmText = "Stop"
599
+ onClose = { ( ) => setIsStopConfirmOpen ( false ) }
600
+ onConfirm = { ( ) => {
601
+ stopWorkspaceMutation . mutate ( { } ) ;
602
+ setIsStopConfirmOpen ( false ) ;
603
+ } }
604
+ type = "delete"
605
+ loading = { stopWorkspaceMutation . isPending }
606
+ />
576
607
</ TableCell >
577
608
) ;
578
609
} ;
0 commit comments