From 1cfcaa72ad3cf18e911d2c4ed2f1593fef13126d Mon Sep 17 00:00:00 2001 From: mabashian Date: Tue, 20 Nov 2018 10:34:59 -0500 Subject: [PATCH] Fixed editNodeHelpMessage logic that was broken during merge conflict --- .../forms/workflow-node-form.controller.js | 34 +++++++++++++++++++ .../forms/workflow-node-form.directive.js | 1 + .../forms/workflow-node-form.partial.html | 2 ++ .../workflow-maker.partial.html | 2 +- 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.controller.js b/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.controller.js index 7a5011efb2..3750e42969 100644 --- a/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.controller.js +++ b/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.controller.js @@ -17,6 +17,7 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService let promptWatcher, credentialsWatcher, surveyQuestionWatcher, listPromises = []; $scope.strings = TemplatesStrings; + $scope.editNodeHelpMessage = null; let templateList = _.cloneDeep(TemplateList); delete templateList.actions; @@ -139,6 +140,8 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService const finishConfiguringEdit = () => { + $scope.editNodeHelpMessage = getEditNodeHelpMessage($scope.nodeConfig.node.fullUnifiedJobTemplateObject); + if (!$scope.readOnly) { let jobTemplate = new JobTemplate(); @@ -391,6 +394,36 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService }; + const getEditNodeHelpMessage = (selectedTemplate) => { + if (selectedTemplate.type === "workflow_job_template") { + if ($scope.workflowJobTemplateObj.inventory) { + if (selectedTemplate.ask_inventory_on_launch) { + return $scope.strings.get('workflow_maker.INVENTORY_WILL_OVERRIDE'); + } + } + if ($scope.workflowJobTemplateObj.ask_inventory_on_launch) { + if (selectedTemplate.ask_inventory_on_launch) { + return $scope.strings.get('workflow_maker.INVENTORY_PROMPT_WILL_OVERRIDE'); + } + } + } + if (selectedTemplate.type === "job_template") { + if ($scope.workflowJobTemplateObj.inventory) { + if (selectedTemplate.ask_inventory_on_launch) { + return $scope.strings.get('workflow_maker.INVENTORY_WILL_OVERRIDE'); + } + return $scope.strings.get('workflow_maker.INVENTORY_WILL_NOT_OVERRIDE'); + } + if ($scope.workflowJobTemplateObj.ask_inventory_on_launch) { + if (selectedTemplate.ask_inventory_on_launch) { + return $scope.strings.get('workflow_maker.INVENTORY_PROMPT_WILL_OVERRIDE'); + } + return $scope.strings.get('workflow_maker.INVENTORY_PROMPT_WILL_NOT_OVERRIDE'); + } + } + return null; + }; + const templateManuallySelected = (selectedTemplate) => { if (promptWatcher) { @@ -406,6 +439,7 @@ export default ['$scope', 'TemplatesService', 'JobTemplateModel', 'PromptService } $scope.promptData = null; + $scope.editNodeHelpMessage = getEditNodeHelpMessage(selectedTemplate); if (selectedTemplate.type === "job_template") { let jobTemplate = new JobTemplate(); diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.directive.js b/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.directive.js index 119e88908d..ff16c0b2cc 100644 --- a/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.directive.js +++ b/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.directive.js @@ -11,6 +11,7 @@ export default ['templateUrl', return { scope: { nodeConfig: '<', + workflowJobTemplateObj: '<', cancel: '&', select: '&', readOnly: '<' diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.partial.html b/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.partial.html index e48a4e4f08..122948a8da 100644 --- a/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.partial.html +++ b/awx/ui/client/src/templates/workflows/workflow-maker/forms/workflow-node-form.partial.html @@ -233,6 +233,8 @@ +
+
diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.partial.html b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.partial.html index e44befc510..037af01a4d 100644 --- a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.partial.html +++ b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.partial.html @@ -98,7 +98,7 @@
- +