From 87ed378f6ba072a17ff256c9b07abbfb05dd1942 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 11 Sep 2014 17:13:20 -0400 Subject: [PATCH] changed JobSubmission for api change for job launch --- awx/ui/static/js/helpers/JobSubmission.js | 44 +++++++++++++++-------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/awx/ui/static/js/helpers/JobSubmission.js b/awx/ui/static/js/helpers/JobSubmission.js index 2710668c97..b531733001 100644 --- a/awx/ui/static/js/helpers/JobSubmission.js +++ b/awx/ui/static/js/helpers/JobSubmission.js @@ -389,7 +389,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi return function (params) { var scope = params.scope, id = params.id, - base = $location.path().replace(/^\//, '').split('/')[0], + //base = $location.path().replace(/^\//, '').split('/')[0], url, job_template, new_job_id, @@ -398,13 +398,14 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi prompt_for_vars = false, passwords; - if (base === 'job_templates') { - url = GetBasePath('job_templates'); - } - else { - url = GetBasePath('jobs'); - } - url += id + '/'; + // if (base === 'job_templates') { + // url = GetBasePath('job_templates'); + // } + // else { + // url = GetBasePath('jobs'); + // } + // url += id + '/'; + url = GetBasePath('job_templates')+ id + '/launch/'; if (scope.removePostTheJob) { scope.removePostTheJob(); @@ -536,14 +537,27 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi Rest.setUrl(url); Rest.get() .success(function (data) { - delete data.id; - job_template = data; - if (Empty(data.credential)) { - scope.$emit('PromptForCredential'); - } else { - // We have what we need, submit the job - scope.$emit('PostTheJob'); + // new_job_id = data.id; + launch_url = url;//data.related.start; + prompt_for_vars = data.ask_variables_on_launch; + // new_job = data; + if (data.passwords_needed_to_start.length > 0) { + scope.$emit('PromptForPasswords', data.passwords_needed_to_start); } + else if (data.ask_variables_on_launch) { + scope.$emit('PromptForVars'); + } + else { + scope.$emit('StartPlaybookRun'); + } + // delete data.id; + // job_template = data; + // if (Empty(data.credential)) { + // scope.$emit('PromptForCredential'); + // } else { + // // We have what we need, submit the job + // scope.$emit('PostTheJob'); + // } }) .error(function (data, status) { ProcessErrors(scope, data, status, null, { hdr: 'Error!',