From cdb347cba526cd533cd92964cd8a3aad06c9ce28 Mon Sep 17 00:00:00 2001 From: mabashian Date: Fri, 10 Aug 2018 15:50:58 -0400 Subject: [PATCH] Properly show prompt button when re-selecting a node with promptable fields --- .../inventory/prompt-inventory.partial.html | 4 +-- .../workflow-maker.controller.js | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/templates/prompt/steps/inventory/prompt-inventory.partial.html b/awx/ui/client/src/templates/prompt/steps/inventory/prompt-inventory.partial.html index 17dc1ce918..9caecf594c 100644 --- a/awx/ui/client/src/templates/prompt/steps/inventory/prompt-inventory.partial.html +++ b/awx/ui/client/src/templates/prompt/steps/inventory/prompt-inventory.partial.html @@ -6,8 +6,8 @@
{{:: vm.strings.get('prompt.NO_INVENTORY_SELECTED') }}
- - + +
{{:: vm.strings.get('prompt.REVERT') }} diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js index c344c91615..eda3f6f3a2 100644 --- a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js +++ b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js @@ -641,6 +641,31 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService', if (!_.isEmpty($scope.nodeBeingEdited.promptData)) { $scope.promptData = _.cloneDeep($scope.nodeBeingEdited.promptData); + const launchConf = $scope.promptData.launchConf; + + if (!launchConf.survey_enabled && + !launchConf.ask_inventory_on_launch && + !launchConf.ask_credential_on_launch && + !launchConf.ask_verbosity_on_launch && + !launchConf.ask_job_type_on_launch && + !launchConf.ask_limit_on_launch && + !launchConf.ask_tags_on_launch && + !launchConf.ask_skip_tags_on_launch && + !launchConf.ask_diff_mode_on_launch && + !launchConf.survey_enabled && + !launchConf.credential_needed_to_start && + launchConf.variables_needed_to_start.length === 0) { + $scope.showPromptButton = false; + $scope.promptModalMissingReqFields = false; + } else { + $scope.showPromptButton = true; + + if (launchConf.ask_inventory_on_launch && !_.has(launchConf, 'defaults.inventory') && !_.has($scope, 'nodeBeingEdited.originalNodeObj.summary_fields.inventory')) { + $scope.promptModalMissingReqFields = true; + } else { + $scope.promptModalMissingReqFields = false; + } + } } else if ( _.get($scope, 'nodeBeingEdited.unifiedJobTemplate.unified_job_type') === 'job_template' || _.get($scope, 'nodeBeingEdited.unifiedJobTemplate.type') === 'job_template'