1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Fixed bug where normal job launch on job template edit was attempting to relaunch.

This commit is contained in:
Michael Abashian 2016-07-12 15:33:28 -04:00
parent 8a5faf564d
commit e6f2b0416a
5 changed files with 14 additions and 14 deletions

View File

@ -450,7 +450,7 @@ export default
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
id = params.id; id = params.id;
InitiatePlaybookRun({ scope: scope, id: id }); InitiatePlaybookRun({ scope: scope, id: id, relaunch: true });
}; };
}]) }])

View File

@ -13,13 +13,13 @@
export default export default
[ '$location', '$rootScope', '$filter', '$scope', '$compile', '$state', '$stateParams', '$log', 'ClearScope', [ '$location', '$rootScope', '$filter', '$scope', '$compile', '$state', '$stateParams', '$log', 'ClearScope',
'GetBasePath', 'Wait', 'ProcessErrors', 'SelectPlay', 'SelectTask', 'GetElapsed', 'JobIsFinished', 'GetBasePath', 'Wait', 'ProcessErrors', 'SelectPlay', 'SelectTask', 'GetElapsed', 'JobIsFinished',
'SetTaskStyles', 'DigestEvent', 'UpdateDOM', 'DeleteJob', 'InitiatePlaybookRun', 'LoadPlays', 'LoadTasks', 'SetTaskStyles', 'DigestEvent', 'UpdateDOM', 'DeleteJob', 'RelaunchPlaybook', 'LoadPlays', 'LoadTasks',
'ParseVariableString', 'GetChoices', 'fieldChoices', 'fieldLabels', 'EditSchedule', 'ParseVariableString', 'GetChoices', 'fieldChoices', 'fieldLabels', 'EditSchedule',
'ParseTypeChange', 'JobDetailService', 'ParseTypeChange', 'JobDetailService',
function( function(
$location, $rootScope, $filter, $scope, $compile, $state, $stateParams, $log, ClearScope, $location, $rootScope, $filter, $scope, $compile, $state, $stateParams, $log, ClearScope,
GetBasePath, Wait, ProcessErrors, SelectPlay, SelectTask, GetElapsed, JobIsFinished, GetBasePath, Wait, ProcessErrors, SelectPlay, SelectTask, GetElapsed, JobIsFinished,
SetTaskStyles, DigestEvent, UpdateDOM, DeleteJob, InitiatePlaybookRun, LoadPlays, LoadTasks, SetTaskStyles, DigestEvent, UpdateDOM, DeleteJob, RelaunchPlaybook, LoadPlays, LoadTasks,
ParseVariableString, GetChoices, fieldChoices, fieldLabels, EditSchedule, ParseVariableString, GetChoices, fieldChoices, fieldLabels, EditSchedule,
ParseTypeChange, JobDetailService ParseTypeChange, JobDetailService
) { ) {
@ -920,7 +920,7 @@ export default
}; };
scope.relaunchJob = function() { scope.relaunchJob = function() {
InitiatePlaybookRun({ RelaunchPlaybook({
scope: scope, scope: scope,
id: scope.job.id id: scope.job.id
}); });

View File

@ -9,10 +9,11 @@ export default
return function (params) { return function (params) {
var scope = params.scope.$new(), var scope = params.scope.$new(),
id = params.id, id = params.id,
relaunch = params.relaunch || false,
system_job = params.system_job || false; system_job = params.system_job || false;
scope.job_template_id = id; scope.job_template_id = id;
var el = $compile( "<submit-job data-submit-job-id=" + id + " data-submit-job-system=" + system_job + "></submit-job>" )( scope ); var el = $compile( "<submit-job data-submit-job-id=" + id + " data-submit-job-system=" + system_job + " data-submit-job-relaunch=" + relaunch + "></submit-job>" )( scope );
$('#content-container').remove('submit-job').append( el ); $('#content-container').remove('submit-job').append( el );
}; };
} }

View File

@ -131,13 +131,11 @@ export default
$scope.forms = {}; $scope.forms = {};
$scope.passwords = {}; $scope.passwords = {};
var base = $state.current.name, // As of 3.0, the only place the user can relaunch a
// As of 3.0, the only place the user can relaunch a // playbook is on jobTemplates.edit (completed_jobs tab),
// playbook is on jobTemplates.edit (completed_jobs tab), // jobs, and jobDetails $states.
// jobs, and jobDetails $states.
isRelaunch = !(base === 'jobTemplates' || base === 'portalMode' || base === 'dashboard');
if (!isRelaunch) { if (!$scope.submitJobRelaunch) {
launch_url = GetBasePath('job_templates') + $scope.submitJobId + '/launch/'; launch_url = GetBasePath('job_templates') + $scope.submitJobId + '/launch/';
} }
else { else {
@ -189,7 +187,7 @@ export default
updateRequiredPasswords(); updateRequiredPasswords();
} }
if( (isRelaunch && !$scope.password_needed) || (!isRelaunch && $scope.can_start_without_user_input && !$scope.ask_inventory_on_launch && !$scope.ask_credential_on_launch && !$scope.has_other_prompts && !$scope.survey_enabled)) { if( ($scope.submitJobRelaunch && !$scope.password_needed) || (!$scope.submitJobRelaunch && $scope.can_start_without_user_input && !$scope.ask_inventory_on_launch && !$scope.ask_credential_on_launch && !$scope.has_other_prompts && !$scope.survey_enabled)) {
// The job can be launched if // The job can be launched if
// a) It's a relaunch and no passwords are needed // a) It's a relaunch and no passwords are needed
// or // or
@ -217,7 +215,7 @@ export default
$scope.openLaunchModal(); $scope.openLaunchModal();
}; };
if(isRelaunch) { if($scope.submitJobRelaunch) {
// Go out and get some of the job details like inv, cred, name // Go out and get some of the job details like inv, cred, name
Rest.setUrl(GetBasePath('jobs') + $scope.submitJobId); Rest.setUrl(GetBasePath('jobs') + $scope.submitJobId);
Rest.get() Rest.get()

View File

@ -11,7 +11,8 @@ export default [ 'templateUrl', 'CreateDialog', 'Wait', 'CreateSelect2', 'ParseT
return { return {
scope: { scope: {
submitJobId: '=', submitJobId: '=',
submitJobSystem: '=' submitJobSystem: '=',
submitJobRelaunch: '='
}, },
templateUrl: templateUrl('job-submission/job-submission'), templateUrl: templateUrl('job-submission/job-submission'),
controller: jobSubmissionController, controller: jobSubmissionController,