diff --git a/site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyRow.tsx b/site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyRow.tsx index 6e846ba634a2e..18f66ab738b77 100644 --- a/site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyRow.tsx +++ b/site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyRow.tsx @@ -3,7 +3,7 @@ import { AvatarData } from "components/AvatarData/AvatarData" import { Avatar } from "components/Avatar/Avatar" import TableCell from "@mui/material/TableCell" import TableRow from "@mui/material/TableRow" -import { FC, useState } from "react" +import { FC, ReactNode, useState } from "react" import { HealthyBadge, NotHealthyBadge, @@ -13,19 +13,14 @@ import { import { ProxyLatencyReport } from "contexts/useProxyLatency" import { getLatencyColor } from "utils/latency" import Collapse from "@mui/material/Collapse" -import { makeStyles } from "@mui/styles" -import { combineClasses } from "utils/combineClasses" -import ListItem from "@mui/material/ListItem" -import List from "@mui/material/List" -import ListSubheader from "@mui/material/ListSubheader" import { Maybe } from "components/Conditionals/Maybe" -import { CodeExample } from "components/CodeExample/CodeExample" +import { useClickableTableRow } from "hooks" +import Box from "@mui/material/Box" export const ProxyRow: FC<{ latency?: ProxyLatencyReport proxy: Region }> = ({ proxy, latency }) => { - const styles = useStyles() // If we have a more specific proxy status, use that. // All users can see healthy/unhealthy, some can see more. let statusBadge = @@ -47,16 +42,13 @@ export const ProxyRow: FC<{ setIsMsgsOpen((v) => !v) } } + const clickableProps = useClickableTableRow(toggle) + const rowProps = shouldShowMessages ? clickableProps : undefined + return ( <> - - + + 0 @@ -94,7 +86,10 @@ export const ProxyRow: FC<{ - + @@ -111,11 +106,25 @@ const ProxyMessagesRow: FC<{ return ( <> theme.palette.error.light }} + > + Errors + + } messages={proxy.status?.report?.errors} /> theme.palette.warning.light }} + > + Warnings + + } messages={proxy.status?.report?.warnings} /> @@ -123,26 +132,45 @@ const ProxyMessagesRow: FC<{ } const ProxyMessagesList: FC<{ - title: string + title: ReactNode messages?: string[] }> = ({ title, messages }) => { if (!messages) { return <> } + return ( - - {title} - - } + `1px solid ${theme.palette.divider}`, + backgroundColor: (theme) => theme.palette.background.default, + p: (theme) => theme.spacing(2, 3), + }} > + + {title} + {messages.map((error, index) => ( - - - + theme.spacing(0, 0, 1), + fontSize: 14, + whiteSpace: "pre-wrap", + }} + > + {error} + ))} - + ) } @@ -180,13 +208,3 @@ const ProxyStatus: FC<{ return icon } - -const useStyles = makeStyles((theme) => ({ - clickable: { - cursor: "pointer", - - "&:hover": { - backgroundColor: theme.palette.action.hover, - }, - }, -}))