Skip to content

Commit ca00bad

Browse files
committed
Fix frontend validations
1 parent dd7647e commit ca00bad

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import TemplateSchedulePage from "./TemplateSchedulePage";
1515

1616
const validFormValues: TemplateScheduleFormValues = {
1717
default_ttl_ms: 1,
18+
activity_bump_ms: 1,
1819
use_max_ttl: true,
1920
max_ttl_ms: 2,
2021
failure_ttl_ms: 7,

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,31 @@ export const getValidationSchema = (): Yup.AnyObjectSchema =>
2525
Yup.object({
2626
default_ttl_ms: Yup.number()
2727
.integer()
28+
.required()
2829
.min(0, "Default time until autostop must not be less than 0.")
2930
.max(
3031
24 * MAX_TTL_DAYS /* 30 days in hours */,
3132
"Please enter a limit that is less than or equal to 720 hours (30 days).",
3233
),
3334
activity_bump_ms: Yup.number()
3435
.integer()
36+
.required()
3537
.min(0, "Activity bump must not be less than 0.")
3638
.max(
3739
24 * MAX_TTL_DAYS /* 30 days in hours */,
3840
"Please enter an activity bump duration that is less than or equal to 720 hours (30 days).",
3941
),
4042
max_ttl_ms: Yup.number()
4143
.integer()
44+
.required()
4245
.min(0, "Maximum time until autostop must not be less than 0.")
4346
.max(
4447
24 * MAX_TTL_DAYS /* 30 days in hours */,
4548
"Please enter a limit that is less than or equal to 720 hours (30 days).",
4649
),
4750
failure_ttl_ms: Yup.number()
51+
.integer()
52+
.required()
4853
.min(0, "Failure cleanup days must not be less than 0.")
4954
.test(
5055
"positive-if-enabled",
@@ -59,6 +64,8 @@ export const getValidationSchema = (): Yup.AnyObjectSchema =>
5964
},
6065
),
6166
time_til_dormant_ms: Yup.number()
67+
.integer()
68+
.required()
6269
.min(0, "Dormancy threshold days must not be less than 0.")
6370
.test(
6471
"positive-if-enabled",
@@ -73,6 +80,8 @@ export const getValidationSchema = (): Yup.AnyObjectSchema =>
7380
},
7481
),
7582
time_til_dormant_autodelete_ms: Yup.number()
83+
.integer()
84+
.required()
7685
.min(0, "Dormancy auto-deletion days must not be less than 0.")
7786
.test(
7887
"positive-if-enabled",

0 commit comments

Comments
 (0)