From d89cad0d9edd2baaa01f668d8ed12eca62ee1a48 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Wed, 31 May 2023 12:31:55 -0400 Subject: [PATCH] Adds managed_by_policy checkbox to instances form. Adds warnings when associating or disassociating instances from instance groups. (#13994) --- .../AssociateModal/AssociateModal.js | 2 + .../DisassociateButton/DisassociateButton.js | 12 ++++- .../InstanceDetails/InstanceDetails.js | 23 +++++++++- .../InstanceGroup/Instances/InstanceList.js | 46 ++++++++++++++++++- .../screens/Instances/Shared/InstanceForm.js | 7 +++ .../Instances/Shared/InstanceForm.test.js | 1 + 6 files changed, 87 insertions(+), 4 deletions(-) diff --git a/awx/ui/src/components/AssociateModal/AssociateModal.js b/awx/ui/src/components/AssociateModal/AssociateModal.js index 3b42c66915..88e5459910 100644 --- a/awx/ui/src/components/AssociateModal/AssociateModal.js +++ b/awx/ui/src/components/AssociateModal/AssociateModal.js @@ -27,6 +27,7 @@ function AssociateModal({ isModalOpen = false, displayKey = 'name', ouiaId, + modalNote, }) { const history = useHistory(); const { selected, handleSelect } = useSelected([]); @@ -120,6 +121,7 @@ function AssociateModal({ , ]} > + {modalNote} + + Note: This instance may be re-associated with this + instance group if it is managed by{' '} + + policy rules. + + + + ) : null + } /> )} instance.managed_by_policy === true + ) ? ( + + + Note: Instances may be re-associated with this instance + group if they are managed by{' '} + + policy rules. + + + + ) : null + } />, + + + Note: Manually associated instances may be automatically + disassociated from an instance group if the instance is + managed by{' '} + + policy rules. + + + + + } /> )} {error && ( diff --git a/awx/ui/src/screens/Instances/Shared/InstanceForm.js b/awx/ui/src/screens/Instances/Shared/InstanceForm.js index 53fefbef7c..9b8ffa2ce7 100644 --- a/awx/ui/src/screens/Instances/Shared/InstanceForm.js +++ b/awx/ui/src/screens/Instances/Shared/InstanceForm.js @@ -58,6 +58,12 @@ function InstanceFormFields() { label={t`Enable Instance`} tooltip={t`Set the instance enabled or disabled. If disabled, jobs will not be assigned to this instance.`} /> + ); @@ -79,6 +85,7 @@ function InstanceForm({ node_state: 'installed', listener_port: 27199, enabled: true, + managed_by_policy: true, }} onSubmit={(values) => { handleSubmit(values); diff --git a/awx/ui/src/screens/Instances/Shared/InstanceForm.test.js b/awx/ui/src/screens/Instances/Shared/InstanceForm.test.js index c2cf6d9a0a..263b5c32e7 100644 --- a/awx/ui/src/screens/Instances/Shared/InstanceForm.test.js +++ b/awx/ui/src/screens/Instances/Shared/InstanceForm.test.js @@ -89,6 +89,7 @@ describe('', () => { expect(handleSubmit).toBeCalledWith({ description: 'This is a repeat song', enabled: true, + managed_by_policy: true, hostname: 'new Foo', listener_port: 'This is a repeat song', node_state: 'installed',