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

Commit6fde537

Browse files
authored
web: use seconds in max TTL input (#3576)
Milliseconds are more difficult to deal with due toall of the zeros.Also, describe this feature as "auto-stop" to beconsistent with our Workspace page UI and CLI. "ttl"is our backend lingo which should eventually be updated.
1 parent5e36be8 commit6fde537

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ import * as Yup from "yup"
1818
exportconstLanguage={
1919
nameLabel:"Name",
2020
descriptionLabel:"Description",
21+
maxTtlLabel:"Auto-stop limit",
2122
iconLabel:"Icon",
22-
maxTtlLabel:"Max TTL",
2323
// This is the same from the CLI on https://github.com/coder/coder/blob/546157b63ef9204658acf58cb653aa9936b70c49/cli/templateedit.go#L59
24-
maxTtlHelperText:"Edit the template maximum time before shutdown inmilliseconds",
24+
maxTtlHelperText:"Edit the template maximum time before shutdown inseconds",
2525
formAriaLabel:"Template settings form",
2626
selectEmoji:"Select emoji",
2727
}
@@ -59,9 +59,7 @@ export const TemplateSettingsForm: FC<TemplateSettingsForm> = ({
5959
icon:template.icon,
6060
},
6161
validationSchema,
62-
onSubmit:(data)=>{
63-
onSubmit(data)
64-
},
62+
onSubmit,
6563
initialTouched,
6664
})
6765
constgetFieldHelpers=getFormHelpersWithError<UpdateTemplateMeta>(form,error)
@@ -156,6 +154,12 @@ export const TemplateSettingsForm: FC<TemplateSettingsForm> = ({
156154
inputProps={{min:0,step:1}}
157155
label={Language.maxTtlLabel}
158156
variant="outlined"
157+
// Display seconds from ms
158+
value={form.values.max_ttl_ms ?form.values.max_ttl_ms/1000 :""}
159+
// Convert ms to seconds
160+
onChange={(event)=>
161+
form.setFieldValue("max_ttl_ms",Number(event.currentTarget.value)*1000)
162+
}
159163
/>
160164
</Stack>
161165

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp