1
1
import cronstrue from "cronstrue" ;
2
- import dayjs , { Dayjs } from "dayjs" ;
2
+ import cronParser from "cron-parser" ;
3
+ import dayjs , { type Dayjs } from "dayjs" ;
3
4
import duration from "dayjs/plugin/duration" ;
4
5
import relativeTime from "dayjs/plugin/relativeTime" ;
5
6
import timezone from "dayjs/plugin/timezone" ;
6
7
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" ;
8
10
import { isWorkspaceOn } from "./workspace" ;
9
- import cronParser from "cron-parser" ;
10
11
11
12
// REMARK: some plugins depend on utc, so it's listed first. Otherwise they're
12
13
// sorted alphabetically.
@@ -91,11 +92,18 @@ export const isShuttingDown = (
91
92
export const autostopDisplay = (
92
93
workspace : Workspace ,
93
94
) : {
94
- message : string ;
95
+ message : ReactNode ;
95
96
tooltip ?: string ;
96
97
} => {
97
98
const ttl = workspace . ttl_ms ;
98
99
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
+
99
107
if ( isWorkspaceOn ( workspace ) && workspace . latest_build . deadline ) {
100
108
// Workspace is on --> derive from latest_build.deadline. Note that the
101
109
// user may modify their workspace object (ttl) while the workspace is
@@ -111,7 +119,7 @@ export const autostopDisplay = (
111
119
} else {
112
120
const deadlineTz = deadline . tz ( dayjs . tz . guess ( ) ) ;
113
121
return {
114
- message : deadlineTz . fromNow ( ) ,
122
+ message : `Stop ${ deadlineTz . fromNow ( ) } ` ,
115
123
tooltip : deadlineTz . format ( "MMMM D, YYYY h:mm A" ) ,
116
124
} ;
117
125
}
0 commit comments