mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
refactor(site): remove version and last built from workspace header (#10495)
This commit is contained in:
@ -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} />;
|
||||
@ -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 (
|
||||
|
@ -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 {
|
||||
|
@ -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>
|
||||
@ -94,6 +98,9 @@ const styles = {
|
||||
buildSummary: (theme) => ({
|
||||
...(theme.typography.body1 as CSSObject),
|
||||
fontFamily: "inherit",
|
||||
"& strong": {
|
||||
fontWeight: 600,
|
||||
},
|
||||
}),
|
||||
|
||||
buildInfo: (theme) => ({
|
||||
|
@ -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,
|
||||
@ -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",
|
||||
};
|
||||
@ -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;
|
||||
@ -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 && (
|
||||
@ -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}
|
||||
|
Reference in New Issue
Block a user