Skip to content

Commit 7c82b83

Browse files
authored
fix: adjust validation errors for template schedule form (coder#15915)
Fixes: coder#15910 This PR sets custom validation errors for the Template Schedule form when the given value is not integer.
1 parent efa9f00 commit 7c82b83

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ const MAX_TTL_DAYS = 30;
2323
export const getValidationSchema = (): Yup.AnyObjectSchema =>
2424
Yup.object({
2525
default_ttl_ms: Yup.number()
26-
.integer()
26+
.integer("Default time until autostop must be an integer.")
2727
.required()
2828
.min(0, "Default time until autostop must not be less than 0.")
2929
.max(
3030
24 * MAX_TTL_DAYS /* 30 days in hours */,
3131
"Please enter a limit that is less than or equal to 720 hours (30 days).",
3232
),
3333
activity_bump_ms: Yup.number()
34-
.integer()
34+
.integer("Activity bump must be an integer.")
3535
.required()
3636
.min(0, "Activity bump must not be less than 0.")
3737
.max(
3838
24 * MAX_TTL_DAYS /* 30 days in hours */,
3939
"Please enter an activity bump duration that is less than or equal to 720 hours (30 days).",
4040
),
4141
failure_ttl_ms: Yup.number()
42-
.integer()
42+
.integer("Failure cleanup days must be an integer.")
4343
.required()
4444
.min(0, "Failure cleanup days must not be less than 0.")
4545
.test(
@@ -54,7 +54,7 @@ export const getValidationSchema = (): Yup.AnyObjectSchema =>
5454
},
5555
),
5656
time_til_dormant_ms: Yup.number()
57-
.integer()
57+
.integer("Dormancy threshold must be an integer.")
5858
.required()
5959
.min(0, "Dormancy threshold must not be less than 0.")
6060
.test(
@@ -69,7 +69,7 @@ export const getValidationSchema = (): Yup.AnyObjectSchema =>
6969
},
7070
),
7171
time_til_dormant_autodelete_ms: Yup.number()
72-
.integer()
72+
.integer("Dormancy auto-deletion days must be an integer.")
7373
.required()
7474
.min(0, "Dormancy auto-deletion days must not be less than 0.")
7575
.test(

0 commit comments

Comments
 (0)