mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Add back min zero value, add validation (#103898)
This commit is contained in:
parent
2576d61fef
commit
ffc207281f
2 changed files with 20 additions and 2 deletions
|
@ -63,6 +63,15 @@ export const agentPolicyFormValidation = (
|
|||
errors.namespace = [namespaceValidation.error];
|
||||
}
|
||||
|
||||
if (agentPolicy.unenroll_timeout && agentPolicy.unenroll_timeout < 0) {
|
||||
errors.unenroll_timeout = [
|
||||
<FormattedMessage
|
||||
id="xpack.fleet.agentPolicyForm.unenrollTimeoutMinValueErrorMessage"
|
||||
defaultMessage="Timeout must be greater than zero."
|
||||
/>,
|
||||
];
|
||||
}
|
||||
|
||||
return errors;
|
||||
};
|
||||
|
||||
|
@ -314,11 +323,20 @@ export const AgentPolicyForm: React.FunctionComponent<Props> = ({
|
|||
/>
|
||||
}
|
||||
>
|
||||
<EuiFormRow fullWidth>
|
||||
<EuiFormRow
|
||||
fullWidth
|
||||
error={
|
||||
touchedFields.unenroll_timeout && validation.unenroll_timeout
|
||||
? validation.unenroll_timeout
|
||||
: null
|
||||
}
|
||||
isInvalid={Boolean(touchedFields.unenroll_timeout && validation.unenroll_timeout)}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
fullWidth
|
||||
disabled={agentPolicy.is_managed === true}
|
||||
value={agentPolicy.unenroll_timeout || ''}
|
||||
min={0}
|
||||
onChange={(e) => {
|
||||
updateAgentPolicy({
|
||||
unenroll_timeout: e.target.value ? Number(e.target.value) : 0,
|
||||
|
|
|
@ -16,7 +16,7 @@ export const AgentPolicyBaseSchema = {
|
|||
namespace: NamespaceSchema,
|
||||
description: schema.maybe(schema.string()),
|
||||
is_managed: schema.maybe(schema.boolean()),
|
||||
unenroll_timeout: schema.maybe(schema.number()),
|
||||
unenroll_timeout: schema.maybe(schema.number({ min: 0 })),
|
||||
monitoring_enabled: schema.maybe(
|
||||
schema.arrayOf(
|
||||
schema.oneOf([schema.literal(dataTypes.Logs), schema.literal(dataTypes.Metrics)])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue