diff --git a/site/src/modules/workspaces/WorkspaceBuildLogs/WorkspaceBuildLogs.tsx b/site/src/modules/workspaces/WorkspaceBuildLogs/WorkspaceBuildLogs.tsx index 3c8f6acd54..f5cec18745 100644 --- a/site/src/modules/workspaces/WorkspaceBuildLogs/WorkspaceBuildLogs.tsx +++ b/site/src/modules/workspaces/WorkspaceBuildLogs/WorkspaceBuildLogs.tsx @@ -1,4 +1,3 @@ -import type { Interpolation, Theme } from "@emotion/react"; import dayjs from "dayjs"; import { type FC, @@ -10,7 +9,6 @@ import { import type { ProvisionerJobLog, WorkspaceBuild } from "#/api/typesGenerated"; import type { Line } from "#/components/Logs/LogLine"; import { DEFAULT_LOG_LINE_SIDE_PADDING, Logs } from "#/components/Logs/Logs"; -import { BODY_FONT_FAMILY } from "#/theme/constants"; import { cn } from "#/utils/cn"; type Stage = ProvisionerJobLog["stage"]; @@ -89,12 +87,23 @@ export const WorkspaceBuildLogs: FC = ({ return (
{stage}
{shouldDisplayDuration && ( -
{duration} seconds
+
+ {duration} seconds +
)}
{!isEmpty && } @@ -104,37 +113,3 @@ export const WorkspaceBuildLogs: FC = ({ ); }; - -const styles = { - header: (theme) => ({ - fontSize: 13, - fontWeight: 600, - padding: `12px var(--log-line-side-padding, ${DEFAULT_LOG_LINE_SIDE_PADDING}px)`, - display: "flex", - alignItems: "center", - fontFamily: BODY_FONT_FAMILY, - borderBottom: `1px solid ${theme.palette.divider}`, - background: theme.palette.background.default, - lineHeight: "1", - - "&:last-child": { - borderBottom: 0, - borderRadius: "0 0 8px 8px", - }, - - "&:first-of-type": { - borderRadius: "8px 8px 0 0", - }, - }), - - sticky: { - position: "sticky", - top: 0, - }, - - duration: (theme) => ({ - marginLeft: "auto", - color: theme.palette.text.secondary, - fontSize: 12, - }), -} satisfies Record>; diff --git a/site/src/modules/workspaces/WorkspaceTiming/Chart/Bar.tsx b/site/src/modules/workspaces/WorkspaceTiming/Chart/Bar.tsx index c3d05485b8..23d3b4e945 100644 --- a/site/src/modules/workspaces/WorkspaceTiming/Chart/Bar.tsx +++ b/site/src/modules/workspaces/WorkspaceTiming/Chart/Bar.tsx @@ -1,4 +1,4 @@ -import type { Interpolation, Theme } from "@emotion/react"; +import { cn } from "#/utils/cn"; export type BarColors = { stroke: string; fill: string; @@ -30,7 +30,17 @@ export const Bar: React.FC = ({ offset, ...htmlProps }) => { - return
; + return ( +
+ ); }; type ClickableBarProps = BaseBarProps>; @@ -45,55 +55,31 @@ export const ClickableBar: React.FC = ({ return ( {!isLoading && ( -
+
{view.name === "default" && ( { @@ -175,7 +174,6 @@ export const WorkspaceTimings: FC = ({ }} /> )} - {view.name === "detailed" && ( <> {view.stage.section === "provisioning" && ( @@ -235,46 +233,3 @@ const toTimeRange = (timing: { endedAt: new Date(timing.ended_at), }; }; - -const _humanizeDuration = (durationMs: number): string => { - const seconds = Math.floor(durationMs / 1000); - const minutes = Math.floor(seconds / 60); - const hours = Math.floor(minutes / 60); - - if (hours > 0) { - return `${hours.toLocaleString()}h ${(minutes % 60).toLocaleString()}m`; - } - - if (minutes > 0) { - return `${minutes.toLocaleString()}m ${(seconds % 60).toLocaleString()}s`; - } - - return `${seconds.toLocaleString()}s`; -}; - -const styles = { - collapse: (theme) => ({ - borderRadius: 8, - border: `1px solid ${theme.palette.divider}`, - backgroundColor: theme.palette.background.default, - }), - collapseTrigger: { - background: "none", - border: 0, - padding: 16, - color: "inherit", - width: "100%", - display: "flex", - alignItems: "center", - height: 57, - fontSize: 14, - fontWeight: 500, - cursor: "pointer", - }, - collapseBody: (theme) => ({ - borderTop: `1px solid ${theme.palette.divider}`, - display: "flex", - flexDirection: "column", - height: "var(--collapse-body-height, 420px)", - }), -} satisfies Record>; diff --git a/site/src/pages/WorkspacePage/ResourceMetadata.tsx b/site/src/pages/WorkspacePage/ResourceMetadata.tsx index 0223360523..e4b698c26d 100644 --- a/site/src/pages/WorkspacePage/ResourceMetadata.tsx +++ b/site/src/pages/WorkspacePage/ResourceMetadata.tsx @@ -68,7 +68,7 @@ export const ResourceMetadata: FC = ({ }; const styles = { - root: (theme) => ({ + root: () => ({ padding: 24, display: "flex", flexWrap: "wrap", @@ -76,7 +76,6 @@ const styles = { rowGap: 24, marginBottom: 24, fontSize: 14, - background: `linear-gradient(180deg, ${theme.palette.background.default} 25%, rgba(0, 0, 0, 0) 100%)`, }), item: { diff --git a/site/src/pages/WorkspacePage/Workspace.tsx b/site/src/pages/WorkspacePage/Workspace.tsx index 2735ed19b1..8a3e6c8d55 100644 --- a/site/src/pages/WorkspacePage/Workspace.tsx +++ b/site/src/pages/WorkspacePage/Workspace.tsx @@ -157,98 +157,102 @@ export const Workspace: FC = ({ )}
-
- {selectedResource && ( - - )} -
- {workspace.latest_build.status === "deleted" && ( - navigate("/templates")} - /> - )} - - {shouldShowProvisionerAlert && ( - - )} - - {workspace.latest_build.job.error && ( - - Workspace build failed - - {workspace.latest_build.job.error} - - - )} - - {!workspace.health.healthy && ( - - )} - - {transitionStats !== undefined && ( - - )} - - {shouldShowBuildLogs && ( - - )} +
+
+
{selectedResource && ( -
- {selectedResource.agents - // If an agent has a `parent_id`, that means it is - // child of another agent. We do not want these agents - // to be displayed at the top-level on this page. We - // want them to display _as children_ of their parents. - ?.filter((agent) => agent.parent_id === null) - .map((agent) => ( - a.parent_id === agent.id, - )} - workspace={workspace} - template={template} - onUpdateAgent={handleUpdate} // On updating the workspace the agent version is also updated - /> - ))} - - {(!selectedResource.agents || - selectedResource.agents?.length === 0) && ( -
-
-

- No agents are currently assigned to this resource. -

-
-
- )} -
+ )} +
+ {workspace.latest_build.status === "deleted" && ( + navigate("/templates")} + /> + )} - + {shouldShowProvisionerAlert && ( + + )} + + {workspace.latest_build.job.error && ( + + Workspace build failed + + {workspace.latest_build.job.error} + + + )} + + {!workspace.health.healthy && ( + + )} + + {transitionStats !== undefined && ( + + )} + + {shouldShowBuildLogs && ( + + )} + + {selectedResource && ( +
+ {selectedResource.agents + // If an agent has a `parent_id`, that means it is + // child of another agent. We do not want these agents + // to be displayed at the top-level on this page. We + // want them to display _as children_ of their parents. + ?.filter((agent) => agent.parent_id === null) + .map((agent) => ( + a.parent_id === agent.id, + )} + workspace={workspace} + template={template} + onUpdateAgent={handleUpdate} // On updating the workspace the agent version is also updated + /> + ))} + + {(!selectedResource.agents || + selectedResource.agents?.length === 0) && ( +
+
+

+ No agents are currently assigned to this resource. +

+
+
+ )} +
+ )} + + +
diff --git a/site/src/pages/WorkspacePage/WorkspaceBuildLogsSection.tsx b/site/src/pages/WorkspacePage/WorkspaceBuildLogsSection.tsx index 692feae5a4..5e852daa63 100644 --- a/site/src/pages/WorkspacePage/WorkspaceBuildLogsSection.tsx +++ b/site/src/pages/WorkspacePage/WorkspaceBuildLogsSection.tsx @@ -1,8 +1,8 @@ -import { useTheme } from "@emotion/react"; import type { FC } from "react"; import type { ProvisionerJobLog } from "#/api/typesGenerated"; import { Loader } from "#/components/Loader/Loader"; import { WorkspaceBuildLogs } from "#/modules/workspaces/WorkspaceBuildLogs/WorkspaceBuildLogs"; +import { cn } from "#/utils/cn"; interface WorkspaceBuildLogsSectionProps { logs?: ProvisionerJobLog[]; @@ -11,28 +11,14 @@ interface WorkspaceBuildLogsSectionProps { export const WorkspaceBuildLogsSection: FC = ({ logs, }) => { - const theme = useTheme(); - return ( -
+
Build logs