From 342d2e4bedf60b7d73bf11310e290871986ca874 Mon Sep 17 00:00:00 2001 From: Jake Howell Date: Tue, 10 Feb 2026 16:10:19 +1100 Subject: [PATCH] feat: refactor `` (#22014) This pull-request takes the MUI based components from `` and its subsidiaries and updates them to use the correct newer Tailwind based components. --- .../AuditLogDescription.tsx | 14 +- .../BuildAuditDescription.tsx | 8 +- .../AuditPage/AuditLogRow/AuditLogRow.tsx | 391 ++++++++---------- 3 files changed, 180 insertions(+), 233 deletions(-) diff --git a/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/AuditLogDescription.tsx b/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/AuditLogDescription.tsx index 81f4be9806..7a9346ebd1 100644 --- a/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/AuditLogDescription.tsx +++ b/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/AuditLogDescription.tsx @@ -1,5 +1,5 @@ -import Link from "@mui/material/Link"; import type { AuditLog } from "api/typesGenerated"; +import { Link } from "components/Link/Link"; import type { FC } from "react"; import { Link as RouterLink } from "react-router"; import { BuildAuditDescription } from "./BuildAuditDescription"; @@ -52,8 +52,10 @@ export const AuditLogDescription: FC = ({ {truncatedDescription} {auditLog.resource_link ? ( - - {target} + + + {target} + ) : ( {target} @@ -70,8 +72,10 @@ function AppSessionAuditLogDescription({ auditLog }: AuditLogDescriptionProps) { return ( <> {connection_type} session to {workspace_owner}'s{" "} - - {workspace_name} + + + {workspace_name} + {" "} workspace{" "} {auditLog.action === "disconnect" ? "closed" : "opened"} diff --git a/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/BuildAuditDescription.tsx b/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/BuildAuditDescription.tsx index 1451177e4c..77cab7ee08 100644 --- a/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/BuildAuditDescription.tsx +++ b/site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/BuildAuditDescription.tsx @@ -1,5 +1,5 @@ -import Link from "@mui/material/Link"; import type { AuditLog } from "api/typesGenerated"; +import { Link } from "components/Link/Link"; import { type FC, useMemo } from "react"; import { Link as RouterLink } from "react-router"; import { systemBuildReasons } from "utils/workspace"; @@ -38,8 +38,10 @@ export const BuildAuditDescription: FC = ({ {user} {action} workspace{" "} {auditLog.resource_link ? ( - - {workspaceName} + + + {workspaceName} + ) : ( {workspaceName} diff --git a/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx b/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx index 7611407e56..457018e83b 100644 --- a/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx +++ b/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx @@ -1,10 +1,11 @@ -import type { CSSObject, Interpolation, Theme } from "@emotion/react"; -import Collapse from "@mui/material/Collapse"; -import Link from "@mui/material/Link"; import type { AuditLog, BuildReason } from "api/typesGenerated"; import { Avatar } from "components/Avatar/Avatar"; +import { + Collapsible, + CollapsibleContent, +} from "components/Collapsible/Collapsible"; import { DropdownArrow } from "components/DropdownArrow/DropdownArrow"; -import { Stack } from "components/Stack/Stack"; +import { Link } from "components/Link/Link"; import { StatusPill } from "components/StatusPill/StatusPill"; import { TableCell } from "components/Table/Table"; import { TimelineEntry } from "components/Timeline/TimelineEntry"; @@ -71,246 +72,186 @@ export const AuditLogRow: FC = ({ data-testid={`audit-log-row-${auditLog.id}`} clickable={shouldDisplayDiff} > - - { - if (event.key === "Enter") { - toggle(); - } - }} - > - + +
{ + if (event.key === "Enter") { + toggle(); + } + }} > - - {/* - * Session logs don't have an associated user to the log, - * so when it happens we display a default icon to represent non user actions - */} - {auditLog.user ? ( - - ) : ( - - - - )} +
+
+ {/* + * Session logs don't have an associated user to the log, + * so when it happens we display a default icon to represent non user actions + */} + {auditLog.user ? ( + + ) : ( + + + + )} - - - - {auditLog.is_deleted && ( - (deleted) - )} - - {new Date(auditLog.time).toLocaleTimeString()} - - +
+
+ + {auditLog.is_deleted && ( + + (deleted) + + )} + + {new Date(auditLog.time).toLocaleTimeString()} + +
- - +
+ - {/* With multi-org, there is not enough space so show + {/* With multi-org, there is not enough space so show everything in a tooltip. */} - {showOrgDetails ? ( - - - ({ - color: theme.palette.info.light, - })} - /> - - -
- {auditLog.ip && ( -
-

IP:

-
{auditLog.ip}
-
- )} - {userAgent?.os.name && ( -
-

OS:

-
{userAgent.os.name}
-
- )} - {userAgent?.browser.name && ( -
-

Browser:

+ {showOrgDetails ? ( + + + + + +
+ {auditLog.ip && (
- {userAgent.browser.name}{" "} - {userAgent.browser.version} +

+ IP: +

+
{auditLog.ip}
-
- )} - {auditLog.organization && ( -
-

- Organization: -

- - {auditLog.organization.display_name || - auditLog.organization.name} - -
- )} - {auditLog.additional_fields?.build_reason && - auditLog.action === "start" && ( + )} + {userAgent?.os.name && (
-

Reason:

+

+ OS: +

+
{userAgent.os.name}
+
+ )} + {userAgent?.browser.name && ( +
+

+ Browser: +

- { - buildReasonLabels[ - auditLog.additional_fields - .build_reason as BuildReason - ] - } + {userAgent.browser.name}{" "} + {userAgent.browser.version}
)} -
- - - ) : ( - - {auditLog.ip && ( - - IP: - {auditLog.ip} - - )} - {userAgent?.os.name && ( - - OS: - {userAgent.os.name} - - )} - {userAgent?.browser.name && ( - - Browser: - - {userAgent.browser.name} {userAgent.browser.version} - - - )} - {auditLog.additional_fields?.build_reason && - auditLog.action === "start" && ( - - Reason: + {auditLog.organization && ( +
+

+ Organization: +

+ + + {auditLog.organization.display_name || + auditLog.organization.name} + + +
+ )} + {auditLog.additional_fields?.build_reason && + auditLog.action === "start" && ( +
+

+ Reason: +

+
+ { + buildReasonLabels[ + auditLog.additional_fields + .build_reason as BuildReason + ] + } +
+
+ )} +
+
+
+ ) : ( +
+ {auditLog.ip && ( + + IP: + {auditLog.ip} + + )} + {userAgent?.os.name && ( + + OS: + {userAgent.os.name} + + )} + {userAgent?.browser.name && ( + + Browser: - { - buildReasonLabels[ - auditLog.additional_fields - .build_reason as BuildReason - ] - } + {userAgent.browser.name}{" "} + {userAgent.browser.version} )} - - )} - - - - + {auditLog.additional_fields?.build_reason && + auditLog.action === "start" && ( + + Reason: + + { + buildReasonLabels[ + auditLog.additional_fields + .build_reason as BuildReason + ] + } + + + )} +
+ )} +
+
+
+
- {shouldDisplayDiff ? ( -
{}
- ) : ( -
+ {shouldDisplayDiff ? ( +
+ +
+ ) : ( +
+ )} +
+ + {shouldDisplayDiff && ( + + + )} - - - {shouldDisplayDiff && ( - - - - )} + ); }; - -const styles = { - auditLogCell: { - padding: "0 !important", - border: 0, - }, - - auditLogHeader: { - padding: "16px 32px", - }, - - auditLogHeaderInfo: { - flex: 1, - }, - - auditLogSummary: (theme) => ({ - ...(theme.typography.body1 as CSSObject), - fontFamily: "inherit", - }), - - auditLogTime: (theme) => ({ - color: theme.palette.text.secondary, - fontSize: 12, - }), - - auditLogInfo: (theme) => ({ - ...(theme.typography.body2 as CSSObject), - fontSize: 12, - fontFamily: "inherit", - color: theme.palette.text.secondary, - display: "block", - }), - - auditLogInfoHeader: (theme) => ({ - margin: 0, - color: theme.palette.text.primary, - fontSize: 14, - lineHeight: "150%", - fontWeight: 600, - }), - - auditLogInfoTooltip: { - display: "flex", - flexDirection: "column", - gap: 8, - }, - - // offset the absence of the arrow icon on diff-less logs - columnWithoutDiff: { - marginLeft: "24px", - }, - - fullWidth: { - width: "100%", - }, - - deletedLabel: (theme) => ({ - ...(theme.typography.caption as CSSObject), - color: theme.palette.text.secondary, - }), -} satisfies Record>;