mirror of
https://github.com/ansible/awx.git
synced 2026-04-07 02:59:21 -02:30
Add new common inventory source fields
This commit is contained in:
committed by
Ryan Petrello
parent
12cf607e8a
commit
2fdeba47a5
@@ -39,6 +39,9 @@ function InventorySourceDetail({ inventorySource, i18n }) {
|
|||||||
update_on_launch,
|
update_on_launch,
|
||||||
update_on_project_update,
|
update_on_project_update,
|
||||||
verbosity,
|
verbosity,
|
||||||
|
enabled_var,
|
||||||
|
enabled_value,
|
||||||
|
host_filter,
|
||||||
summary_fields: {
|
summary_fields: {
|
||||||
created_by,
|
created_by,
|
||||||
credentials,
|
credentials,
|
||||||
@@ -220,6 +223,9 @@ function InventorySourceDetail({ inventorySource, i18n }) {
|
|||||||
label={i18n._(t`Cache timeout`)}
|
label={i18n._(t`Cache timeout`)}
|
||||||
value={`${update_cache_timeout} ${i18n._(t`seconds`)}`}
|
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 && (
|
{credentials?.length > 0 && (
|
||||||
<Detail
|
<Detail
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ const InventorySourceFormFields = ({ sourceOptions, i18n }) => {
|
|||||||
update_on_launch: false,
|
update_on_launch: false,
|
||||||
update_on_project_update: false,
|
update_on_project_update: false,
|
||||||
verbosity: 1,
|
verbosity: 1,
|
||||||
|
enabled_var: '',
|
||||||
|
enabled_value: '',
|
||||||
|
host_filter: '',
|
||||||
};
|
};
|
||||||
Object.keys(defaults).forEach(label => {
|
Object.keys(defaults).forEach(label => {
|
||||||
setFieldValue(label, defaults[label]);
|
setFieldValue(label, defaults[label]);
|
||||||
@@ -209,6 +212,9 @@ const InventorySourceForm = ({
|
|||||||
update_on_launch: source?.update_on_launch || false,
|
update_on_launch: source?.update_on_launch || false,
|
||||||
update_on_project_update: source?.update_on_project_update || false,
|
update_on_project_update: source?.update_on_project_update || false,
|
||||||
verbosity: source?.verbosity || 1,
|
verbosity: source?.verbosity || 1,
|
||||||
|
enabled_var: source?.enabled_var || '',
|
||||||
|
enabled_value: source?.enabled_value || '',
|
||||||
|
host_filter: source?.host_filter || '',
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -3,7 +3,14 @@ import { useField } from 'formik';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
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 AzureSubForm = ({ i18n }) => {
|
||||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||||
@@ -25,6 +32,9 @@ const AzureSubForm = ({ i18n }) => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<VerbosityField />
|
<VerbosityField />
|
||||||
|
<HostFilterField />
|
||||||
|
<EnabledVarField />
|
||||||
|
<EnabledValueField />
|
||||||
<OptionsField />
|
<OptionsField />
|
||||||
<SourceVarsField />
|
<SourceVarsField />
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -3,7 +3,14 @@ import { useField } from 'formik';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
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 CloudFormsSubForm = ({ i18n }) => {
|
||||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||||
@@ -25,6 +32,9 @@ const CloudFormsSubForm = ({ i18n }) => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<VerbosityField />
|
<VerbosityField />
|
||||||
|
<HostFilterField />
|
||||||
|
<EnabledVarField />
|
||||||
|
<EnabledValueField />
|
||||||
<OptionsField />
|
<OptionsField />
|
||||||
<SourceVarsField />
|
<SourceVarsField />
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -3,7 +3,14 @@ import { useField } from 'formik';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
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 EC2SubForm = ({ i18n }) => {
|
||||||
const [credentialField, , credentialHelpers] = useField('credential');
|
const [credentialField, , credentialHelpers] = useField('credential');
|
||||||
@@ -18,6 +25,9 @@ const EC2SubForm = ({ i18n }) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<VerbosityField />
|
<VerbosityField />
|
||||||
|
<HostFilterField />
|
||||||
|
<EnabledVarField />
|
||||||
|
<EnabledValueField />
|
||||||
<OptionsField />
|
<OptionsField />
|
||||||
<SourceVarsField />
|
<SourceVarsField />
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -3,7 +3,13 @@ import { useField } from 'formik';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||||
import { OptionsField, VerbosityField } from './SharedFields';
|
import {
|
||||||
|
OptionsField,
|
||||||
|
VerbosityField,
|
||||||
|
EnabledVarField,
|
||||||
|
EnabledValueField,
|
||||||
|
HostFilterField,
|
||||||
|
} from './SharedFields';
|
||||||
|
|
||||||
const GCESubForm = ({ i18n }) => {
|
const GCESubForm = ({ i18n }) => {
|
||||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||||
@@ -25,6 +31,9 @@ const GCESubForm = ({ i18n }) => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<VerbosityField />
|
<VerbosityField />
|
||||||
|
<HostFilterField />
|
||||||
|
<EnabledVarField />
|
||||||
|
<EnabledValueField />
|
||||||
<OptionsField />
|
<OptionsField />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,14 @@ import { useField } from 'formik';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
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 OpenStackSubForm = ({ i18n }) => {
|
||||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||||
@@ -25,6 +32,9 @@ const OpenStackSubForm = ({ i18n }) => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<VerbosityField />
|
<VerbosityField />
|
||||||
|
<HostFilterField />
|
||||||
|
<EnabledVarField />
|
||||||
|
<EnabledValueField />
|
||||||
<OptionsField />
|
<OptionsField />
|
||||||
<SourceVarsField />
|
<SourceVarsField />
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -11,7 +11,14 @@ import AnsibleSelect from '../../../../components/AnsibleSelect';
|
|||||||
import { FieldTooltip } from '../../../../components/FormField';
|
import { FieldTooltip } from '../../../../components/FormField';
|
||||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||||
import ProjectLookup from '../../../../components/Lookup/ProjectLookup';
|
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 SCMSubForm = ({ i18n }) => {
|
||||||
const [credentialField, , credentialHelpers] = useField('credential');
|
const [credentialField, , credentialHelpers] = useField('credential');
|
||||||
@@ -121,6 +128,9 @@ const SCMSubForm = ({ i18n }) => {
|
|||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<VerbosityField />
|
<VerbosityField />
|
||||||
|
<HostFilterField />
|
||||||
|
<EnabledVarField />
|
||||||
|
<EnabledValueField />
|
||||||
<OptionsField showProjectUpdate />
|
<OptionsField showProjectUpdate />
|
||||||
<SourceVarsField />
|
<SourceVarsField />
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -3,7 +3,14 @@ import { useField } from 'formik';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
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 SatelliteSubForm = ({ i18n }) => {
|
||||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||||
@@ -25,6 +32,9 @@ const SatelliteSubForm = ({ i18n }) => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<VerbosityField />
|
<VerbosityField />
|
||||||
|
<HostFilterField />
|
||||||
|
<EnabledVarField />
|
||||||
|
<EnabledValueField />
|
||||||
<OptionsField />
|
<OptionsField />
|
||||||
<SourceVarsField />
|
<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 { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||||
import { OptionsField, VerbosityField } from './SharedFields';
|
import {
|
||||||
|
OptionsField,
|
||||||
|
VerbosityField,
|
||||||
|
EnabledVarField,
|
||||||
|
EnabledValueField,
|
||||||
|
HostFilterField,
|
||||||
|
} from './SharedFields';
|
||||||
|
|
||||||
const TowerSubForm = ({ i18n }) => {
|
const TowerSubForm = ({ i18n }) => {
|
||||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||||
@@ -25,6 +31,9 @@ const TowerSubForm = ({ i18n }) => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<VerbosityField />
|
<VerbosityField />
|
||||||
|
<HostFilterField />
|
||||||
|
<EnabledVarField />
|
||||||
|
<EnabledValueField />
|
||||||
<OptionsField />
|
<OptionsField />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,14 @@ import { useField } from 'formik';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
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 VMwareSubForm = ({ i18n }) => {
|
||||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||||
@@ -25,6 +32,9 @@ const VMwareSubForm = ({ i18n }) => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<VerbosityField />
|
<VerbosityField />
|
||||||
|
<HostFilterField />
|
||||||
|
<EnabledVarField />
|
||||||
|
<EnabledValueField />
|
||||||
<OptionsField />
|
<OptionsField />
|
||||||
<SourceVarsField />
|
<SourceVarsField />
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -3,7 +3,13 @@ import { useField } from 'formik';
|
|||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
import CredentialLookup from '../../../../components/Lookup/CredentialLookup';
|
||||||
import { OptionsField, VerbosityField } from './SharedFields';
|
import {
|
||||||
|
OptionsField,
|
||||||
|
VerbosityField,
|
||||||
|
EnabledVarField,
|
||||||
|
EnabledValueField,
|
||||||
|
HostFilterField,
|
||||||
|
} from './SharedFields';
|
||||||
|
|
||||||
const VirtualizationSubForm = ({ i18n }) => {
|
const VirtualizationSubForm = ({ i18n }) => {
|
||||||
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
const [credentialField, credentialMeta, credentialHelpers] = useField(
|
||||||
@@ -25,6 +31,9 @@ const VirtualizationSubForm = ({ i18n }) => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<VerbosityField />
|
<VerbosityField />
|
||||||
|
<HostFilterField />
|
||||||
|
<EnabledVarField />
|
||||||
|
<EnabledValueField />
|
||||||
<OptionsField />
|
<OptionsField />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user