Skip to content

refactor(site): remove version and last built from workspace header #10495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -4,9 +4,7 @@ import Link from "@mui/material/Link";
import { WorkspaceOutdatedTooltip } from "components/WorkspaceOutdatedTooltip/WorkspaceOutdatedTooltip";
import { type 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 @@ -38,12 +36,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 @@ -72,9 +64,6 @@ export const WorkspaceStats: FC<WorkspaceStatsProps> = ({
onDeadlinePlus,
}) => {
const theme = useTheme();
const initiatedBy = getDisplayWorkspaceBuildInitiatedBy(
workspace.latest_build,
);
const displayTemplateName = getDisplayWorkspaceTemplateName(workspace);
const deadlinePlusEnabled = maxDeadlineIncrease >= 1;
const deadlineMinusEnabled = maxDeadlineDecrease >= 1;
Expand Down Expand Up @@ -103,24 +92,12 @@ export const WorkspaceStats: FC<WorkspaceStatsProps> = ({
css={styles.statsItem}
label={Language.templateLabel}
value={
<Link
component={RouterLink}
to={`/templates/${workspace.template_name}`}
>
{displayTemplateName}
</Link>
}
/>
<StatsItem
css={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 @@ -131,19 +108,10 @@ export const WorkspaceStats: FC<WorkspaceStatsProps> = ({
ariaLabel="update version"
/>
)}
</>
}
/>
<StatsItem
css={styles.statsItem}
label={Language.lastBuiltLabel}
value={
<>
{upperFirst(createDayString(workspace.latest_build.created_at))}{" "}
by {initiatedBy}
</>
</div>
}
/>

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