diff --git a/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/AuditLogDescription.tsx b/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/AuditLogDescription.tsx index 51d4e8ec910d9..4b2a9b4df4df7 100644 --- a/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/AuditLogDescription.tsx +++ b/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/AuditLogDescription.tsx @@ -11,12 +11,15 @@ interface AuditLogDescriptionProps { export const AuditLogDescription: FC = ({ auditLog, }) => { - let target = auditLog.resource_target.trim(); - let user = auditLog.user?.username.trim(); - if (auditLog.resource_type === "workspace_build") { return ; } + if (auditLog.additional_fields?.connection_type) { + return ; + } + + let target = auditLog.resource_target.trim(); + let user = auditLog.user?.username.trim(); // SSH key entries have no links if (auditLog.resource_type === "git_ssh_key") { @@ -57,3 +60,19 @@ export const AuditLogDescription: FC = ({ ); }; + +function AppSessionAuditLogDescription({ auditLog }: AuditLogDescriptionProps) { + const { connection_type, workspace_owner, workspace_name } = + auditLog.additional_fields; + + return ( + <> + {connection_type} session to {workspace_owner}'s{" "} + + {workspace_name} + {" "} + workspace{" "} + {auditLog.action === "disconnect" ? "closed" : "opened"} + + ); +} diff --git a/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.stories.tsx b/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.stories.tsx index 12d57b63047e8..8bb45aa39378b 100644 --- a/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.stories.tsx +++ b/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.stories.tsx @@ -159,3 +159,43 @@ export const NoUserAgent: Story = { }, }, }; + +export const WithConnectionType: Story = { + args: { + showOrgDetails: true, + auditLog: { + id: "725ea2f2-faae-4bdd-a821-c2384a67d89c", + request_id: "a486c1cb-6acb-41c9-9bce-1f4f24a2e8ff", + time: "2025-02-24T10:20:08.054072Z", + ip: "fd7a:115c:a1e0:4fa5:9ccd:27e4:5d72:c66a", + user_agent: "", + resource_type: "workspace_agent", + resource_id: "813311fb-bad3-4a92-98cd-09ee57e73d6e", + resource_target: "main", + resource_icon: "", + action: "disconnect", + diff: {}, + status_code: 255, + additional_fields: { + reason: "process exited with error status: -1", + build_number: "1", + build_reason: "initiator", + workspace_id: "6a7cfb32-d208-47bb-91d0-ec54b69912b6", + workspace_name: "test2", + connection_type: "SSH", + workspace_owner: "admin", + }, + description: "{user} disconnected workspace agent {target}", + resource_link: "", + is_deleted: false, + organization_id: "0e6fa63f-b625-4a6f-ab5b-a8217f8c80b3", + organization: { + id: "0e6fa63f-b625-4a6f-ab5b-a8217f8c80b3", + name: "coder", + display_name: "Coder", + icon: "", + }, + user: null, + }, + }, +}; diff --git a/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx b/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx index 909fb7cf5646e..e5145ea86c966 100644 --- a/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx +++ b/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx @@ -128,6 +128,8 @@ export const AuditLogRow: FC = ({ + + {/* With multi-org, there is not enough space so show everything in a tooltip. */} {showOrgDetails ? ( @@ -169,6 +171,12 @@ export const AuditLogRow: FC = ({ )} + {auditLog.additional_fields?.reason && ( +
+

Reason:

+
{auditLog.additional_fields?.reason}
+
+ )} } > @@ -203,13 +211,6 @@ export const AuditLogRow: FC = ({ )}
)} - - - {auditLog.status_code.toString()} - @@ -218,7 +219,7 @@ export const AuditLogRow: FC = ({ {shouldDisplayDiff ? (
{}
) : ( -
+
)} @@ -232,6 +233,19 @@ export const AuditLogRow: FC = ({ ); }; +function StatusPill({ code }: { code: number }) { + const isHttp = code >= 100; + + return ( + + {code.toString()} + + ); +} + const styles = { auditLogCell: { padding: "0 !important", @@ -287,7 +301,7 @@ const styles = { width: "100%", }, - httpStatusPill: { + statusCodePill: { fontSize: 10, height: 20, paddingLeft: 10, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy