mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: change build audit log string to be clearer (#6093)
* changed bbuild string * clean up friendly string * using Trans component * general cleanup * fixed tests * fix lint * fixing bolding * removing dead strings in auditLogRow * fix tests
This commit is contained in:
+2
-15
@@ -244,13 +244,13 @@ func (api *API) convertAuditLog(ctx context.Context, dblog database.GetAuditLogs
|
||||
StatusCode: dblog.StatusCode,
|
||||
AdditionalFields: dblog.AdditionalFields,
|
||||
User: user,
|
||||
Description: auditLogDescription(dblog, additionalFields),
|
||||
Description: auditLogDescription(dblog),
|
||||
ResourceLink: resourceLink,
|
||||
IsDeleted: isDeleted,
|
||||
}
|
||||
}
|
||||
|
||||
func auditLogDescription(alog database.GetAuditLogsOffsetRow, additionalFields audit.AdditionalFields) string {
|
||||
func auditLogDescription(alog database.GetAuditLogsOffsetRow) string {
|
||||
str := fmt.Sprintf("{user} %s",
|
||||
codersdk.AuditAction(alog.Action).Friendly(),
|
||||
)
|
||||
@@ -261,19 +261,6 @@ func auditLogDescription(alog database.GetAuditLogsOffsetRow, additionalFields a
|
||||
return str
|
||||
}
|
||||
|
||||
// Strings for starting/stopping workspace builds follow the below format:
|
||||
// "{user | 'Coder automatically'} started build #{build_number} for workspace {target}"
|
||||
// where target is a workspace (name) instead of a workspace build
|
||||
// passed in on the FE via AuditLog.AdditionalFields rather than derived in request.go:35
|
||||
if alog.ResourceType == database.ResourceTypeWorkspaceBuild && alog.Action != database.AuditActionDelete {
|
||||
if len(additionalFields.BuildNumber) == 0 {
|
||||
str += " build for"
|
||||
} else {
|
||||
str += fmt.Sprintf(" build #%s for",
|
||||
additionalFields.BuildNumber)
|
||||
}
|
||||
}
|
||||
|
||||
// We don't display the name (target) for git ssh keys. It's fairly long and doesn't
|
||||
// make too much sense to display.
|
||||
if alog.ResourceType == database.ResourceTypeGitSshKey {
|
||||
|
||||
Reference in New Issue
Block a user