diff --git a/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js index b4ff3218b4..0da16a64ee 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/launchjob.factory.js @@ -32,7 +32,7 @@ export default } if(scope.ask_variables_on_launch){ - extra_vars = ToJSON(scope.parseType, scope.variables, false); + extra_vars = ToJSON(scope.parseType, scope.jobLaunchVariables, false); if(!Empty(extra_vars)){ $.each(extra_vars, function(key,value){ job_launch_data.extra_vars[key] = value; diff --git a/awx/ui/client/src/job-submission/job-submission.controller.js b/awx/ui/client/src/job-submission/job-submission.controller.js index b25e463ee9..761e797bd9 100644 --- a/awx/ui/client/src/job-submission/job-submission.controller.js +++ b/awx/ui/client/src/job-submission/job-submission.controller.js @@ -173,7 +173,7 @@ export default } if($scope.ask_variables_on_launch) { - $scope.variables = (data.defaults && data.defaults.extra_vars) ? data.defaults.extra_vars : "---"; + $scope.jobLaunchVariables = (data.defaults && data.defaults.extra_vars) ? data.defaults.extra_vars : "---"; $scope.other_prompt_data.parseType = 'yaml'; $scope.parseType = 'yaml'; } @@ -197,16 +197,16 @@ export default var initiateModal = function() { // Figure out which step the user needs to start on if($scope.ask_inventory_on_launch) { - $scope.setStep("inventory"); + $scope.setStep("inventory", true); } else if($scope.ask_credential_on_launch || $scope.password_needed) { - $scope.setStep("credential"); + $scope.setStep("credential", true); } else if($scope.has_other_prompts) { - $scope.setStep("otherprompts"); + $scope.setStep("otherprompts", true); } else if($scope.survey_enabled) { - $scope.setStep("survey"); + $scope.setStep("survey", true); } $scope.openLaunchModal(); @@ -251,7 +251,7 @@ export default }); }; - $scope.setStep = function(step) { + $scope.setStep = function(step, initialStep) { $scope.step = step; if(step === "credential") { @@ -259,9 +259,11 @@ export default } else if(step === "otherprompts") { $scope.otherPromptsTabEnabled = true; - if($scope.ask_variables_on_launch && !$scope.extra_vars_code_mirror_loaded) { + + if(!initialStep && $scope.step === 'otherprompts' && $scope.ask_variables_on_launch && !$scope.extra_vars_code_mirror_loaded) { ParseTypeChange({ scope: $scope, + variable: 'jobLaunchVariables', field_id: 'job_launch_variables' }); diff --git a/awx/ui/client/src/job-submission/job-submission.directive.js b/awx/ui/client/src/job-submission/job-submission.directive.js index 2feb7b165e..d31279f00d 100644 --- a/awx/ui/client/src/job-submission/job-submission.directive.js +++ b/awx/ui/client/src/job-submission/job-submission.directive.js @@ -6,8 +6,8 @@ import jobSubmissionController from './job-submission.controller'; -export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', - function(templateUrl, CreateDialog, Wait, CreateSelect2) { +export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', 'ParseTypeChange', + function(templateUrl, CreateDialog, Wait, CreateSelect2, ParseTypeChange) { return { scope: { submitJobId: '=', @@ -34,6 +34,16 @@ export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', multiple: false }); + if(scope.step === 'otherprompts' && scope.ask_variables_on_launch) { + ParseTypeChange({ + scope: scope, + variable: 'jobLaunchVariables', + field_id: 'job_launch_variables' + }); + + scope.extra_vars_code_mirror_loaded = true; + } + }); CreateDialog({ diff --git a/awx/ui/client/src/job-submission/job-submission.partial.html b/awx/ui/client/src/job-submission/job-submission.partial.html index 76e17adc58..d1f39af9a9 100644 --- a/awx/ui/client/src/job-submission/job-submission.partial.html +++ b/awx/ui/client/src/job-submission/job-submission.partial.html @@ -169,7 +169,7 @@
Please enter an answer between {{question.minlength}} to {{question.maxlength}} characters long.
- +
Please enter an answer.
Please enter an answer between {{question.minlength}} to {{question.maxlength}} characters long.