1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +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) {
var scope = params.scope,
id = params.id;
InitiatePlaybookRun({ scope: scope, id: id });
InitiatePlaybookRun({ scope: scope, id: id, relaunch: true });
};
}])

View File

@ -13,13 +13,13 @@
export default
[ '$location', '$rootScope', '$filter', '$scope', '$compile', '$state', '$stateParams', '$log', 'ClearScope',
'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',
'ParseTypeChange', 'JobDetailService',
function(
$location, $rootScope, $filter, $scope, $compile, $state, $stateParams, $log, ClearScope,
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,
ParseTypeChange, JobDetailService
) {
@ -920,7 +920,7 @@ export default
};
scope.relaunchJob = function() {
InitiatePlaybookRun({
RelaunchPlaybook({
scope: scope,
id: scope.job.id
});

View File

@ -9,10 +9,11 @@ export default
return function (params) {
var scope = params.scope.$new(),
id = params.id,
relaunch = params.relaunch || false,
system_job = params.system_job || false;
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 );
};
}

View File

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

View File

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