@@ -2,6 +2,7 @@ import Button from "@material-ui/core/Button"
2
2
import { makeStyles } from "@material-ui/core/styles"
3
3
import CancelIcon from "@material-ui/icons/Cancel"
4
4
import CloudDownloadIcon from "@material-ui/icons/CloudDownload"
5
+ import DeleteIcon from "@material-ui/icons/Delete"
5
6
import PlayArrowRoundedIcon from "@material-ui/icons/PlayArrowRounded"
6
7
import StopIcon from "@material-ui/icons/Stop"
7
8
import { FC } from "react"
@@ -15,6 +16,8 @@ export const Language = {
15
16
stopping : "Stopping workspace" ,
16
17
start : "Start workspace" ,
17
18
starting : "Starting workspace" ,
19
+ delete : "Delete workspace" ,
20
+ deleting : "Deleting workspace" ,
18
21
cancel : "Cancel action" ,
19
22
update : "Update workspace" ,
20
23
}
@@ -38,10 +41,14 @@ const canStart = (workspaceStatus: WorkspaceStatus) => ["stopped", "canceled", "
38
41
39
42
const canStop = ( workspaceStatus : WorkspaceStatus ) => [ "started" , "canceled" , "error" ] . includes ( workspaceStatus )
40
43
44
+ const canDelete = ( workspaceStatus : WorkspaceStatus ) =>
45
+ [ "started" , "stopped" , "canceled" , "error" ] . includes ( workspaceStatus )
46
+
41
47
export interface WorkspaceActionsProps {
42
48
workspace : Workspace
43
49
handleStart : ( ) => void
44
50
handleStop : ( ) => void
51
+ handleDelete : ( ) => void
45
52
handleUpdate : ( ) => void
46
53
handleCancel : ( ) => void
47
54
}
@@ -50,6 +57,7 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
50
57
workspace,
51
58
handleStart,
52
59
handleStop,
60
+ handleDelete,
53
61
handleUpdate,
54
62
handleCancel,
55
63
} ) => {
@@ -74,6 +82,14 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
74
82
label = { Language . stop }
75
83
/>
76
84
) }
85
+ { canDelete ( workspaceStatus ) && (
86
+ < WorkspaceActionButton
87
+ className = { styles . actionButton }
88
+ icon = { < DeleteIcon /> }
89
+ onClick = { handleDelete }
90
+ label = { Language . delete }
91
+ />
92
+ ) }
77
93
{ canCancelJobs ( workspaceStatus ) && (
78
94
< WorkspaceActionButton
79
95
className = { styles . actionButton }
0 commit comments