From 912666b45c4af53e65c93dc424b379b15b58651f Mon Sep 17 00:00:00 2001 From: Jen Huang Date: Wed, 28 Aug 2024 14:05:11 -0700 Subject: [PATCH] [UII] Fix client-side validation for agent policy timeout fields (#191674) ## Summary Resolves #191583. Adjusts the client-side validation for agent policy timeout fields so that it correctly returns an error when non-numeric input is encountered, or when input is 0. (cherry picked from commit f29bf1c3113de90fc0ca08bf7a59a33d53638940) # Conflicts: # x-pack/plugins/translations/translations/fr-FR.json # x-pack/plugins/translations/translations/ja-JP.json # x-pack/plugins/translations/translations/zh-CN.json --- .../agent_policy/components/agent_policy_validation.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_validation.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_validation.tsx index 4ba769c311523..7791a299e6d40 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_validation.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_validation.tsx @@ -33,20 +33,20 @@ export const agentPolicyFormValidation = ( errors.namespace = [namespaceValidation.error]; } - if (agentPolicy.unenroll_timeout && agentPolicy.unenroll_timeout < 0) { + if (agentPolicy.unenroll_timeout !== undefined && agentPolicy.unenroll_timeout <= 0) { errors.unenroll_timeout = [ , ]; } - if (agentPolicy.inactivity_timeout && agentPolicy.inactivity_timeout < 0) { + if (agentPolicy.inactivity_timeout !== undefined && agentPolicy.inactivity_timeout <= 0) { errors.inactivity_timeout = [ , ]; }