Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions coderd/audit/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ func (nop) Export(context.Context, database.AuditLog) error {
return nil
}

func (nop) diff(any, any) Map { return Map{} }
func (nop) diff(any, any) Map {
return Map{}
}

func NewMock() *MockAuditor {
return &MockAuditor{}
Expand All @@ -36,4 +38,6 @@ func (a *MockAuditor) Export(_ context.Context, alog database.AuditLog) error {
return nil
}

func (*MockAuditor) diff(any, any) Map { return Map{} }
func (*MockAuditor) diff(any, any) Map {
return Map{}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ export const WorkspaceSchedulePage: React.FC = () => {
onSubmit={(values) => {
scheduleSend({
type: "SUBMIT_SCHEDULE",
autoStart: formValuesToAutoStartRequest(values),
autoStart: values.autoStartEnabled
? formValuesToAutoStartRequest(values)
: undefined,
ttl: formValuesToTTLRequest(values),
})
}}
Expand Down
8 changes: 7 additions & 1 deletion site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,13 @@ export const MockAuditLog: TypesGen.AuditLog = {
resource_target: "bruno-dev",
resource_icon: "",
action: "create",
diff: {},
diff: {
ttl: {
old: 0,
new: 3600000000000,
secret: false,
},
},
status_code: 200,
additional_fields: "",
description: "{user} updated workspace {target}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type WorkspaceScheduleEvent =
| { type: "GET_WORKSPACE"; username: string; workspaceName: string }
| {
type: "SUBMIT_SCHEDULE"
autoStart: TypesGen.UpdateWorkspaceAutostartRequest
autoStart: TypesGen.UpdateWorkspaceAutostartRequest | undefined
ttl: TypesGen.UpdateWorkspaceTTLRequest
}

Expand Down Expand Up @@ -195,10 +195,9 @@ export const workspaceSchedule = createMachine(
throw new Error("Failed to load workspace.")
}

// REMARK: These calls are purposefully synchronous because if one
// value contradicts the other, we don't want a race condition
// on re-submission.
await API.putWorkspaceAutostart(context.workspace.id, event.autoStart)
if (event.autoStart?.schedule !== undefined) {
await API.putWorkspaceAutostart(context.workspace.id, event.autoStart)
}
await API.putWorkspaceAutostop(context.workspace.id, event.ttl)
},
},
Expand Down