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

Commitae47dda

Browse files
committed
fix: Remove "Starts at Manual" label
Fixes#2798.
1 parentf160830 commitae47dda

File tree

2 files changed

+55
-27
lines changed

2 files changed

+55
-27
lines changed

‎site/src/components/WorkspaceScheduleButton/WorkspaceScheduleButton.stories.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ WorkspaceOffLong.args = {
7272
},
7373
}
7474

75+
exportconstWorkspaceOn=Template.bind({})
76+
WorkspaceOn.args={
77+
deadlineMinusEnabled:()=>true,
78+
deadlinePlusEnabled:()=>true,
79+
workspace:{
80+
...Mocks.MockWorkspace,
81+
82+
latest_build:{
83+
...Mocks.MockWorkspaceBuild,
84+
transition:"start",
85+
deadline:"2022-05-17T23:59:00.00Z",
86+
},
87+
ttl_ms:2*365*24*60*60*1000,// 2 years
88+
},
89+
}
90+
7591
exportconstCannotEdit=Template.bind({})
7692
CannotEdit.args={
7793
workspace:{

‎site/src/components/WorkspaceScheduleButton/WorkspaceScheduleButton.tsx

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ export const shouldDisplayPlusMinus = (workspace: Workspace): boolean => {
3131
returnisWorkspaceOn(workspace)&&Boolean(workspace.latest_build.deadline)
3232
}
3333

34+
exportconstshouldDisplayScheduleLabel=(workspace:Workspace):boolean=>{
35+
if(shouldDisplayPlusMinus(workspace)){
36+
returntrue
37+
}
38+
if(isWorkspaceOn(workspace)){
39+
returnfalse
40+
}
41+
returnBoolean(workspace.autostart_schedule)
42+
}
43+
3444
exportinterfaceWorkspaceScheduleButtonProps{
3545
workspace:Workspace
3646
onDeadlinePlus:()=>void
@@ -60,33 +70,35 @@ export const WorkspaceScheduleButton: React.FC<WorkspaceScheduleButtonProps> = (
6070

6171
return(
6272
<spanclassName={styles.wrapper}>
63-
<spanclassName={styles.label}>
64-
<WorkspaceScheduleLabelworkspace={workspace}/>
65-
{canUpdateWorkspace&&shouldDisplayPlusMinus(workspace)&&(
66-
<spanclassName={styles.actions}>
67-
<IconButton
68-
className={styles.iconButton}
69-
size="small"
70-
disabled={!deadlineMinusEnabled()}
71-
onClick={onDeadlineMinus}
72-
>
73-
<Tooltiptitle={t("workspaceScheduleButton.editDeadlineMinus")}>
74-
<RemoveIcon/>
75-
</Tooltip>
76-
</IconButton>
77-
<IconButton
78-
className={styles.iconButton}
79-
size="small"
80-
disabled={!deadlinePlusEnabled()}
81-
onClick={onDeadlinePlus}
82-
>
83-
<Tooltiptitle={t("workspaceScheduleButton.editDeadlinePlus")}>
84-
<AddIcon/>
85-
</Tooltip>
86-
</IconButton>
87-
</span>
88-
)}
89-
</span>
73+
{shouldDisplayScheduleLabel(workspace)&&(
74+
<spanclassName={styles.label}>
75+
<WorkspaceScheduleLabelworkspace={workspace}/>
76+
{canUpdateWorkspace&&shouldDisplayPlusMinus(workspace)&&(
77+
<spanclassName={styles.actions}>
78+
<IconButton
79+
className={styles.iconButton}
80+
size="small"
81+
disabled={!deadlineMinusEnabled()}
82+
onClick={onDeadlineMinus}
83+
>
84+
<Tooltiptitle={t("workspaceScheduleButton.editDeadlineMinus")}>
85+
<RemoveIcon/>
86+
</Tooltip>
87+
</IconButton>
88+
<IconButton
89+
className={styles.iconButton}
90+
size="small"
91+
disabled={!deadlinePlusEnabled()}
92+
onClick={onDeadlinePlus}
93+
>
94+
<Tooltiptitle={t("workspaceScheduleButton.editDeadlinePlus")}>
95+
<AddIcon/>
96+
</Tooltip>
97+
</IconButton>
98+
</span>
99+
)}
100+
</span>
101+
)}
90102
<>
91103
<Button
92104
ref={anchorRef}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp