@@ -74,6 +74,7 @@ export interface WorkspaceProps {
74
74
onLoadMoreBuilds : ( ) => void ;
75
75
isLoadingMoreBuilds : boolean ;
76
76
hasMoreBuilds : boolean ;
77
+ canAutostart : boolean ;
77
78
}
78
79
79
80
/**
@@ -112,6 +113,7 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
112
113
onLoadMoreBuilds,
113
114
isLoadingMoreBuilds,
114
115
hasMoreBuilds,
116
+ canAutostart,
115
117
} ) => {
116
118
const navigate = useNavigate ( ) ;
117
119
const serverVersion = buildInfo ?. version || "" ;
@@ -170,10 +172,12 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
170
172
} ;
171
173
} , [ workspace , now , showAlertPendingInQueue ] ) ;
172
174
173
- console . log ( "policy: " + workspaceUpdatePolicy ( workspace , canChangeVersions ) ) ;
174
- console . log ( "autostart schedule: " + workspace . autostart_schedule ) ;
175
- console . log ( "outdated: " + workspace . outdated ) ;
176
- console . log ( "mismatch: " + workspace . parameter_mismatch ) ;
175
+ const showAutostartBanner =
176
+ ( workspace . template_require_active_version ||
177
+ workspace . automatic_updates === "always" ) &&
178
+ workspace . autostart_schedule &&
179
+ workspace . outdated &&
180
+ ! canAutostart ;
177
181
178
182
return (
179
183
< >
@@ -227,29 +231,26 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
227
231
228
232
< Margins css = { styles . content } >
229
233
< Stack direction = "column" css = { styles . firstColumnSpacer } spacing = { 4 } >
230
- { workspace . outdated && (
234
+ { ! showAutostartBanner && workspace . outdated && (
231
235
< Alert severity = "info" >
232
236
< AlertTitle > An update is available for your workspace</ AlertTitle >
233
237
{ updateMessage && < AlertDetail > { updateMessage } </ AlertDetail > }
234
238
</ Alert >
235
239
) }
240
+ { showAutostartBanner && (
241
+ < Alert severity = "warning" >
242
+ < AlertTitle >
243
+ Autostart has been disabled for your workspace.
244
+ </ AlertTitle >
245
+ < AlertDetail >
246
+ A parameter mismatch has been detected between your workspace
247
+ and the active template version. Manually update your workspace
248
+ to reenable Autostart.
249
+ </ AlertDetail >
250
+ </ Alert >
251
+ ) }
236
252
{ buildError }
237
253
{ cancellationError }
238
- { workspaceUpdatePolicy ( workspace , canChangeVersions ) === "always" &&
239
- workspace . autostart_schedule &&
240
- workspace . outdated &&
241
- workspace . parameter_mismatch && (
242
- < Alert severity = "warning" >
243
- < AlertTitle >
244
- Autostart has been disabled for your workspace.
245
- </ AlertTitle >
246
- < AlertDetail >
247
- A parameter mismatch has been detected between your workspace
248
- and the active template version. Manually update your
249
- workspace to reenable Autostart.
250
- </ AlertDetail >
251
- </ Alert >
252
- ) }
253
254
{ workspace . latest_build . status === "running" &&
254
255
! workspace . health . healthy && (
255
256
< Alert
0 commit comments