diff --git a/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.jsx b/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.jsx index 58aa0d3777..c2242b44fa 100644 --- a/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.jsx @@ -51,7 +51,9 @@ function PreviewStep({ mergeExtraVars(initialExtraVars, masked) ); } else { - overrides.extra_vars = initialExtraVars; + overrides.extra_vars = yaml.safeDump( + mergeExtraVars(initialExtraVars, {}) + ); } } diff --git a/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.test.jsx b/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.test.jsx index 8e5d833bce..322deb8bd6 100644 --- a/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.test.jsx +++ b/awx/ui_next/src/components/LaunchPrompt/steps/PreviewStep.test.jsx @@ -126,7 +126,7 @@ describe('PreviewStep', () => { expect(detail).toHaveLength(1); expect(detail.prop('resource')).toEqual(resource); expect(detail.prop('overrides')).toEqual({ - extra_vars: 'one: 1', + extra_vars: 'one: 1\n', }); }); test('should remove survey with empty array value', async () => { @@ -152,7 +152,7 @@ describe('PreviewStep', () => { expect(detail).toHaveLength(1); expect(detail.prop('resource')).toEqual(resource); expect(detail.prop('overrides')).toEqual({ - extra_vars: 'one: 1', + extra_vars: 'one: 1\n', }); }); }); diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeModal.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeModal.jsx index 4d58da6dd0..2b57effb35 100644 --- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeModal.jsx +++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeModal.jsx @@ -93,9 +93,10 @@ function NodeModalForm({ mergeExtraVars(initialExtraVars, surveyValues) ); } else { - extraVars = initialExtraVars; + extraVars = yaml.safeDump(mergeExtraVars(initialExtraVars, {})); } values.extra_data = extraVars && parseVariableField(extraVars); + delete values.extra_vars; } onSave(values, launchConfig); diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeModal.test.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeModal.test.jsx index 1c227ef90d..7bcf1ea6ee 100644 --- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeModal.test.jsx +++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/NodeModal.test.jsx @@ -305,7 +305,6 @@ describe('NodeModal', () => { verbosity: '0', job_tags: '', skip_tags: '', - extra_vars: '---', diff_mode: false, survey_bar: 'answer', nodeResource: mockJobTemplate, diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/useWorkflowNodeSteps.js b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/useWorkflowNodeSteps.js index 345f28eef7..bd8a8c74e4 100644 --- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/useWorkflowNodeSteps.js +++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/NodeModals/useWorkflowNodeSteps.js @@ -134,26 +134,18 @@ const getNodeToEditDefaultValues = (launchConfig, surveyConfig, nodeToEdit) => { initialValues.diff_mode = sourceOfValues?.diff_mode || false; } - if (launchConfig.ask_variables_on_launch && launchConfig.survey_enabled) { - if (nodeToEdit?.promptValues?.extra_vars) { - initialValues.extra_vars = nodeToEdit.promptValues.extra_vars; - } else { - const newExtraData = { ...nodeToEdit.originalNodeObject.extra_data }; - if (surveyConfig.spec) { - surveyConfig.spec.forEach(question => { - if ( - Object.prototype.hasOwnProperty.call( - newExtraData, - question.variable - ) - ) { - delete newExtraData[question.variable]; - } - }); - } - - initialValues.extra_vars = jsonToYaml(JSON.stringify(newExtraData)); + if (launchConfig.ask_variables_on_launch) { + const newExtraData = { ...sourceOfValues.extra_data }; + if (launchConfig.survey_enabled && surveyConfig.spec) { + surveyConfig.spec.forEach(question => { + if ( + Object.prototype.hasOwnProperty.call(newExtraData, question.variable) + ) { + delete newExtraData[question.variable]; + } + }); } + initialValues.extra_vars = jsonToYaml(JSON.stringify(newExtraData)); } if (surveyConfig?.spec) { diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerToolbar.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerToolbar.jsx index 26c80f338f..1170858f83 100644 --- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerToolbar.jsx +++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/VisualizerToolbar.jsx @@ -79,8 +79,9 @@ function VisualizerToolbar({ {totalNodes} - + 0 && showLegend} isDisabled={totalNodes === 0} @@ -90,8 +91,9 @@ function VisualizerToolbar({ - + 0 && showTools} isDisabled={totalNodes === 0} @@ -101,33 +103,43 @@ function VisualizerToolbar({ - - - + + + + {template.summary_fields?.user_capabilities?.start && ( - - {({ handleLaunch }) => ( - - - - )} - + + + {({ handleLaunch }) => ( + + + + )} + + )} {!readOnly && ( <> - +