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

Commit4f63555

Browse files
authored
fix: Remove "Starts at Manual" label (#4179)
Fixes#2798.
1 parentdf2649e commit4f63555

File tree

2 files changed

+71
-34
lines changed

2 files changed

+71
-34
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: 55 additions & 34 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,41 +70,45 @@ 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}
93105
startIcon={<ScheduleIcon/>}
94106
onClick={()=>{
95107
setIsOpen(true)
96108
}}
97-
className={styles.scheduleButton}
109+
className={`${styles.scheduleButton}${
110+
shouldDisplayScheduleLabel(workspace) ?"label" :""
111+
}`}
98112
>
99113
{t("workspaceScheduleButton.schedule")}
100114
</Button>
@@ -124,8 +138,8 @@ const useStyles = makeStyles((theme) => ({
124138
wrapper:{
125139
display:"inline-flex",
126140
alignItems:"center",
127-
border:`1px solid${theme.palette.divider}`,
128141
borderRadius:`${theme.shape.borderRadius}px`,
142+
border:`1px solid${theme.palette.divider}`,
129143

130144
[theme.breakpoints.down("sm")]:{
131145
flexDirection:"column",
@@ -153,15 +167,22 @@ const useStyles = makeStyles((theme) => ({
153167
},
154168
scheduleButton:{
155169
border:"none",
156-
borderLeft:`1px solid${theme.palette.divider}`,
157-
borderRadius:`0px${theme.shape.borderRadius}px${theme.shape.borderRadius}px 0px`,
170+
borderRadius:`${theme.shape.borderRadius}px`,
158171
flexShrink:0,
159172

173+
"&.label":{
174+
borderLeft:`1px solid${theme.palette.divider}`,
175+
borderRadius:`0px${theme.shape.borderRadius}px${theme.shape.borderRadius}px 0px`,
176+
},
177+
160178
[theme.breakpoints.down("sm")]:{
161179
width:"100%",
162-
borderLeft:0,
163-
borderTop:`1px solid${theme.palette.divider}`,
164-
borderRadius:`0 0${theme.shape.borderRadius}px${theme.shape.borderRadius}px`,
180+
181+
"&.label":{
182+
borderRadius:`0 0${theme.shape.borderRadius}px${theme.shape.borderRadius}px`,
183+
borderLeft:0,
184+
borderTop:`1px solid${theme.palette.divider}`,
185+
},
165186
},
166187
},
167188
iconButton:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp