mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 19:30:39 -03:30
Add new common inventory source fields
This commit is contained in:
parent
12cf607e8a
commit
2fdeba47a5
@ -39,6 +39,9 @@ function InventorySourceDetail({ inventorySource, i18n }) {
|
||||
update_on_launch,
|
||||
update_on_project_update,
|
||||
verbosity,
|
||||
enabled_var,
|
||||
enabled_value,
|
||||
host_filter,
|
||||
summary_fields: {
|
||||
created_by,
|
||||
credentials,
|
||||
@ -220,6 +223,9 @@ function InventorySourceDetail({ inventorySource, i18n }) {
|
||||
label={i18n._(t`Cache timeout`)}
|
||||
value={`${update_cache_timeout} ${i18n._(t`seconds`)}`}
|
||||
/>
|
||||
<Detail label={i18n._(t`Host Filter`)} value={host_filter} />
|
||||
<Detail label={i18n._(t`Enabled Variable`)} value={enabled_var} />
|
||||
<Detail label={i18n._(t`Enabled Value`)} value={enabled_value} />
|
||||
{credentials?.length > 0 && (
|
||||
<Detail
|
||||
fullWidth
|
||||
|
||||
@ -86,6 +86,9 @@ const InventorySourceFormFields = ({ sourceOptions, i18n }) => {
|
||||
update_on_launch: false,
|
||||
update_on_project_update: false,
|
||||
verbosity: 1,
|
||||
enabled_var: '',
|
||||
enabled_value: '',
|
||||
host_filter: '',
|
||||
};
|
||||
Object.keys(defaults).forEach(label => {
|
||||
setFieldValue(label, defaults[label]);
|
||||
@ -209,6 +212,9 @@ const InventorySourceForm = ({
|
||||
update_on_launch: source?.update_on_launch || false,
|
||||
update_on_project_update: source?.update_on_project_update || false,
|
||||
verbosity: source?.verbosity || 1,
|
||||
enabled_var: source?.enabled_var || '',
|
||||
enabled_value: source?.enabled_value || '',
|
||||
host_filter: source?.host_filter || '',
|
||||
};
|
||||
|
||||
const {
|
||||
|
||||
@ -3,7 +3,14 @@ import { useField } from 'formik';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||
import { OptionsField, SourceVarsField, VerbosityField } from './SharedFields';
|
||||
import {
|
||||
OptionsField,
|
||||
SourceVarsField,
|
||||
VerbosityField,
|
||||
EnabledVarField,
|
||||
EnabledValueField,
|
||||
HostFilterField,
|
||||
} from './SharedFields';
|
||||
|
||||
const AzureSubForm = ({ i18n }) => {
|
||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||
@ -25,6 +32,9 @@ const AzureSubForm = ({ i18n }) => {
|
||||
required
|
||||
/>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField />
|
||||
<SourceVarsField />
|
||||
</>
|
||||
|
||||
@ -3,7 +3,14 @@ import { useField } from 'formik';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||
import { OptionsField, SourceVarsField, VerbosityField } from './SharedFields';
|
||||
import {
|
||||
OptionsField,
|
||||
SourceVarsField,
|
||||
VerbosityField,
|
||||
EnabledVarField,
|
||||
EnabledValueField,
|
||||
HostFilterField,
|
||||
} from './SharedFields';
|
||||
|
||||
const CloudFormsSubForm = ({ i18n }) => {
|
||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||
@ -25,6 +32,9 @@ const CloudFormsSubForm = ({ i18n }) => {
|
||||
required
|
||||
/>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField />
|
||||
<SourceVarsField />
|
||||
</>
|
||||
|
||||
@ -3,7 +3,14 @@ import { useField } from 'formik';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||
import { OptionsField, SourceVarsField, VerbosityField } from './SharedFields';
|
||||
import {
|
||||
OptionsField,
|
||||
SourceVarsField,
|
||||
VerbosityField,
|
||||
EnabledVarField,
|
||||
EnabledValueField,
|
||||
HostFilterField,
|
||||
} from './SharedFields';
|
||||
|
||||
const EC2SubForm = ({ i18n }) => {
|
||||
const [credentialField, , credentialHelpers] = useField('credential');
|
||||
@ -18,6 +25,9 @@ const EC2SubForm = ({ i18n }) => {
|
||||
}}
|
||||
/>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField />
|
||||
<SourceVarsField />
|
||||
</>
|
||||
|
||||
@ -3,7 +3,13 @@ import { useField } from 'formik';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||
import { OptionsField, VerbosityField } from './SharedFields';
|
||||
import {
|
||||
OptionsField,
|
||||
VerbosityField,
|
||||
EnabledVarField,
|
||||
EnabledValueField,
|
||||
HostFilterField,
|
||||
} from './SharedFields';
|
||||
|
||||
const GCESubForm = ({ i18n }) => {
|
||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||
@ -25,6 +31,9 @@ const GCESubForm = ({ i18n }) => {
|
||||
required
|
||||
/>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField />
|
||||
</>
|
||||
);
|
||||
|
||||
@ -3,7 +3,14 @@ import { useField } from 'formik';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||
import { OptionsField, SourceVarsField, VerbosityField } from './SharedFields';
|
||||
import {
|
||||
OptionsField,
|
||||
SourceVarsField,
|
||||
VerbosityField,
|
||||
EnabledVarField,
|
||||
EnabledValueField,
|
||||
HostFilterField,
|
||||
} from './SharedFields';
|
||||
|
||||
const OpenStackSubForm = ({ i18n }) => {
|
||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||
@ -25,6 +32,9 @@ const OpenStackSubForm = ({ i18n }) => {
|
||||
required
|
||||
/>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField />
|
||||
<SourceVarsField />
|
||||
</>
|
||||
|
||||
@ -11,7 +11,14 @@ import AnsibleSelect from '../../../../components/AnsibleSelect';
|
||||
import { FieldTooltip } from '../../../../components/FormField';
|
||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||
import ProjectLookup from '../../../../components/Lookup/ProjectLookup';
|
||||
import { VerbosityField, OptionsField, SourceVarsField } from './SharedFields';
|
||||
import {
|
||||
OptionsField,
|
||||
SourceVarsField,
|
||||
VerbosityField,
|
||||
EnabledVarField,
|
||||
EnabledValueField,
|
||||
HostFilterField,
|
||||
} from './SharedFields';
|
||||
|
||||
const SCMSubForm = ({ i18n }) => {
|
||||
const [credentialField, , credentialHelpers] = useField('credential');
|
||||
@ -121,6 +128,9 @@ const SCMSubForm = ({ i18n }) => {
|
||||
/>
|
||||
</FormGroup>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField showProjectUpdate />
|
||||
<SourceVarsField />
|
||||
</>
|
||||
|
||||
@ -3,7 +3,14 @@ import { useField } from 'formik';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||
import { OptionsField, SourceVarsField, VerbosityField } from './SharedFields';
|
||||
import {
|
||||
OptionsField,
|
||||
SourceVarsField,
|
||||
VerbosityField,
|
||||
EnabledVarField,
|
||||
EnabledValueField,
|
||||
HostFilterField,
|
||||
} from './SharedFields';
|
||||
|
||||
const SatelliteSubForm = ({ i18n }) => {
|
||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||
@ -25,6 +32,9 @@ const SatelliteSubForm = ({ i18n }) => {
|
||||
required
|
||||
/>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField />
|
||||
<SourceVarsField />
|
||||
</>
|
||||
|
||||
@ -154,3 +154,44 @@ export const OptionsField = withI18n()(
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
export const EnabledVarField = withI18n()(({ i18n }) => {
|
||||
return (
|
||||
<FormField
|
||||
id="inventory-enabled-var"
|
||||
label={i18n._(t`Enabled Variable`)}
|
||||
tooltip={i18n._(t`Retrieve the enabled state from the given dict of host variables.
|
||||
The enabled variable may be specified using dot notation, e.g: 'foo.bar'`)}
|
||||
name="enabled_var"
|
||||
type="text"
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
export const EnabledValueField = withI18n()(({ i18n }) => {
|
||||
return (
|
||||
<FormField
|
||||
id="inventory-enabled-value"
|
||||
label={i18n._(t`Enabled Value`)}
|
||||
tooltip={i18n._(
|
||||
t`If the enabled variable matches this value, the host will be enabled on import.`
|
||||
)}
|
||||
name="enabled_value"
|
||||
type="text"
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
export const HostFilterField = withI18n()(({ i18n }) => {
|
||||
return (
|
||||
<FormField
|
||||
id="host-filter"
|
||||
label={i18n._(t`Host Filter`)}
|
||||
tooltip={i18n._(
|
||||
t`Regular expression where only matching hosts will be imported.`
|
||||
)}
|
||||
name="host_filter"
|
||||
type="text"
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
@ -3,7 +3,13 @@ import { useField } from 'formik';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||
import { OptionsField, VerbosityField } from './SharedFields';
|
||||
import {
|
||||
OptionsField,
|
||||
VerbosityField,
|
||||
EnabledVarField,
|
||||
EnabledValueField,
|
||||
HostFilterField,
|
||||
} from './SharedFields';
|
||||
|
||||
const TowerSubForm = ({ i18n }) => {
|
||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||
@ -25,6 +31,9 @@ const TowerSubForm = ({ i18n }) => {
|
||||
required
|
||||
/>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField />
|
||||
</>
|
||||
);
|
||||
|
||||
@ -3,7 +3,14 @@ import { useField } from 'formik';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||
import { OptionsField, SourceVarsField, VerbosityField } from './SharedFields';
|
||||
import {
|
||||
OptionsField,
|
||||
SourceVarsField,
|
||||
VerbosityField,
|
||||
EnabledVarField,
|
||||
EnabledValueField,
|
||||
HostFilterField,
|
||||
} from './SharedFields';
|
||||
|
||||
const VMwareSubForm = ({ i18n }) => {
|
||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||
@ -25,6 +32,9 @@ const VMwareSubForm = ({ i18n }) => {
|
||||
required
|
||||
/>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField />
|
||||
<SourceVarsField />
|
||||
</>
|
||||
|
||||
@ -3,7 +3,13 @@ import { useField } from 'formik';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||
import { OptionsField, VerbosityField } from './SharedFields';
|
||||
import {
|
||||
OptionsField,
|
||||
VerbosityField,
|
||||
EnabledVarField,
|
||||
EnabledValueField,
|
||||
HostFilterField,
|
||||
} from './SharedFields';
|
||||
|
||||
const VirtualizationSubForm = ({ i18n }) => {
|
||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||
@ -25,6 +31,9 @@ const VirtualizationSubForm = ({ i18n }) => {
|
||||
required
|
||||
/>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField />
|
||||
</>
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user