feat: add workspace build start/stop to audit log (#4744)

* adding workspace_build resource

* added migration

* fix keyword

* got rid oof diffs for workspace builds

* adding workspace name to string

* renamed migrations

* fixed lint

* pass throough AdditionalFields and fix tests

* no need to pass through each handler

* cleaned up migrations

* generated types; fixed missing cases

* logging error
This commit is contained in:
Kira Pilot
2022-10-25 15:34:48 -04:00
committed by GitHub
parent 9070fcd5e7
commit 3c5e292c5a
13 changed files with 131 additions and 32 deletions
+2 -1
View File
@@ -915,7 +915,7 @@ export interface WorkspacesRequest extends Pagination {
export type APIKeyScope = "all" | "application_connect"
// From codersdk/audit.go
export type AuditAction = "create" | "delete" | "write"
export type AuditAction = "create" | "delete" | "start" | "stop" | "write"
// From codersdk/workspacebuilds.go
export type BuildReason = "autostart" | "autostop" | "initiator"
@@ -975,6 +975,7 @@ export type ResourceType =
| "template_version"
| "user"
| "workspace"
| "workspace_build"
// From codersdk/sse.go
export type ServerSentEventType = "data" | "error" | "ping"
@@ -130,13 +130,11 @@ export const AuditLogRow: React.FC<AuditLogRowProps> = ({
</Stack>
</Stack>
<div
className={
shouldDisplayDiff ? undefined : styles.disabledDropdownIcon
}
>
{isDiffOpen ? <CloseDropdown /> : <OpenDropdown />}
</div>
{shouldDisplayDiff ? (
<div> {isDiffOpen ? <CloseDropdown /> : <OpenDropdown />}</div>
) : (
<div className={styles.columnWithoutDiff}></div>
)}
</Stack>
{shouldDisplayDiff && (
@@ -190,8 +188,8 @@ const useStyles = makeStyles((theme) => ({
color: theme.palette.text.secondary,
whiteSpace: "nowrap",
},
disabledDropdownIcon: {
opacity: 0.5,
// offset the absence of the arrow icon on diff-less logs
columnWithoutDiff: {
marginLeft: "24px",
},
}))