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

Commitbd21474

Browse files
committed
rename variable
1 parent2ee6574 commitbd21474

File tree

6 files changed

+33
-31
lines changed

6 files changed

+33
-31
lines changed

‎site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,19 @@ type GetInitialValuesParams = {
114114
fromCopy?:Template
115115
parameters?:ParameterSchema[]
116116
variables?:TemplateVersionVariable[]
117-
canSetMaxTTL:boolean
117+
allowAdvancedScheduling:boolean
118118
}
119119

120120
constgetInitialValues=({
121121
fromExample,
122122
fromCopy,
123-
canSetMaxTTL,
123+
allowAdvancedScheduling,
124124
variables,
125125
parameters,
126126
}:GetInitialValuesParams)=>{
127127
letinitialValues=defaultInitialValues
128128

129-
if(!canSetMaxTTL){
129+
if(!allowAdvancedScheduling){
130130
initialValues={
131131
...initialValues,
132132
max_ttl_hours:0,
@@ -190,7 +190,7 @@ export interface CreateTemplateFormProps {
190190
error?:unknown
191191
jobError?:string
192192
logs?:ProvisionerJobLog[]
193-
canSetMaxTTL:boolean
193+
allowAdvancedScheduling:boolean
194194
copiedTemplate?:Template
195195
}
196196

@@ -206,12 +206,12 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
206206
error,
207207
jobError,
208208
logs,
209-
canSetMaxTTL,
209+
allowAdvancedScheduling,
210210
})=>{
211211
conststyles=useStyles()
212212
constform=useFormik<CreateTemplateData>({
213213
initialValues:getInitialValues({
214-
canSetMaxTTL,
214+
allowAdvancedScheduling,
215215
fromExample:starterTemplate,
216216
fromCopy:copiedTemplate,
217217
variables,
@@ -321,7 +321,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
321321
<TextField
322322
{...getFieldHelpers(
323323
"max_ttl_hours",
324-
canSetMaxTTL ?(
324+
allowAdvancedScheduling ?(
325325
<TTLHelperText
326326
translationName="form.helperText.maxTTLHelperText"
327327
ttl={form.values.max_ttl_hours}
@@ -336,7 +336,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
336336
</>
337337
),
338338
)}
339-
disabled={isSubmitting||!canSetMaxTTL}
339+
disabled={isSubmitting||!allowAdvancedScheduling}
340340
fullWidth
341341
label={t("form.fields.maxTTL")}
342342
variant="outlined"
@@ -349,7 +349,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
349349
id="allow_user_autostart"
350350
size="small"
351351
color="primary"
352-
disabled={isSubmitting||!canSetMaxTTL}
352+
disabled={isSubmitting||!allowAdvancedScheduling}
353353
onChange={async()=>{
354354
awaitform.setFieldValue(
355355
"allow_user_autostart",
@@ -361,7 +361,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
361361
/>
362362
<Stackspacing={0.5}>
363363
<strong>
364-
Allow users toauto-start workspaces on a schedule.
364+
Allow users toautostart workspaces on a schedule.
365365
</strong>
366366
</Stack>
367367
</Stack>
@@ -370,7 +370,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
370370
id="allow-user-autostop"
371371
size="small"
372372
color="primary"
373-
disabled={isSubmitting||!canSetMaxTTL}
373+
disabled={isSubmitting||!allowAdvancedScheduling}
374374
onChange={async()=>{
375375
awaitform.setFieldValue(
376376
"allow_user_autostop",
@@ -382,7 +382,7 @@ export const CreateTemplateForm: FC<CreateTemplateFormProps> = ({
382382
/>
383383
<Stackspacing={0.5}>
384384
<strong>
385-
Allow users to customizeauto-stop duration for workspaces.
385+
Allow users to customizeautostop duration for workspaces.
386386
</strong>
387387
<spanclassName={styles.optionText}>
388388
Workspaces will always use the default TTL if this is set.

‎site/src/pages/CreateTemplatePage/CreateTemplatePage.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const CreateTemplatePage: FC = () => {
4444
}=state.context
4545
constshouldDisplayForm=!state.hasTag("loading")
4646
const{ entitlements}=useDashboard()
47-
constcanSetMaxTTL=
47+
constallowAdvancedScheduling=
4848
entitlements.features["advanced_template_scheduling"].enabled
4949

5050
constonCancel=()=>{
@@ -70,7 +70,7 @@ const CreateTemplatePage: FC = () => {
7070
{shouldDisplayForm&&(
7171
<CreateTemplateForm
7272
copiedTemplate={state.context.copiedTemplate}
73-
canSetMaxTTL={canSetMaxTTL}
73+
allowAdvancedScheduling={allowAdvancedScheduling}
7474
error={error}
7575
starterTemplate={starterTemplate}
7676
isSubmitting={state.hasTag("submitting")}

‎site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateScheduleForm.tsx‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export interface TemplateScheduleForm {
5959
onCancel:()=>void
6060
isSubmitting:boolean
6161
error?:unknown
62-
canSetMaxTTL:boolean
62+
allowAdvancedScheduling:boolean
6363
// Helpful to show field errors on Storybook
6464
initialTouched?:FormikTouched<UpdateTemplateMeta>
6565
}
@@ -69,7 +69,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
6969
onSubmit,
7070
onCancel,
7171
error,
72-
canSetMaxTTL,
72+
allowAdvancedScheduling,
7373
isSubmitting,
7474
initialTouched,
7575
})=>{
@@ -81,7 +81,9 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
8181
default_ttl_ms:template.default_ttl_ms/MS_HOUR_CONVERSION,
8282
// the API ignores this value, but to avoid tripping up validation set
8383
// it to zero if the user can't set the field.
84-
max_ttl_ms:canSetMaxTTL ?template.max_ttl_ms/MS_HOUR_CONVERSION :0,
84+
max_ttl_ms:allowAdvancedScheduling
85+
?template.max_ttl_ms/MS_HOUR_CONVERSION
86+
:0,
8587
allow_user_autostart:template.allow_user_autostart,
8688
allow_user_autostop:template.allow_user_autostop,
8789
},
@@ -134,7 +136,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
134136
<TextField
135137
{...getFieldHelpers(
136138
"max_ttl_ms",
137-
canSetMaxTTL ?(
139+
allowAdvancedScheduling ?(
138140
<TTLHelperText
139141
translationName="maxTTLHelperText"
140142
ttl={form.values.max_ttl_ms}
@@ -149,7 +151,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
149151
</>
150152
),
151153
)}
152-
disabled={isSubmitting||!canSetMaxTTL}
154+
disabled={isSubmitting||!allowAdvancedScheduling}
153155
fullWidth
154156
inputProps={{min:0,step:1}}
155157
label={t("maxTtlLabel")}
@@ -161,15 +163,15 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
161163

162164
<FormSection
163165
title="Allow users scheduling"
164-
description="Allow users to set customauto-start andauto-stop scheduling options for workspaces created from this template."
166+
description="Allow users to set customautostart andautostop scheduling options for workspaces created from this template."
165167
>
166168
<Stackdirection="column">
167169
<Stackdirection="row"alignItems="center">
168170
<Checkbox
169171
id="allow_user_autostart"
170172
size="small"
171173
color="primary"
172-
disabled={isSubmitting||!canSetMaxTTL}
174+
disabled={isSubmitting||!allowAdvancedScheduling}
173175
onChange={async()=>{
174176
awaitform.setFieldValue(
175177
"allow_user_autostart",
@@ -181,7 +183,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
181183
/>
182184
<Stackspacing={0.5}>
183185
<strong>
184-
Allow users toauto-start workspaces on a schedule.
186+
Allow users toautostart workspaces on a schedule.
185187
</strong>
186188
</Stack>
187189
</Stack>
@@ -190,7 +192,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
190192
id="allow-user-autostop"
191193
size="small"
192194
color="primary"
193-
disabled={isSubmitting||!canSetMaxTTL}
195+
disabled={isSubmitting||!allowAdvancedScheduling}
194196
onChange={async()=>{
195197
awaitform.setFieldValue(
196198
"allow_user_autostop",
@@ -202,7 +204,7 @@ export const TemplateScheduleForm: FC<TemplateScheduleForm> = ({
202204
/>
203205
<Stackspacing={0.5}>
204206
<strong>
205-
Allow users to customizeauto-stop duration for workspaces.
207+
Allow users to customizeautostop duration for workspaces.
206208
</strong>
207209
<spanclassName={styles.optionDescription}>
208210
Workspaces will always use the default TTL if this is set.

‎site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateSchedulePage.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const TemplateSchedulePage: FC = () => {
1515
constnavigate=useNavigate()
1616
const{ template}=useTemplateSettingsContext()
1717
const{ entitlements}=useDashboard()
18-
constcanSetMaxTTL=
18+
constallowAdvancedScheduling=
1919
entitlements.features["advanced_template_scheduling"].enabled
2020
const{
2121
mutate:updateTemplate,
@@ -36,7 +36,7 @@ const TemplateSchedulePage: FC = () => {
3636
<title>{pageTitle([template.name,"Schedule"])}</title>
3737
</Helmet>
3838
<TemplateSchedulePageView
39-
canSetMaxTTL={canSetMaxTTL}
39+
allowAdvancedScheduling={allowAdvancedScheduling}
4040
isSubmitting={isSubmitting}
4141
template={template}
4242
submitError={submitError}

‎site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateSchedulePageView.stories.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default {
1010
title:"pages/TemplateSchedulePageView",
1111
component:TemplateSchedulePageView,
1212
args:{
13-
canSetMaxTTL:true,
13+
allowAdvancedScheduling:true,
1414
template:MockTemplate,
1515
onSubmit:action("onSubmit"),
1616
onCancel:action("cancel"),
@@ -26,5 +26,5 @@ Example.args = {}
2626

2727
exportconstCantSetMaxTTL=Template.bind({})
2828
CantSetMaxTTL.args={
29-
canSetMaxTTL:false,
29+
allowAdvancedScheduling:false,
3030
}

‎site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateSchedulePageView.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ export interface TemplateSchedulePageViewProps {
1111
isSubmitting:boolean
1212
submitError?:unknown
1313
initialTouched?:ComponentProps<typeofTemplateScheduleForm>["initialTouched"]
14-
canSetMaxTTL:boolean
14+
allowAdvancedScheduling:boolean
1515
}
1616

1717
exportconstTemplateSchedulePageView:FC<TemplateSchedulePageViewProps>=({
1818
template,
1919
onCancel,
2020
onSubmit,
2121
isSubmitting,
22-
canSetMaxTTL,
22+
allowAdvancedScheduling,
2323
submitError,
2424
initialTouched,
2525
})=>{
@@ -32,7 +32,7 @@ export const TemplateSchedulePageView: FC<TemplateSchedulePageViewProps> = ({
3232
</PageHeader>
3333

3434
<TemplateScheduleForm
35-
canSetMaxTTL={canSetMaxTTL}
35+
allowAdvancedScheduling={allowAdvancedScheduling}
3636
initialTouched={initialTouched}
3737
isSubmitting={isSubmitting}
3838
template={template}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp