mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
changed job launch logic on UI side for job launch and job relaunch
This commit is contained in:
@@ -25,6 +25,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential
|
|||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.post(passwords)
|
Rest.post(passwords)
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
|
scope.new_job_id = data.job;
|
||||||
scope.$emit(callback, data);
|
scope.$emit(callback, data);
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.error(function (data, status) {
|
||||||
@@ -261,6 +262,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
|||||||
scope = parent_scope.$new(),
|
scope = parent_scope.$new(),
|
||||||
callback = params.callback,
|
callback = params.callback,
|
||||||
job = params.job,
|
job = params.job,
|
||||||
|
url = params.url,
|
||||||
e, helpContainer, html;
|
e, helpContainer, html;
|
||||||
|
|
||||||
html = GenerateForm.buildHTML(JobVarsPromptForm, { mode: 'edit', modal: true, scope: scope });
|
html = GenerateForm.buildHTML(JobVarsPromptForm, { mode: 'edit', modal: true, scope: scope });
|
||||||
@@ -360,7 +362,8 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
|||||||
scope.varsAccept = function() {
|
scope.varsAccept = function() {
|
||||||
job.extra_vars = ToJSON(scope.parseType, scope.variables, true);
|
job.extra_vars = ToJSON(scope.parseType, scope.variables, true);
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Rest.setUrl(GetBasePath('jobs') + job.id + '/');
|
//Rest.setUrl(GetBasePath('jobs') + job.id + '/');
|
||||||
|
Rest.setUrl(url);
|
||||||
Rest.put(job)
|
Rest.put(job)
|
||||||
.success(function() {
|
.success(function() {
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
@@ -389,24 +392,26 @@ 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,
|
||||||
|
extra_vars,
|
||||||
new_job_id,
|
new_job_id,
|
||||||
new_job,
|
new_job,
|
||||||
launch_url,
|
launch_url,
|
||||||
prompt_for_vars = false,
|
prompt_for_vars = false,
|
||||||
passwords;
|
passwords;
|
||||||
|
scope.job_template_id = id;
|
||||||
|
|
||||||
// if (base === 'job_templates') {
|
if (base === 'job_templates') {
|
||||||
// url = GetBasePath('job_templates');
|
url = GetBasePath('job_templates') + id + '/launch/';
|
||||||
// }
|
}
|
||||||
// else {
|
else {
|
||||||
// url = GetBasePath('jobs');
|
url = GetBasePath('jobs') + id + '/relaunch/';
|
||||||
// }
|
}
|
||||||
// url += id + '/';
|
//url += id + '/';
|
||||||
|
|
||||||
url = GetBasePath('job_templates')+ id + '/launch/';
|
//url = GetBasePath('job_templates')+ id + '/launch/';
|
||||||
|
|
||||||
|
|
||||||
if (scope.removePostTheJob) {
|
if (scope.removePostTheJob) {
|
||||||
@@ -473,7 +478,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
|||||||
}
|
}
|
||||||
scope.removePlaybookLaunchFinished = scope.$on('PlaybookLaunchFinished', function() {
|
scope.removePlaybookLaunchFinished = scope.$on('PlaybookLaunchFinished', function() {
|
||||||
//var base = $location.path().replace(/^\//, '').split('/')[0];
|
//var base = $location.path().replace(/^\//, '').split('/')[0];
|
||||||
$location.path('/jobs/' + new_job_id);
|
$location.path('/jobs/' + scope.new_job_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (scope.removeStartPlaybookRun) {
|
if (scope.removeStartPlaybookRun) {
|
||||||
@@ -514,9 +519,10 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
|||||||
// call prompt with callback of StartPlaybookRun, passwords
|
// call prompt with callback of StartPlaybookRun, passwords
|
||||||
PromptForVars({
|
PromptForVars({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
job: new_job,
|
job: {id:scope.job_template_id},
|
||||||
variables: job_template.extra_vars,
|
variables: extra_vars,
|
||||||
callback: 'StartPlaybookRun'
|
callback: 'StartPlaybookRun',
|
||||||
|
url: url
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -542,6 +548,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi
|
|||||||
// new_job_id = data.id;
|
// new_job_id = data.id;
|
||||||
launch_url = url;//data.related.start;
|
launch_url = url;//data.related.start;
|
||||||
prompt_for_vars = data.ask_variables_on_launch;
|
prompt_for_vars = data.ask_variables_on_launch;
|
||||||
|
extra_vars = data.variables_needed_to_start;
|
||||||
// new_job = data;
|
// new_job = data;
|
||||||
if (data.passwords_needed_to_start.length > 0) {
|
if (data.passwords_needed_to_start.length > 0) {
|
||||||
scope.$emit('PromptForPasswords', data.passwords_needed_to_start);
|
scope.$emit('PromptForPasswords', data.passwords_needed_to_start);
|
||||||
|
|||||||
Reference in New Issue
Block a user