Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9cc6d7b

Browse files
authored
fix: show explicit schedule stop time (#2171)
This does not fully resolve all requests in#2141, but just the piece ofwhen the workspace is actually stopping.Next, we will adjust the default extension from 90 minutes to 4 hours.Lastly, we can look at customizing the extension time in the extensionflow or with a pre-emptive prompt next to the stop time.
1 parentb390250 commit9cc6d7b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

‎site/src/components/WorkspaceSchedule/WorkspaceSchedule.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import Typography from "@material-ui/core/Typography"
44
importScheduleIconfrom"@material-ui/icons/Schedule"
55
importcronstruefrom"cronstrue"
66
importdayjsfrom"dayjs"
7+
importadvancedFormatfrom"dayjs/plugin/advancedFormat"
78
importdurationfrom"dayjs/plugin/duration"
89
importrelativeTimefrom"dayjs/plugin/relativeTime"
10+
importtimezonefrom"dayjs/plugin/timezone"
911
importutcfrom"dayjs/plugin/utc"
1012
import{FC}from"react"
1113
import{LinkasRouterLink}from"react-router-dom"
@@ -15,27 +17,32 @@ import { extractTimezone, stripTimezone } from "../../util/schedule"
1517
import{isWorkspaceOn}from"../../util/workspace"
1618
import{Stack}from"../Stack/Stack"
1719

20+
dayjs.extend(advancedFormat)
1821
dayjs.extend(utc)
1922
dayjs.extend(duration)
2023
dayjs.extend(relativeTime)
24+
dayjs.extend(timezone)
2125

2226
exportconstLanguage={
2327
autoStartDisplay:(schedule:string|undefined):string=>{
2428
if(schedule){
2529
returncronstrue.toString(stripTimezone(schedule),{throwExceptionOnParseError:false})
30+
}else{
31+
return"Manual"
2632
}
27-
return"Manual"
2833
},
2934
autoStartLabel:(schedule:string|undefined):string=>{
3035
constprefix="Start"
36+
consttimezone=schedule ?extractTimezone(schedule) :dayjs.tz.guess()
3137

3238
if(schedule){
33-
return`${prefix} (${extractTimezone(schedule)})`
39+
return`${prefix} (${dayjs().tz(timezone).format("z")})`
3440
}else{
3541
returnprefix
3642
}
3743
},
3844
autoStopDisplay:(workspace:Workspace):string=>{
45+
constschedule=workspace.autostart_schedule
3946
constdeadline=dayjs(workspace.latest_build.deadline).utc()
4047
// a mannual shutdown has a deadline of '"0001-01-01T00:00:00Z"'
4148
// SEE: #1834
@@ -52,7 +59,8 @@ export const Language = {
5259
if(now.isAfter(deadline)){
5360
return"Workspace is shutting down"
5461
}else{
55-
returnnow.to(deadline)
62+
consttimezone=schedule ?extractTimezone(schedule) :dayjs.tz.guess()
63+
returndeadline.tz(timezone).format("HH:mm A")
5664
}
5765
}elseif(!ttl||ttl<1){
5866
// If the workspace is not on, and the ttl is 0 or undefined, then the

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp