diff --git a/awx/ui/client/src/helpers/Jobs.js b/awx/ui/client/src/helpers/Jobs.js index 28727b700e..1e2db376fb 100644 --- a/awx/ui/client/src/helpers/Jobs.js +++ b/awx/ui/client/src/helpers/Jobs.js @@ -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 }); }; }]) diff --git a/awx/ui/client/src/job-detail/job-detail.controller.js b/awx/ui/client/src/job-detail/job-detail.controller.js index 4791803ebc..3f6e8f7209 100644 --- a/awx/ui/client/src/job-detail/job-detail.controller.js +++ b/awx/ui/client/src/job-detail/job-detail.controller.js @@ -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 }); diff --git a/awx/ui/client/src/job-submission/job-submission-factories/initiateplaybookrun.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/initiateplaybookrun.factory.js index 34743b99ea..ed16e745e5 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/initiateplaybookrun.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/initiateplaybookrun.factory.js @@ -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( "" )( scope ); + var el = $compile( "" )( scope ); $('#content-container').remove('submit-job').append( el ); }; } diff --git a/awx/ui/client/src/job-submission/job-submission.controller.js b/awx/ui/client/src/job-submission/job-submission.controller.js index 00c7e971d3..d059f9ec96 100644 --- a/awx/ui/client/src/job-submission/job-submission.controller.js +++ b/awx/ui/client/src/job-submission/job-submission.controller.js @@ -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'); + // As of 3.0, the only place the user can relaunch a + // playbook is on jobTemplates.edit (completed_jobs tab), + // jobs, and jobDetails $states. - 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() diff --git a/awx/ui/client/src/job-submission/job-submission.directive.js b/awx/ui/client/src/job-submission/job-submission.directive.js index d31279f00d..bd1c90ff92 100644 --- a/awx/ui/client/src/job-submission/job-submission.directive.js +++ b/awx/ui/client/src/job-submission/job-submission.directive.js @@ -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,