- handle Validation onBlur , special cases for usage numbers required on condition of checkbox checked
- handle generate payload correspondant to BE format - comment out retain log period,retry max and 3 other usage threshold currently not avalable yet in BE
This commit is contained in:
1 parent
df7813c6aa
commit
9237f46e7c
3 files changed
+168
-119
No files matched your search
@@ -26,6 +26,10 @@ const hasValidationErrors = (form, validation, setErrors) => {
|
||||
) {
|
||||
newErrors[err.path[0]] = err.message ?? "Validation error";
|
||||
}
|
||||
// Handle conditionally usage number required cases
|
||||
if (!form.cpu || (form.cpu && form.usage_cpu)) {
|
||||
delete newErrors["usage_cpu"];
|
||||
}
|
||||
});
|
||||
if (Object.keys(newErrors).length > 0) {
|
||||
setErrors(newErrors);
|
||||
|
||||
@@ -181,10 +181,14 @@ const infrastractureMonitorValidation = joi.object({
|
||||
name: joi.string().trim().max(50).allow("").messages({
|
||||
"string.max": "This field should not exceed the 50 characters limit.",
|
||||
}),
|
||||
type: joi.string().trim().messages({ "string.empty": "This field is required." }),
|
||||
usage_cpu: joi.number(),
|
||||
usage_memory: joi.number(),
|
||||
usage_disk: joi.number(),
|
||||
secret: joi.string().trim().messages({ "string.empty": "This field is required." }),
|
||||
usage_cpu: joi.number().messages({
|
||||
"number.base": "CPU threshold must be a number.",
|
||||
"any.required": "CPU threshold is required.",
|
||||
}),
|
||||
cpu:joi.boolean(),
|
||||
// usage_memory: joi.number(),
|
||||
// usage_disk: joi.number(),
|
||||
// usage_temperature: joi.number().messages({
|
||||
// "number.base": "Temperature must be a number.",
|
||||
// }),
|
||||
@@ -194,6 +198,10 @@ const infrastractureMonitorValidation = joi.object({
|
||||
// usage_swap: joi.number().messages({
|
||||
// "number.base": "Swap used must be a number.",
|
||||
// }),
|
||||
interval: joi.number().messages({
|
||||
"number.base": "Frequency must be a number.",
|
||||
"any.required": "Frequency is required.",
|
||||
}),
|
||||
});
|
||||
|
||||
export {
|
||||
|
||||
Reference in new issue
Block a user