Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions site/src/components/Stats/Stats.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type CSSObject, type Interpolation, type Theme } from "@emotion/react";
import Box from "@mui/material/Box";
import { type ComponentProps, type FC } from "react";
import { ReactNode, type ComponentProps, type FC } from "react";

export const Stats: FC<ComponentProps<typeof Box>> = (props) => {
return <Box {...props} css={styles.stats} />;
Expand All @@ -9,7 +9,7 @@ export const Stats: FC<ComponentProps<typeof Box>> = (props) => {
export const StatsItem: FC<
{
label: string;
value: string | number | JSX.Element;
value: ReactNode;
} & ComponentProps<typeof Box>
> = ({ label, value, ...divProps }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const Language = {
outdatedLabel: "Outdated",
versionTooltipText:
"This workspace version is outdated and a newer version is available.",
updateVersionLabel: "Update version",
updateVersionLabel: "Update",
};

interface TooltipProps {
Expand Down
9 changes: 8 additions & 1 deletion site/src/pages/WorkspacePage/BuildRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ export const BuildRow: React.FC<BuildRowProps> = ({ build }) => {
</span>
</Stack>

<Stack direction="row" spacing={1}>
<Stack
direction="row"
spacing={1}
css={{ "& strong": { fontWeight: 600 } }}
>
<span css={styles.buildInfo}>
Reason: <strong>{build.reason}</strong>
</span>
Expand Down Expand Up @@ -94,6 +98,9 @@ const styles = {
buildSummary: (theme) => ({
...(theme.typography.body1 as CSSObject),
fontFamily: "inherit",
"& strong": {
fontWeight: 600,
},
}),

buildInfo: (theme) => ({
Expand Down
42 changes: 5 additions & 37 deletions site/src/pages/WorkspacePage/WorkspaceStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import Link from "@mui/material/Link";
import { WorkspaceOutdatedTooltip } from "components/WorkspaceOutdatedTooltip/WorkspaceOutdatedTooltip";
import { FC } from "react";
import { Link as RouterLink } from "react-router-dom";
import { createDayString } from "utils/createDayString";
import {
getDisplayWorkspaceBuildInitiatedBy,
getDisplayWorkspaceTemplateName,
isWorkspaceOn,
workspaceUpdatePolicy,
Expand Down Expand Up @@ -37,12 +35,6 @@ import { Stack } from "components/Stack/Stack";
const Language = {
workspaceDetails: "Workspace Details",
templateLabel: "Template",
statusLabel: "Workspace Status",
versionLabel: "Version",
lastBuiltLabel: "Last built",
outdated: "Outdated",
upToDate: "Up to date",
byLabel: "Last built by",
costLabel: "Daily cost",
updatePolicy: "Update policy",
};
Expand Down Expand Up @@ -70,9 +62,6 @@ export const WorkspaceStats: FC<WorkspaceStatsProps> = ({
onDeadlineMinus,
onDeadlinePlus,
}) => {
const initiatedBy = getDisplayWorkspaceBuildInitiatedBy(
workspace.latest_build,
);
const displayTemplateName = getDisplayWorkspaceTemplateName(workspace);
const styles = useStyles();
const deadlinePlusEnabled = maxDeadlineIncrease >= 1;
Expand All @@ -92,24 +81,12 @@ export const WorkspaceStats: FC<WorkspaceStatsProps> = ({
className={styles.statsItem}
label={Language.templateLabel}
value={
<Link
component={RouterLink}
to={`/templates/${workspace.template_name}`}
>
{displayTemplateName}
</Link>
}
/>
<StatsItem
className={styles.statsItem}
label={Language.versionLabel}
value={
<>
<div css={{ display: "flex", alignItems: "center", gap: 2 }}>
<Link
component={RouterLink}
to={`/templates/${workspace.template_name}/versions/${workspace.latest_build.template_version_name}`}
to={`/templates/${workspace.template_name}`}
>
{workspace.latest_build.template_version_name}
{displayTemplateName}
</Link>

{workspace.outdated && (
Expand All @@ -120,19 +97,10 @@ export const WorkspaceStats: FC<WorkspaceStatsProps> = ({
ariaLabel="update version"
/>
)}
</>
}
/>
<StatsItem
className={styles.statsItem}
label={Language.lastBuiltLabel}
value={
<>
{upperFirst(createDayString(workspace.latest_build.created_at))}{" "}
by {initiatedBy}
</>
</div>
}
/>

{shouldDisplayScheduleLabel(workspace) && (
<StatsItem
className={styles.statsItem}
Expand Down