convert percentage to decimal before submitting

This commit is contained in:
Alex Holliday committed 2024-11-22 12:23:24 +08:00
1 parent b9cfbd7a74
commit 6337cd6462
1 file changed
+2 -1
@@ -132,7 +132,7 @@ const CreateInfrastructureMonitor = () => {
Object.keys(form) Object.keys(form)
.filter((k) => k.startsWith(THRESHOLD_FIELD_PREFIX)) .filter((k) => k.startsWith(THRESHOLD_FIELD_PREFIX))
.map((k) => { .map((k) => {
if (form[k]) thresholds[k] = form[k]; if (form[k]) thresholds[k] = form[k] / 100;
delete form[k]; delete form[k];
delete form[k.substring(THRESHOLD_FIELD_PREFIX.length)]; delete form[k.substring(THRESHOLD_FIELD_PREFIX.length)];
}); });
@@ -158,6 +158,7 @@ const CreateInfrastructureMonitor = () => {
: infrastructureMonitor.name, : infrastructureMonitor.name,
interval: infrastructureMonitor.interval * MS_PER_MINUTE, interval: infrastructureMonitor.interval * MS_PER_MINUTE,
}; };
delete form.notifications; delete form.notifications;
if (hasValidationErrors(form, infrastructureMonitorValidation, setErrors)) { if (hasValidationErrors(form, infrastructureMonitorValidation, setErrors)) {
return; return;