Merge pull request #4539 from mabashian/4505-relaunch-workflow-job

Properly relaunch a workflow job from the jobs list
This commit is contained in:
Michael Abashian
2016-12-21 17:42:13 -05:00
committed by GitHub
4 changed files with 12 additions and 10 deletions

View File

@@ -29,7 +29,7 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $
$scope.showJobType = true; $scope.showJobType = true;
} }
$scope.$on(`${list.iterator}_options`, function(event, data){ $scope.$on(`${list.iterator}_options`, function(event, data){
$scope.options = data.data.actions.GET; $scope.options = data.data.actions.GET;
optionsRequestDataProcessing(); optionsRequestDataProcessing();
@@ -87,7 +87,7 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $
typeId = job.inventory_source; typeId = job.inventory_source;
} else if (job.type === 'project_update') { } else if (job.type === 'project_update') {
typeId = job.project; typeId = job.project;
} else if (job.type === 'job' || job.type === "system_job" || job.type === 'ad_hoc_command') { } else if (job.type === 'job' || job.type === "system_job" || job.type === 'ad_hoc_command' || job.type === 'workflow_job') {
typeId = job.id; typeId = job.id;
} }
RelaunchJob({ scope: $scope, id: typeId, type: job.type, name: job.name }); RelaunchJob({ scope: $scope, id: typeId, type: job.type, name: job.name });

View File

@@ -29,8 +29,8 @@ export default
else if (type === 'ad_hoc_command') { else if (type === 'ad_hoc_command') {
RelaunchAdhoc({ scope: scope, id: id, name: name }); RelaunchAdhoc({ scope: scope, id: id, name: name });
} }
else if (type === 'job' || type === 'system_job') { else if (type === 'job' || type === 'system_job' || type === 'workflow_job') {
RelaunchPlaybook({ scope: scope, id: id, name: name }); RelaunchPlaybook({ scope: scope, id: id, name: name, job_type: type });
} }
else if (type === 'project_update') { else if (type === 'project_update') {
RelaunchSCM({ scope: scope, id: id }); RelaunchSCM({ scope: scope, id: id });
@@ -289,8 +289,9 @@ export default
.factory('RelaunchPlaybook', ['InitiatePlaybookRun', function(InitiatePlaybookRun) { .factory('RelaunchPlaybook', ['InitiatePlaybookRun', function(InitiatePlaybookRun) {
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, relaunch: true }); job_type = params.job_type;
InitiatePlaybookRun({ scope: scope, id: id, relaunch: true, job_type: job_type });
}; };
}]) }])

View File

@@ -1,6 +1,6 @@
export default export default
function LaunchJob(Rest, Wait, ProcessErrors, ToJSON, Empty, GetBasePath, $state, $location) { function LaunchJob(Rest, Wait, ProcessErrors, ToJSON, Empty, GetBasePath, $state, $location, $rootScope) {
// This factory gathers up all the job launch data and POST's it. // This factory gathers up all the job launch data and POST's it.
@@ -121,7 +121,7 @@ export default
.success(function(data) { .success(function(data) {
Wait('stop'); Wait('stop');
var job = data.job || data.system_job || data.project_update || data.inventory_update || data.ad_hoc_command || data.workflow_job; var job = data.job || data.system_job || data.project_update || data.inventory_update || data.ad_hoc_command || data.workflow_job;
if((scope.portalMode===false || scope.$parent.portalMode===false ) && Empty(data.system_job) || (base === 'home')){ if($rootScope.portalMode===false && Empty(data.system_job) || (base === 'home')){
// use $state.go with reload: true option to re-instantiate sockets in // use $state.go with reload: true option to re-instantiate sockets in
var goToJobDetails = function(state) { var goToJobDetails = function(state) {
@@ -207,5 +207,6 @@ LaunchJob.$inject =
'Empty', 'Empty',
'GetBasePath', 'GetBasePath',
'$state', '$state',
'$location' '$location',
'$rootScope'
]; ];

View File

@@ -145,7 +145,7 @@ export default
} }
} }
else { else {
if($scope.submitJobType && $scope.submitJobType === 'workflow_job_template') { if($scope.submitJobType && $scope.submitJobType === 'workflow_job') {
launch_url = GetBasePath('workflow_jobs') + $scope.submitJobId + '/relaunch/'; launch_url = GetBasePath('workflow_jobs') + $scope.submitJobId + '/relaunch/';
} }
else { else {