Undo GET request that was made for workflow node jobs missing a type and instead leverage the redirect route. The workflow node results redirect now works for all job types.

This commit is contained in:
mabashian
2018-12-17 10:26:01 -05:00
parent 2d237b6dbb
commit 2697615dbf
5 changed files with 22 additions and 59 deletions

View File

@@ -67,8 +67,8 @@ function LegacyRedirect ($http, $stateRegistry) {
}
},
{
name: 'workflowPlaybookNodeRedirect',
url: '/workflow_node_playbook_results/:id',
name: 'workflowNodeRedirect',
url: '/workflow_node_results/:id',
redirectTo: (trans) => {
// The workflow job viewer uses this route for playbook job nodes. The provided id
// is used to lookup the corresponding unified job, which is then inspected to
@@ -81,11 +81,19 @@ function LegacyRedirect ($http, $stateRegistry) {
const { results } = data;
const [obj] = results;
if (obj && obj.type === 'workflow_job') {
return { state: 'workflowResults', params: { id } };
if (obj) {
if (obj.type === 'workflow_job') {
return { state: 'workflowResults', params: { id } };
} else if (obj.type === 'job') {
return { state: 'output', params: { type: 'playbook', id } };
} else if (obj.type === 'inventory_update') {
return { state: 'output', params: { type: 'inventory', id } };
} else if (obj.type === 'project_update') {
return { state: 'output', params: { type: 'project', id } };
}
}
return { state: destination, params: { type: 'playbook', id } };
return { state: 'jobs' };
})
.catch(() => ({ state: 'dashboard' }));
}