@@ -8,6 +8,7 @@ import utc from "dayjs/plugin/utc";
8
8
import { type ReactNode } from "react" ;
9
9
import type { Template , Workspace } from "api/typesGenerated" ;
10
10
import { isWorkspaceOn } from "./workspace" ;
11
+ import { templateVersionExternalAuthKey } from "api/queries/templates" ;
11
12
12
13
// REMARK: some plugins depend on utc, so it's listed first. Otherwise they're
13
14
// sorted alphabetically.
@@ -91,38 +92,39 @@ export const isShuttingDown = (
91
92
92
93
export const autostopDisplay = (
93
94
workspace : Workspace ,
95
+ template : Template ,
94
96
) : {
95
97
message : ReactNode ;
96
98
tooltip ?: string ;
97
99
} => {
98
100
const ttl = workspace . ttl_ms ;
99
101
100
- // workspace.latest_build.resources.map((resource) => resource.agents?.map((agent) => agent.
101
-
102
- if ( isWorkspaceOn ( workspace ) && true ) {
103
- return {
104
- message : "Connected with SSH" ,
105
- tooltip : "Workspace will not stop while there is an active connection" ,
106
- } ;
107
- }
108
-
109
102
if ( isWorkspaceOn ( workspace ) && workspace . latest_build . deadline ) {
110
103
// Workspace is on --> derive from latest_build.deadline. Note that the
111
104
// user may modify their workspace object (ttl) while the workspace is
112
105
// running and depending on system semantics, the deadline may still
113
106
// represent the previously defined ttl. Thus, we always derive from the
114
107
// deadline as the source of truth.
115
108
109
+ workspace .
110
+
116
111
const deadline = dayjs ( workspace . latest_build . deadline ) . utc ( ) ;
117
112
if ( isShuttingDown ( workspace , deadline ) ) {
118
113
return {
119
114
message : Language . workspaceShuttingDownLabel ,
120
115
} ;
121
116
} else {
122
117
const deadlineTz = deadline . tz ( dayjs . tz . guess ( ) ) ;
118
+ let reason = "" ;
119
+ if ( template . autostop_requirement ) {
120
+
121
+ }
122
+ const reason = template . allow_user_autostop ;
123
123
return {
124
124
message : `Stop ${ deadlineTz . fromNow ( ) } ` ,
125
- tooltip : deadlineTz . format ( "MMMM D, YYYY h:mm A" ) ,
125
+ tooltip : `This workspace will be stopped on ${ deadlineTz . format (
126
+ "MMMM D, YYYY [at] h:mm A" ,
127
+ ) } `,
126
128
} ;
127
129
}
128
130
} else if ( ! ttl || ttl < 1 ) {
0 commit comments