changed JobSubmission for api change for job launch

This commit is contained in:
Jared Tabor
2014-09-11 17:13:20 -04:00
parent 71ffb71b87
commit 87ed378f6b

View File

@@ -389,7 +389,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
return function (params) { return function (params) {
var scope = params.scope, var scope = params.scope,
id = params.id, id = params.id,
base = $location.path().replace(/^\//, '').split('/')[0], //base = $location.path().replace(/^\//, '').split('/')[0],
url, url,
job_template, job_template,
new_job_id, new_job_id,
@@ -398,13 +398,14 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
prompt_for_vars = false, prompt_for_vars = false,
passwords; passwords;
if (base === 'job_templates') { // if (base === 'job_templates') {
url = GetBasePath('job_templates'); // url = GetBasePath('job_templates');
} // }
else { // else {
url = GetBasePath('jobs'); // url = GetBasePath('jobs');
} // }
url += id + '/'; // url += id + '/';
url = GetBasePath('job_templates')+ id + '/launch/';
if (scope.removePostTheJob) { if (scope.removePostTheJob) {
scope.removePostTheJob(); scope.removePostTheJob();
@@ -536,14 +537,27 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
Rest.setUrl(url); Rest.setUrl(url);
Rest.get() Rest.get()
.success(function (data) { .success(function (data) {
delete data.id; // new_job_id = data.id;
job_template = data; launch_url = url;//data.related.start;
if (Empty(data.credential)) { prompt_for_vars = data.ask_variables_on_launch;
scope.$emit('PromptForCredential'); // new_job = data;
} else { if (data.passwords_needed_to_start.length > 0) {
// We have what we need, submit the job scope.$emit('PromptForPasswords', data.passwords_needed_to_start);
scope.$emit('PostTheJob');
} }
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) { .error(function (data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!', ProcessErrors(scope, data, status, null, { hdr: 'Error!',