File tree 2 files changed +36
-5
lines changed
site/src/components/AuditLogRow
2 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,25 @@ export const BuildAuditDescription: FC<{ auditLog: AuditLog }> = ({
10
10
const { t } = useTranslation ( "auditLog" )
11
11
12
12
const workspaceName = auditLog . additional_fields ?. workspace_name ?. trim ( )
13
- // workspaces can be started/stopped by a user, or kicked off automatically by Coder
13
+ // workspaces can be started/stopped/deleted by a user, or kicked off automatically by Coder
14
14
const user =
15
15
auditLog . additional_fields ?. build_reason &&
16
16
auditLog . additional_fields ?. build_reason !== "initiator"
17
17
? "Coder automatically"
18
18
: auditLog . user ?. username . trim ( )
19
19
20
- const action = auditLog . action === "start" ? "started" : "stopped"
20
+ const action : string = ( ( ) => {
21
+ switch ( auditLog . action ) {
22
+ case "start" :
23
+ return "started"
24
+ case "stop" :
25
+ return "stopped"
26
+ case "delete" :
27
+ return "deleted"
28
+ default :
29
+ return auditLog . action
30
+ }
31
+ } ) ( )
21
32
22
33
if ( auditLog . resource_link ) {
23
34
return (
Original file line number Diff line number Diff line change @@ -64,9 +64,29 @@ WithLongDiffRow.args = {
64
64
defaultIsDiffOpen : true ,
65
65
}
66
66
67
- export const WithWorkspaceBuild = Template . bind ( { } )
68
- WithWorkspaceBuild . args = {
69
- auditLog : MockAuditLogWithWorkspaceBuild ,
67
+ export const WithStoppedWorkspaceBuild = Template . bind ( { } )
68
+ WithStoppedWorkspaceBuild . args = {
69
+ auditLog : {
70
+ ...MockAuditLogWithWorkspaceBuild ,
71
+ action : "stop" ,
72
+ } ,
73
+ }
74
+
75
+ export const WithStartedWorkspaceBuild = Template . bind ( { } )
76
+ WithStartedWorkspaceBuild . args = {
77
+ auditLog : {
78
+ ...MockAuditLogWithWorkspaceBuild ,
79
+ action : "start" ,
80
+ } ,
81
+ }
82
+
83
+ export const WithDeletedWorkspaceBuild = Template . bind ( { } )
84
+ WithDeletedWorkspaceBuild . args = {
85
+ auditLog : {
86
+ ...MockAuditLogWithWorkspaceBuild ,
87
+ action : "delete" ,
88
+ is_deleted : true ,
89
+ } ,
70
90
}
71
91
72
92
export const DeletedResource = Template . bind ( { } )
You can’t perform that action at this time.
0 commit comments