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
feat: better display secret audit values
  • Loading branch information
Kira-Pilot committed Jan 19, 2023
commit f7f4e0549bc9081b6ac622daf7a82a12a3096c61
4 changes: 2 additions & 2 deletions site/src/components/AuditLogRow/AuditLogDiff.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const AuditLogDiff: FC<{ diff: AuditLog["diff"] }> = ({ diff }) => {
styles.diffValueOld,
])}
>
{getDiffValue(valueDiff.old)}
{valueDiff.secret ? "••••••••" : getDiffValue(valueDiff.old)}
</span>
</div>
</div>
Expand All @@ -60,7 +60,7 @@ export const AuditLogDiff: FC<{ diff: AuditLog["diff"] }> = ({ diff }) => {
styles.diffValueNew,
])}
>
{getDiffValue(valueDiff.new)}
{valueDiff.secret ? "••••••••" : getDiffValue(valueDiff.new)}
</span>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions site/src/components/AuditLogRow/AuditLogRow.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
MockAuditLog2,
MockAuditLogWithWorkspaceBuild,
MockAuditLogWithDeletedResource,
MockAuditLogGitSSH,
} from "testHelpers/entities"
import { AuditLogRow, AuditLogRowProps } from "./AuditLogRow"

Expand Down Expand Up @@ -72,3 +73,8 @@ export const DeletedResource = Template.bind({})
DeletedResource.args = {
auditLog: MockAuditLogWithDeletedResource,
}

export const SecretDiffValue = Template.bind({})
SecretDiffValue.args = {
auditLog: MockAuditLogGitSSH,
}
16 changes: 16 additions & 0 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,22 @@ export const MockAuditLogWithDeletedResource: TypesGen.AuditLog = {
is_deleted: true,
}

export const MockAuditLogGitSSH: TypesGen.AuditLog = {
...MockAuditLog,
diff: {
private_key: {
old: "",
new: "",
secret: true,
},
public_key: {
old: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRUPjBSNtOAnL22+r07OSu9t3Lnm8/5OX8bRHECKS9g\n",
new: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEwoUPJPMekuSzMZyV0rA82TGGNzw/Uj/dhLbwiczTpV\n",
secret: false,
},
},
}

export const MockWorkspaceQuota: TypesGen.WorkspaceQuota = {
credits_consumed: 0,
budget: 100,
Expand Down