mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Merge pull request #8549 from jakemcdermott/remove-cf-form
Delete cloudforms Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
948e4c13d2
@ -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",
|
||||
|
||||
@ -48,7 +48,6 @@ describe('<InventorySourceAdd />', () => {
|
||||
['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'],
|
||||
|
||||
@ -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'],
|
||||
|
||||
@ -50,7 +50,6 @@ describe('<InventorySourceAdd />', () => {
|
||||
['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'],
|
||||
|
||||
@ -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: <CloudFormsSubForm />,
|
||||
ec2: <EC2SubForm sourceOptions={sourceOptions} />,
|
||||
gce: (
|
||||
<GCESubForm
|
||||
|
||||
@ -32,7 +32,6 @@ describe('<InventorySourceForm />', () => {
|
||||
['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'],
|
||||
|
||||
@ -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 (
|
||||
<>
|
||||
<CredentialLookup
|
||||
credentialTypeNamespace="cloudforms"
|
||||
label={i18n._(t`Credential`)}
|
||||
helperTextInvalid={credentialMeta.error}
|
||||
isValid={!credentialMeta.touched || !credentialMeta.error}
|
||||
onBlur={() => credentialHelpers.setTouched()}
|
||||
onChange={handleCredentialUpdate}
|
||||
value={credentialField.value}
|
||||
required
|
||||
/>
|
||||
<VerbosityField />
|
||||
<HostFilterField />
|
||||
<EnabledVarField />
|
||||
<EnabledValueField />
|
||||
<OptionsField />
|
||||
<SourceVarsField
|
||||
popoverContent={
|
||||
<>
|
||||
<Trans>
|
||||
Override variables found in cloudforms.ini and used by the
|
||||
inventory update script. For an example variable configuration{' '}
|
||||
<a href={configLink} target="_blank" rel="noopener noreferrer">
|
||||
view cloudforms.ini in the Ansible Collections github repo.
|
||||
</a>
|
||||
</Trans>
|
||||
<br />
|
||||
<br />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default withI18n()(CloudFormsSubForm);
|
||||
@ -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('<CloudFormsSubForm />', () => {
|
||||
let wrapper;
|
||||
CredentialsAPI.read.mockResolvedValue({
|
||||
data: { count: 0, results: [] },
|
||||
});
|
||||
|
||||
beforeAll(async () => {
|
||||
await act(async () => {
|
||||
wrapper = mountWithContexts(
|
||||
<Formik initialValues={initialValues}>
|
||||
<CloudFormsSubForm />
|
||||
</Formik>
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
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,
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -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';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user