Skip to content

Commit d8efe91

Browse files
committed
🍒
1 parent bbe5ab3 commit d8efe91

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

site/src/pages/WorkspacePage/WorkspaceScheduleControls.tsx

+7-6
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,14 @@ const AutoStopDisplay: FC<AutoStopDisplayProps> = ({ workspace }) => {
245245
return (
246246
<Tooltip title={display.tooltip}>
247247
<ScheduleSettingsLink
248-
css={(theme) => ({
249-
color: isShutdownSoon(workspace)
250-
? `${theme.palette.warning.light} !important`
251-
: undefined,
252-
})}
248+
css={
249+
isShutdownSoon(workspace) &&
250+
((theme) => ({
251+
color: `${theme.palette.warning.light} !important`,
252+
}))
253+
}
253254
>
254-
Stop {display.message}
255+
{display.message}
255256
</ScheduleSettingsLink>
256257
</Tooltip>
257258
);

site/src/pages/WorkspaceSettingsPage/WorkspaceSchedulePage/WorkspaceSchedulePage.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,7 @@ export const WorkspaceSchedulePage: FC = () => {
8080
<Helmet>
8181
<title>{pageTitle([workspaceName, "Schedule"])}</title>
8282
</Helmet>
83-
<PageHeader
84-
css={{
85-
paddingTop: 0,
86-
}}
87-
>
83+
<PageHeader css={{ paddingTop: 0 }}>
8884
<PageHeaderTitle>Workspace Schedule</PageHeaderTitle>
8985
</PageHeader>
9086

site/src/utils/schedule.ts

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import cronstrue from "cronstrue";
2-
import dayjs, { Dayjs } from "dayjs";
2+
import cronParser from "cron-parser";
3+
import dayjs, { type Dayjs } from "dayjs";
34
import duration from "dayjs/plugin/duration";
45
import relativeTime from "dayjs/plugin/relativeTime";
56
import timezone from "dayjs/plugin/timezone";
67
import utc from "dayjs/plugin/utc";
7-
import { Template, Workspace } from "api/typesGenerated";
8+
import { type ReactNode } from "react";
9+
import type { Template, Workspace } from "api/typesGenerated";
810
import { isWorkspaceOn } from "./workspace";
9-
import cronParser from "cron-parser";
1011

1112
// REMARK: some plugins depend on utc, so it's listed first. Otherwise they're
1213
// sorted alphabetically.
@@ -91,11 +92,18 @@ export const isShuttingDown = (
9192
export const autostopDisplay = (
9293
workspace: Workspace,
9394
): {
94-
message: string;
95+
message: ReactNode;
9596
tooltip?: string;
9697
} => {
9798
const ttl = workspace.ttl_ms;
9899

100+
if (isWorkspaceOn(workspace) && true) {
101+
return {
102+
message: "Connected with SSH",
103+
tooltip: "Workspace will not stop while there is an active connection",
104+
};
105+
}
106+
99107
if (isWorkspaceOn(workspace) && workspace.latest_build.deadline) {
100108
// Workspace is on --> derive from latest_build.deadline. Note that the
101109
// user may modify their workspace object (ttl) while the workspace is
@@ -111,7 +119,7 @@ export const autostopDisplay = (
111119
} else {
112120
const deadlineTz = deadline.tz(dayjs.tz.guess());
113121
return {
114-
message: deadlineTz.fromNow(),
122+
message: `Stop ${deadlineTz.fromNow()}`,
115123
tooltip: deadlineTz.format("MMMM D, YYYY h:mm A"),
116124
};
117125
}

0 commit comments

Comments
 (0)