From 2fdeba47a5ff90bab4f89b8097209493415f0048 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Tue, 4 Aug 2020 17:35:12 -0400 Subject: [PATCH] Add new common inventory source fields --- .../InventorySourceDetail.jsx | 6 +++ .../Inventory/shared/InventorySourceForm.jsx | 6 +++ .../InventorySourceSubForms/AzureSubForm.jsx | 12 +++++- .../CloudFormsSubForm.jsx | 12 +++++- .../InventorySourceSubForms/EC2SubForm.jsx | 12 +++++- .../InventorySourceSubForms/GCESubForm.jsx | 11 ++++- .../OpenStackSubForm.jsx | 12 +++++- .../InventorySourceSubForms/SCMSubForm.jsx | 12 +++++- .../SatelliteSubForm.jsx | 12 +++++- .../InventorySourceSubForms/SharedFields.jsx | 41 +++++++++++++++++++ .../InventorySourceSubForms/TowerSubForm.jsx | 11 ++++- .../InventorySourceSubForms/VMwareSubForm.jsx | 12 +++++- .../VirtualizationSubForm.jsx | 11 ++++- 13 files changed, 160 insertions(+), 10 deletions(-) diff --git a/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.jsx b/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.jsx index badd28fb26..a67c3c2064 100644 --- a/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.jsx +++ b/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.jsx @@ -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`)}`} /> + + + {credentials?.length > 0 && ( { 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 { diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/AzureSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/AzureSubForm.jsx index 99b83ca6b5..535b364691 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/AzureSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/AzureSubForm.jsx @@ -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 /> + + + diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.jsx index 68aeed4d76..7db4431fdd 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.jsx @@ -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 /> + + + diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/EC2SubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/EC2SubForm.jsx index 32fc581742..33447a2229 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/EC2SubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/EC2SubForm.jsx @@ -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 }) => { }} /> + + + diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/GCESubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/GCESubForm.jsx index fcbbffa040..a6c8ce5cbd 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/GCESubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/GCESubForm.jsx @@ -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 /> + + + ); diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/OpenStackSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/OpenStackSubForm.jsx index 7c61fb5d16..55a142e936 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/OpenStackSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/OpenStackSubForm.jsx @@ -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 /> + + + diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx index b338088a8d..858e209cc5 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SCMSubForm.jsx @@ -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 }) => { /> + + + diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SatelliteSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SatelliteSubForm.jsx index 641539f978..573be61679 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SatelliteSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SatelliteSubForm.jsx @@ -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 /> + + + diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SharedFields.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SharedFields.jsx index 3ca698641b..14e0bbd896 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SharedFields.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/SharedFields.jsx @@ -154,3 +154,44 @@ export const OptionsField = withI18n()( ); } ); + +export const EnabledVarField = withI18n()(({ i18n }) => { + return ( + + ); +}); + +export const EnabledValueField = withI18n()(({ i18n }) => { + return ( + + ); +}); + +export const HostFilterField = withI18n()(({ i18n }) => { + return ( + + ); +}); diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/TowerSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/TowerSubForm.jsx index 3af0f9a5c6..0dd6d7be52 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/TowerSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/TowerSubForm.jsx @@ -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 /> + + + ); diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/VMwareSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/VMwareSubForm.jsx index 555b0498e3..08f1342cfe 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/VMwareSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/VMwareSubForm.jsx @@ -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 /> + + + diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/VirtualizationSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/VirtualizationSubForm.jsx index 4d558b74a6..fda2a58ec9 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/VirtualizationSubForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/VirtualizationSubForm.jsx @@ -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 /> + + + );