From 313de35e60792435ea6133587b2e42f989fda80a Mon Sep 17 00:00:00 2001 From: nixocio Date: Fri, 10 Sep 2021 13:40:45 -0400 Subject: [PATCH] Fix worfklow node info Fix workflow node info. See: https://github.com/ansible/awx/issues/11061 Also: https://github.com/ansible/awx/issues/10628 --- .../Modals/NodeModals/NodeViewModal.js | 11 ++++--- .../Modals/NodeModals/NodeViewModal.test.js | 31 +++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.js b/awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.js index 0ee832f652..63885efd3d 100644 --- a/awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.js +++ b/awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.js @@ -190,16 +190,19 @@ function NodeViewModal({ readOnly }) { let nodeUpdatedConvergence = {}; if ( - nodeToView.all_parents_must_converge !== undefined && - nodeToView.all_parents_must_converge !== - nodeToView.originalNodeObject.all_parents_must_converge + nodeToView?.all_parents_must_converge !== undefined && + nodeToView?.all_parents_must_converge !== + nodeToView?.originalNodeObject?.all_parents_must_converge ) { nodeUpdatedConvergence = { ...nodeToView.originalNodeObject, all_parents_must_converge: nodeToView.all_parents_must_converge, }; } else { - nodeUpdatedConvergence = nodeToView.originalNodeObject; + nodeUpdatedConvergence = { + ...nodeToView.originalNodeObject, + all_parents_must_converge: nodeToView?.all_parents_must_converge, + }; } Content = ( diff --git a/awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.test.js b/awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.test.js index 0bd531fedd..5c856ebfdc 100644 --- a/awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.test.js +++ b/awx/ui/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeViewModal.test.js @@ -300,4 +300,35 @@ describe('NodeViewModal', () => { jest.clearAllMocks(); }); }); + + describe('Convergence label', () => { + const workflowContext = { + nodeToView: { + fullUnifiedJobTemplate: { + id: 1, + name: 'Mock Node', + description: '', + type: 'workflow_approval_template', + timeout: 0, + all_parents_must_converge: false, + }, + }, + }; + + test('should display "Any" Convergence label', async () => { + let wrapper; + await act(async () => { + wrapper = mountWithContexts( + + + + + + ); + }); + waitForLoaded(wrapper); + expect(wrapper.find('Detail[label="Convergence"] dd').text()).toBe('Any'); + jest.clearAllMocks(); + }); + }); });