validation helper texts and input type
This commit is contained in:
1 parent
b247fabde0
commit
aecddb22bb
2 files changed
+10
-6
No files matched your search
@@ -163,6 +163,7 @@ const CreateNewMaintenanceWindow = () => {
|
|||||||
placeholder="60"
|
placeholder="60"
|
||||||
onChange={(e) => handleChange(e, "duration")}
|
onChange={(e) => handleChange(e, "duration")}
|
||||||
value={values.duration}
|
value={values.duration}
|
||||||
|
error={errors.duration}
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
onChange={(e) => handleChange(e, "unit")}
|
onChange={(e) => handleChange(e, "unit")}
|
||||||
@@ -181,6 +182,7 @@ const CreateNewMaintenanceWindow = () => {
|
|||||||
placeholder="Maintanence at __ : __ for ___ minutes"
|
placeholder="Maintanence at __ : __ for ___ minutes"
|
||||||
value={values.friendlyName}
|
value={values.friendlyName}
|
||||||
onChange={(e) => handleChange(e, "friendlyName")}
|
onChange={(e) => handleChange(e, "friendlyName")}
|
||||||
|
error={errors.friendlyName}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -197,6 +199,7 @@ const CreateNewMaintenanceWindow = () => {
|
|||||||
placeholder="Start typing to search for current monitors"
|
placeholder="Start typing to search for current monitors"
|
||||||
value={values.AddMonitors}
|
value={values.AddMonitors}
|
||||||
onChange={(e) => handleChange(e, "AddMonitors")}
|
onChange={(e) => handleChange(e, "AddMonitors")}
|
||||||
|
error={errors.addMonitors}
|
||||||
/>
|
/>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ const maintenanceWindowValidation = joi.object({
|
|||||||
"any.required": "Start time is required.",
|
"any.required": "Start time is required.",
|
||||||
}),
|
}),
|
||||||
duration: joi.number().required().messages({
|
duration: joi.number().required().messages({
|
||||||
|
"number.empty": "duration is required.",
|
||||||
"number.base": "Duration must be a number.",
|
"number.base": "Duration must be a number.",
|
||||||
"any.required": "Duration is required.",
|
"any.required": "Duration is required.",
|
||||||
}),
|
}),
|
||||||
@@ -127,13 +128,13 @@ const maintenanceWindowValidation = joi.object({
|
|||||||
"any.only": "Unit must be one of ['minutes', 'hours', 'days'].",
|
"any.only": "Unit must be one of ['minutes', 'hours', 'days'].",
|
||||||
"any.required": "Unit is required.",
|
"any.required": "Unit is required.",
|
||||||
}),
|
}),
|
||||||
friendlyName: joi.string().required().max(100).messages({
|
friendlyName: joi.string().max(50).required().messages({
|
||||||
"string.max": "Friendly name must be less than 100 characters.",
|
"string.empty": "Friendly name is required.",
|
||||||
"any.required": "Friendly name is required.",
|
"string.max": "Friendly name must be less than 50 characters long",
|
||||||
}),
|
}),
|
||||||
addMonitors: joi.string().required().messages({
|
addMonitors: joi.string().max(50).required().messages({
|
||||||
"string.base": "Add monitors must be a string.",
|
"string.empty": "Add monitors is required.",
|
||||||
"any.required": "Add monitors is required.",
|
"string.max": "Add monitors must be less than 50 characters long",
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user