@@ -13,7 +13,7 @@ import { FC } from "react"
13
13
import { Link as RouterLink } from "react-router-dom"
14
14
import { Workspace } from "../../api/typesGenerated"
15
15
import { MONOSPACE_FONT_FAMILY } from "../../theme/constants"
16
- import { extractTimezone , stripTimezone } from "../../util/schedule"
16
+ import { stripTimezone } from "../../util/schedule"
17
17
import { isWorkspaceOn } from "../../util/workspace"
18
18
import { Stack } from "../Stack/Stack"
19
19
@@ -31,20 +31,11 @@ export const Language = {
31
31
return "Manual"
32
32
}
33
33
} ,
34
- autoStartLabel : ( schedule : string | undefined ) : string => {
35
- const prefix = "Start"
36
- const timezone = schedule ? extractTimezone ( schedule ) : dayjs . tz . guess ( )
37
-
38
- if ( schedule ) {
39
- return `${ prefix } (${ dayjs ( ) . tz ( timezone ) . format ( "z" ) } )`
40
- } else {
41
- return prefix
42
- }
43
- } ,
34
+ autoStartLabel : "START" ,
35
+ autoStopLabel : "SHUTDOWN" ,
44
36
autoStopDisplay : ( workspace : Workspace ) : string => {
45
- const schedule = workspace . autostart_schedule
46
37
const deadline = dayjs ( workspace . latest_build . deadline ) . utc ( )
47
- // a mannual shutdown has a deadline of '"0001-01-01T00:00:00Z"'
38
+ // a manual shutdown has a deadline of '"0001-01-01T00:00:00Z"'
48
39
// SEE: #1834
49
40
const hasDeadline = deadline . year ( ) > 1
50
41
const ttl = workspace . ttl_ms
@@ -59,8 +50,7 @@ export const Language = {
59
50
if ( now . isAfter ( deadline ) ) {
60
51
return "Workspace is shutting down"
61
52
} else {
62
- const timezone = schedule ? extractTimezone ( schedule ) : dayjs . tz . guess ( )
63
- return deadline . tz ( timezone ) . format ( "HH:mm A" )
53
+ return deadline . tz ( dayjs . tz . guess ( ) ) . format ( "hh:mm A" )
64
54
}
65
55
} else if ( ! ttl || ttl < 1 ) {
66
56
// If the workspace is not on, and the ttl is 0 or undefined, then the
@@ -74,7 +64,7 @@ export const Language = {
74
64
}
75
65
} ,
76
66
editScheduleLink : "Edit schedule" ,
77
- schedule : " Schedule" ,
67
+ schedule : ` Schedule ( ${ dayjs . tz . guess ( ) } )` ,
78
68
}
79
69
80
70
export interface WorkspaceScheduleProps {
@@ -92,11 +82,13 @@ export const WorkspaceSchedule: FC<WorkspaceScheduleProps> = ({ workspace }) =>
92
82
{ Language . schedule }
93
83
</ Typography >
94
84
< div >
95
- < span className = { styles . scheduleLabel } > { Language . autoStartLabel ( workspace . autostart_schedule ) } </ span >
96
- < span className = { styles . scheduleValue } > { Language . autoStartDisplay ( workspace . autostart_schedule ) } </ span >
85
+ < span className = { styles . scheduleLabel } > { Language . autoStartLabel } </ span >
86
+ < span className = { styles . scheduleValue } data-chromatic = "ignore" >
87
+ { Language . autoStartDisplay ( workspace . autostart_schedule ) }
88
+ </ span >
97
89
</ div >
98
90
< div >
99
- < span className = { styles . scheduleLabel } > Shutdown </ span >
91
+ < span className = { styles . scheduleLabel } > { Language . autoStopLabel } </ span >
100
92
< span className = { styles . scheduleValue } data-chromatic = "ignore" >
101
93
{ Language . autoStopDisplay ( workspace ) }
102
94
</ span >
0 commit comments