From 4268f1aeeb3fba9066e511428fbf78bd6381712d Mon Sep 17 00:00:00 2001 From: nixocio Date: Tue, 3 Nov 2020 17:58:32 -0500 Subject: [PATCH] Mark `Host Config Key` as a required field Mark `Host Config Key` as a required field See:https://github.com/ansible/awx/issues/4968 --- .../Template/JobTemplateEdit/JobTemplateEdit.test.jsx | 6 +++++- awx/ui_next/src/screens/Template/shared/JobTemplateForm.jsx | 1 + .../src/screens/Template/shared/JobTemplateForm.test.jsx | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx b/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx index 7790989aa9..642c679969 100644 --- a/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx +++ b/awx/ui_next/src/screens/Template/JobTemplateEdit/JobTemplateEdit.test.jsx @@ -36,7 +36,7 @@ const mockJobTemplate = { diff_mode: false, extra_vars: '---', forks: 0, - host_config_key: '', + host_config_key: '1234', id: 1, inventory: 2, job_slice_count: 1, @@ -225,6 +225,10 @@ describe('', () => { ); }); await waitForElement(wrapper, 'EmptyStateBody', el => el.length === 0); + expect(wrapper.find('FormGroup[label="Host Config Key"]').length).toBe(1); + expect( + wrapper.find('FormGroup[label="Host Config Key"]').prop('isRequired') + ).toBe(true); }); test('handleSubmit should call api update', async () => { diff --git a/awx/ui_next/src/screens/Template/shared/JobTemplateForm.jsx b/awx/ui_next/src/screens/Template/shared/JobTemplateForm.jsx index 794eefa51d..805e201e13 100644 --- a/awx/ui_next/src/screens/Template/shared/JobTemplateForm.jsx +++ b/awx/ui_next/src/screens/Template/shared/JobTemplateForm.jsx @@ -589,6 +589,7 @@ function JobTemplateForm({ validate={ allowCallbacks ? required(null, i18n) : null } + isRequired={allowCallbacks} /> diff --git a/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx b/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx index f6c6c3e486..e1bf669a60 100644 --- a/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx +++ b/awx/ui_next/src/screens/Template/shared/JobTemplateForm.test.jsx @@ -56,6 +56,7 @@ describe('', () => { webhook_key: 'webhook key', webhook_service: 'github', webhook_credential: 7, + host_config_key: '', }; const mockInstanceGroups = [ {