Properly relaunch a workflow job from the jobs list

This commit is contained in:
Michael Abashian 2016-12-21 17:27:46 -05:00
parent 78b07c8d10
commit 75334a4ea8
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.$on(`${list.iterator}_options`, function(event, data){
$scope.options = data.data.actions.GET;
optionsRequestDataProcessing();
@ -87,7 +87,7 @@ export function JobsListController($state, $rootScope, $log, $scope, $compile, $
typeId = job.inventory_source;
} else if (job.type === 'project_update') {
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;
}
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') {
RelaunchAdhoc({ scope: scope, id: id, name: name });
}
else if (type === 'job' || type === 'system_job') {
RelaunchPlaybook({ scope: scope, id: id, name: name });
else if (type === 'job' || type === 'system_job' || type === 'workflow_job') {
RelaunchPlaybook({ scope: scope, id: id, name: name, job_type: type });
}
else if (type === 'project_update') {
RelaunchSCM({ scope: scope, id: id });
@ -289,8 +289,9 @@ export default
.factory('RelaunchPlaybook', ['InitiatePlaybookRun', function(InitiatePlaybookRun) {
return function(params) {
var scope = params.scope,
id = params.id;
InitiatePlaybookRun({ scope: scope, id: id, relaunch: true });
id = params.id,
job_type = params.job_type;
InitiatePlaybookRun({ scope: scope, id: id, relaunch: true, job_type: job_type });
};
}])

View File

@ -1,6 +1,6 @@
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.
@ -121,7 +121,7 @@ export default
.success(function(data) {
Wait('stop');
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
var goToJobDetails = function(state) {
@ -207,5 +207,6 @@ LaunchJob.$inject =
'Empty',
'GetBasePath',
'$state',
'$location'
'$location',
'$rootScope'
];

View File

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