feat: better display secret audit values (#5801)

This commit is contained in:
Kira Pilot
2023-01-19 17:47:53 -05:00
committed by GitHub
parent 341b7caff6
commit a0a959c7a5
3 changed files with 24 additions and 2 deletions
@@ -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>
@@ -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>
@@ -10,6 +10,7 @@ import {
MockAuditLog2,
MockAuditLogWithWorkspaceBuild,
MockAuditLogWithDeletedResource,
MockAuditLogGitSSH,
} from "testHelpers/entities"
import { AuditLogRow, AuditLogRowProps } from "./AuditLogRow"
@@ -72,3 +73,8 @@ export const DeletedResource = Template.bind({})
DeletedResource.args = {
auditLog: MockAuditLogWithDeletedResource,
}
export const SecretDiffValue = Template.bind({})
SecretDiffValue.args = {
auditLog: MockAuditLogGitSSH,
}
+16
View File
@@ -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,