From 10ab12c99ad9271ee402b3ba46c1f6ee35182e9b Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Thu, 5 Nov 2020 12:40:03 -0500 Subject: [PATCH] Delete cloudforms --- .../shared/data.credentialTypes.json | 45 ------------ .../InventorySourceAdd.test.jsx | 1 - .../InventorySourceDetail.test.jsx | 1 - .../InventorySourceEdit.test.jsx | 1 - .../Inventory/shared/InventorySourceForm.jsx | 2 - .../shared/InventorySourceForm.test.jsx | 1 - .../CloudFormsSubForm.jsx | 69 ------------------- .../CloudFormsSubForm.test.jsx | 67 ------------------ .../shared/InventorySourceSubForms/index.js | 1 - 9 files changed, 188 deletions(-) delete mode 100644 awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.jsx delete mode 100644 awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.test.jsx diff --git a/awx/ui_next/src/screens/Credential/shared/data.credentialTypes.json b/awx/ui_next/src/screens/Credential/shared/data.credentialTypes.json index 91439a4e86..98db5efeab 100644 --- a/awx/ui_next/src/screens/Credential/shared/data.credentialTypes.json +++ b/awx/ui_next/src/screens/Credential/shared/data.credentialTypes.json @@ -286,51 +286,6 @@ }, "injectors": {} }, - { - "id": 9, - "type": "credential_type", - "url": "/api/v2/credential_types/9/", - "related": { - "credentials": "/api/v2/credential_types/9/credentials/", - "activity_stream": "/api/v2/credential_types/9/activity_stream/" - }, - "summary_fields": { - "user_capabilities": { - "edit": false, - "delete": false - } - }, - "created": "2020-05-18T21:53:35.230367Z", - "modified": "2020-05-18T21:54:05.376824Z", - "name": "Red Hat CloudForms", - "description": "", - "kind": "cloud", - "namespace": "cloudforms", - "managed_by_tower": true, - "inputs": { - "fields": [ - { - "id": "host", - "label": "CloudForms URL", - "type": "string", - "help_text": "Enter the URL for the virtual machine that corresponds to your CloudForms instance. For example, https://cloudforms.example.org" - }, - { - "id": "username", - "label": "Username", - "type": "string" - }, - { - "id": "password", - "label": "Password", - "type": "string", - "secret": true - } - ], - "required": ["host", "username", "password"] - }, - "injectors": {} - }, { "id": 8, "type": "credential_type", diff --git a/awx/ui_next/src/screens/Inventory/InventorySourceAdd/InventorySourceAdd.test.jsx b/awx/ui_next/src/screens/Inventory/InventorySourceAdd/InventorySourceAdd.test.jsx index 5b1d8dcaaa..afc4d69d0e 100644 --- a/awx/ui_next/src/screens/Inventory/InventorySourceAdd/InventorySourceAdd.test.jsx +++ b/awx/ui_next/src/screens/Inventory/InventorySourceAdd/InventorySourceAdd.test.jsx @@ -48,7 +48,6 @@ describe('', () => { ['azure_rm', 'Microsoft Azure Resource Manager'], ['vmware', 'VMware vCenter'], ['satellite6', 'Red Hat Satellite 6'], - ['cloudforms', 'Red Hat CloudForms'], ['openstack', 'OpenStack'], ['rhv', 'Red Hat Virtualization'], ['tower', 'Ansible Tower'], diff --git a/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.test.jsx b/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.test.jsx index 0d7f9a9b79..1071b91cc3 100644 --- a/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.test.jsx +++ b/awx/ui_next/src/screens/Inventory/InventorySourceDetail/InventorySourceDetail.test.jsx @@ -23,7 +23,6 @@ InventorySourcesAPI.readOptions.mockResolvedValue({ ['azure_rm', 'Microsoft Azure Resource Manager'], ['vmware', 'VMware vCenter'], ['satellite6', 'Red Hat Satellite 6'], - ['cloudforms', 'Red Hat CloudForms'], ['openstack', 'OpenStack'], ['rhv', 'Red Hat Virtualization'], ['tower', 'Ansible Tower'], diff --git a/awx/ui_next/src/screens/Inventory/InventorySourceEdit/InventorySourceEdit.test.jsx b/awx/ui_next/src/screens/Inventory/InventorySourceEdit/InventorySourceEdit.test.jsx index 5198c523d3..87ec0288c1 100644 --- a/awx/ui_next/src/screens/Inventory/InventorySourceEdit/InventorySourceEdit.test.jsx +++ b/awx/ui_next/src/screens/Inventory/InventorySourceEdit/InventorySourceEdit.test.jsx @@ -50,7 +50,6 @@ describe('', () => { ['azure_rm', 'Microsoft Azure Resource Manager'], ['vmware', 'VMware vCenter'], ['satellite6', 'Red Hat Satellite 6'], - ['cloudforms', 'Red Hat CloudForms'], ['openstack', 'OpenStack'], ['rhv', 'Red Hat Virtualization'], ['tower', 'Ansible Tower'], diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceForm.jsx index 64580f717e..f1286e9a2b 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceForm.jsx +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceForm.jsx @@ -22,7 +22,6 @@ import Popover from '../../../components/Popover'; import { AzureSubForm, - CloudFormsSubForm, EC2SubForm, GCESubForm, OpenStackSubForm, @@ -178,7 +177,6 @@ const InventorySourceFormFields = ({ source, sourceOptions, i18n }) => { sourceOptions={sourceOptions} /> ), - cloudforms: , ec2: , gce: ( ', () => { ['azure_rm', 'Microsoft Azure Resource Manager'], ['vmware', 'VMware vCenter'], ['satellite6', 'Red Hat Satellite 6'], - ['cloudforms', 'Red Hat CloudForms'], ['openstack', 'OpenStack'], ['rhv', 'Red Hat Virtualization'], ['tower', 'Ansible Tower'], diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.jsx deleted file mode 100644 index 981c67ad90..0000000000 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.jsx +++ /dev/null @@ -1,69 +0,0 @@ -import React, { useCallback } from 'react'; -import { useField, useFormikContext } from 'formik'; -import { withI18n } from '@lingui/react'; -import { t, Trans } from '@lingui/macro'; -import CredentialLookup from '../../../../components/Lookup/CredentialLookup'; -import { - OptionsField, - SourceVarsField, - VerbosityField, - EnabledVarField, - EnabledValueField, - HostFilterField, -} from './SharedFields'; -import { required } from '../../../../util/validators'; - -const CloudFormsSubForm = ({ i18n }) => { - const { setFieldValue } = useFormikContext(); - const [credentialField, credentialMeta, credentialHelpers] = useField({ - name: 'credential', - validate: required(i18n._(t`Select a value for this field`), i18n), - }); - - const handleCredentialUpdate = useCallback( - value => { - setFieldValue('credential', value); - }, - [setFieldValue] - ); - - const configLink = - 'https://github.com/ansible-collections/community.general/blob/main/scripts/inventory/cloudforms.ini'; - - return ( - <> - credentialHelpers.setTouched()} - onChange={handleCredentialUpdate} - value={credentialField.value} - required - /> - - - - - - - - Override variables found in cloudforms.ini and used by the - inventory update script. For an example variable configuration{' '} - - view cloudforms.ini in the Ansible Collections github repo. - - -
-
- - } - /> - - ); -}; - -export default withI18n()(CloudFormsSubForm); diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.test.jsx b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.test.jsx deleted file mode 100644 index 8e46b042fd..0000000000 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/CloudFormsSubForm.test.jsx +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react'; -import { act } from 'react-dom/test-utils'; -import { Formik } from 'formik'; -import { mountWithContexts } from '../../../../../testUtils/enzymeHelpers'; -import CloudFormsSubForm from './CloudFormsSubForm'; -import { CredentialsAPI } from '../../../../api'; - -jest.mock('../../../../api/models/Credentials'); - -const initialValues = { - credential: null, - custom_virtualenv: '', - overwrite: false, - overwrite_vars: false, - source_path: '', - source_project: null, - source_script: null, - source_vars: '---\n', - update_cache_timeout: 0, - update_on_launch: true, - update_on_project_update: false, - verbosity: 1, -}; - -describe('', () => { - let wrapper; - CredentialsAPI.read.mockResolvedValue({ - data: { count: 0, results: [] }, - }); - - beforeAll(async () => { - await act(async () => { - wrapper = mountWithContexts( - - - - ); - }); - }); - - afterAll(() => { - jest.clearAllMocks(); - wrapper.unmount(); - }); - - test('should render subform fields', () => { - expect(wrapper.find('FormGroup[label="Credential"]')).toHaveLength(1); - expect(wrapper.find('FormGroup[label="Verbosity"]')).toHaveLength(1); - expect(wrapper.find('FormGroup[label="Update options"]')).toHaveLength(1); - expect( - wrapper.find('FormGroup[label="Cache timeout (seconds)"]') - ).toHaveLength(1); - expect( - wrapper.find('VariablesField[label="Source variables"]') - ).toHaveLength(1); - }); - - test('should make expected api calls', () => { - expect(CredentialsAPI.read).toHaveBeenCalledTimes(1); - expect(CredentialsAPI.read).toHaveBeenCalledWith({ - credential_type__namespace: 'cloudforms', - order_by: 'name', - page: 1, - page_size: 5, - }); - }); -}); diff --git a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/index.js b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/index.js index 324d797d56..b7e8c15971 100644 --- a/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/index.js +++ b/awx/ui_next/src/screens/Inventory/shared/InventorySourceSubForms/index.js @@ -1,5 +1,4 @@ export { default as AzureSubForm } from './AzureSubForm'; -export { default as CloudFormsSubForm } from './CloudFormsSubForm'; export { default as EC2SubForm } from './EC2SubForm'; export { default as GCESubForm } from './GCESubForm'; export { default as OpenStackSubForm } from './OpenStackSubForm';