mirror of
https://github.com/ansible/awx.git
synced 2024-10-27 17:55:10 +03:00
Add cache timeout and inventory file validation
This commit is contained in:
parent
4b53875a71
commit
58c85ab03f
@ -38,9 +38,9 @@ const SCMSubForm = ({ i18n }) => {
|
||||
|
||||
const handleProjectUpdate = useCallback(
|
||||
value => {
|
||||
sourcePathHelpers.setValue('');
|
||||
projectHelpers.setValue(value);
|
||||
fetchSourcePath(value.id);
|
||||
sourcePathHelpers.setValue('');
|
||||
},
|
||||
[] // eslint-disable-line react-hooks/exhaustive-deps
|
||||
);
|
||||
@ -67,9 +67,8 @@ const SCMSubForm = ({ i18n }) => {
|
||||
fieldId="source_path"
|
||||
helperTextInvalid={sourcePathError?.message || sourcePathMeta.error}
|
||||
isValid={
|
||||
!sourcePathError?.message ||
|
||||
!sourcePathMeta.error ||
|
||||
!sourcePathMeta.touched
|
||||
(!sourcePathMeta.error || !sourcePathMeta.touched) &&
|
||||
!sourcePathError?.message
|
||||
}
|
||||
isRequired
|
||||
label={i18n._(t`Inventory file`)}
|
||||
@ -82,7 +81,10 @@ const SCMSubForm = ({ i18n }) => {
|
||||
<AnsibleSelect
|
||||
{...sourcePathField}
|
||||
id="source_path"
|
||||
isValid={!sourcePathMeta.touched || !sourcePathMeta.error}
|
||||
isValid={
|
||||
(!sourcePathMeta.error || !sourcePathMeta.touched) &&
|
||||
!sourcePathError?.message
|
||||
}
|
||||
data={[
|
||||
{
|
||||
value: '',
|
||||
|
@ -1,7 +1,8 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import { useField } from 'formik';
|
||||
import { minMaxValue } from '@util/validators';
|
||||
import { FormGroup } from '@patternfly/react-core';
|
||||
import AnsibleSelect from '@components/AnsibleSelect';
|
||||
import { VariablesField } from '@components/CodeMirrorInput';
|
||||
@ -36,7 +37,7 @@ export const VerbosityField = withI18n()(({ i18n }) => {
|
||||
label={i18n._(t`Verbosity`)}
|
||||
>
|
||||
<FieldTooltip
|
||||
content={i18n._(t`Control the level of output ansible
|
||||
content={i18n._(t`Control the level of output Ansible
|
||||
will produce for inventory source update jobs.`)}
|
||||
/>
|
||||
<AnsibleSelect
|
||||
@ -51,6 +52,14 @@ export const VerbosityField = withI18n()(({ i18n }) => {
|
||||
|
||||
export const OptionsField = withI18n()(({ i18n }) => {
|
||||
const [updateOnLaunchField] = useField('update_on_launch');
|
||||
const [, , updateCacheTimeoutHelper] = useField('update_cache_timeout');
|
||||
|
||||
useEffect(() => {
|
||||
if (!updateOnLaunchField.value) {
|
||||
updateCacheTimeoutHelper.setValue(0);
|
||||
}
|
||||
}, [updateOnLaunchField.value]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
return (
|
||||
<>
|
||||
<FormFullWidthLayout>
|
||||
@ -123,6 +132,8 @@ export const OptionsField = withI18n()(({ i18n }) => {
|
||||
name="update_cache_timeout"
|
||||
type="number"
|
||||
min="0"
|
||||
max="2147483647"
|
||||
validate={minMaxValue(0, 2147483647, i18n)}
|
||||
label={i18n._(t`Cache timeout (seconds)`)}
|
||||
tooltip={i18n._(t`Time in seconds to consider an inventory sync
|
||||
to be current. During job runs and callbacks the task system will
|
||||
|
Loading…
Reference in New Issue
Block a user