diff --git a/awx/ui/src/screens/Instances/Shared/InstanceForm.js b/awx/ui/src/screens/Instances/Shared/InstanceForm.js
index 8c57889f34..53fefbef7c 100644
--- a/awx/ui/src/screens/Instances/Shared/InstanceForm.js
+++ b/awx/ui/src/screens/Instances/Shared/InstanceForm.js
@@ -1,25 +1,21 @@
import React from 'react';
import { t } from '@lingui/macro';
-import { Formik, useField } from 'formik';
-import {
- Form,
- FormGroup,
- CardBody,
- Switch,
- Popover,
-} from '@patternfly/react-core';
+import { Formik } from 'formik';
+import { Form, FormGroup, CardBody } from '@patternfly/react-core';
import { FormColumnLayout } from 'components/FormLayout';
-import FormField, { FormSubmitError } from 'components/FormField';
+import FormField, {
+ FormSubmitError,
+ CheckboxField,
+} from 'components/FormField';
import FormActionGroup from 'components/FormActionGroup';
import { required } from 'util/validators';
function InstanceFormFields() {
- const [enabled, , enabledHelpers] = useField('enabled');
return (
<>
-
- }
- >
-
+ {
- enabledHelpers.setValue(!enabled.value);
- }}
- ouiaId="enable-instance-switch"
+ name="enabled"
+ label={t`Enable Instance`}
+ tooltip={t`Set the instance enabled or disabled. If disabled, jobs will not be assigned to this instance.`}
/>
>
diff --git a/awx/ui/src/screens/Instances/Shared/InstanceForm.test.js b/awx/ui/src/screens/Instances/Shared/InstanceForm.test.js
index 9e18a98283..c2cf6d9a0a 100644
--- a/awx/ui/src/screens/Instances/Shared/InstanceForm.test.js
+++ b/awx/ui/src/screens/Instances/Shared/InstanceForm.test.js
@@ -40,7 +40,7 @@ describe('', () => {
test('should display form fields properly', async () => {
await waitForElement(wrapper, 'InstanceForm', (el) => el.length > 0);
- expect(wrapper.find('FormGroup[label="Name"]').length).toBe(1);
+ expect(wrapper.find('FormGroup[label="Host Name"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Description"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Instance State"]').length).toBe(1);
expect(wrapper.find('FormGroup[label="Listener Port"]').length).toBe(1);
@@ -49,13 +49,13 @@ describe('', () => {
test('should update form values', async () => {
await act(async () => {
- wrapper.find('input#name').simulate('change', {
+ wrapper.find('input#hostname').simulate('change', {
target: { value: 'new Foo', name: 'hostname' },
});
});
wrapper.update();
- expect(wrapper.find('input#name').prop('value')).toEqual('new Foo');
+ expect(wrapper.find('input#hostname').prop('value')).toEqual('new Foo');
});
test('should call handleCancel when Cancel button is clicked', async () => {
@@ -68,7 +68,7 @@ describe('', () => {
test('should call handleSubmit when Cancel button is clicked', async () => {
expect(handleSubmit).not.toHaveBeenCalled();
await act(async () => {
- wrapper.find('input#name').simulate('change', {
+ wrapper.find('input#hostname').simulate('change', {
target: { value: 'new Foo', name: 'hostname' },
});
wrapper.find('input#instance-description').simulate('change', {