mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03:30
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:
parent
2d237b6dbb
commit
2697615dbf
@ -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' }));
|
||||
}
|
||||
|
||||
@ -764,21 +764,11 @@ export default ['$state','moment', '$timeout', '$window', '$filter', 'Rest', 'Ge
|
||||
});
|
||||
|
||||
baseSvg.selectAll(".WorkflowChart-detailsLink")
|
||||
.style("display", function(d){ return d.job && d.job.status && d.job.id && d.job.type ? null : "none"; })
|
||||
.style("display", function(d){ return d.job && d.job.status && d.job.id ? null : "none"; })
|
||||
.html(function (d) {
|
||||
let href = "";
|
||||
if (d.job) {
|
||||
if(d.job.type === 'job') {
|
||||
href = `/#/workflow_node_playbook_results/${d.job.id}`;
|
||||
}
|
||||
else if(d.job.type === 'inventory_update') {
|
||||
href = `/#/jobs/inventory/${d.job.id}`;
|
||||
}
|
||||
else if(d.job.type === 'project_update') {
|
||||
href = `/#/jobs/project/${d.job.id}`;
|
||||
} else if (d.job.type === 'workflow_job') {
|
||||
href = `/#/workflows/${d.job.id}`;
|
||||
}
|
||||
href = `/#/workflow_node_results/${d.job.id}`;
|
||||
}
|
||||
return `<a href="${href}">${TemplatesStrings.get('workflow_maker.DETAILS')}</a>`;
|
||||
});
|
||||
@ -1065,21 +1055,11 @@ export default ['$state','moment', '$timeout', '$window', '$filter', 'Rest', 'Ge
|
||||
.attr("y", nodeH - 15)
|
||||
.attr("dy", ".35em")
|
||||
.attr("class", "WorkflowChart-detailsLink")
|
||||
.style("display", function(d){ return d.job && d.job.status && d.job.id && d.job.type ? null : "none"; })
|
||||
.style("display", function(d){ return d.job && d.job.status && d.job.id ? null : "none"; })
|
||||
.html(function (d) {
|
||||
let href = "";
|
||||
if (d.job) {
|
||||
if(d.job.type === 'job') {
|
||||
href = `/#/workflow_node_playbook_results/${d.job.id}`;
|
||||
}
|
||||
else if(d.job.type === 'inventory_update') {
|
||||
href = `/#/jobs/inventory/${d.job.id}`;
|
||||
}
|
||||
else if(d.job.type === 'project_update') {
|
||||
href = `/#/jobs/project/${d.job.id}`;
|
||||
} else if (d.job.type === 'workflow_job') {
|
||||
href = `/#/workflows/${d.job.id}`;
|
||||
}
|
||||
href = `/#/workflow_node_results/${d.job.id}`;
|
||||
}
|
||||
return `<a href="${href}">${TemplatesStrings.get('workflow_maker.DETAILS')}</a>`;
|
||||
});
|
||||
|
||||
@ -33,7 +33,6 @@ export default [function(){
|
||||
|
||||
if(node.summary_fields.job) {
|
||||
nodeObj.job = node.summary_fields.job;
|
||||
nodeRef[nodeIdCounter].jobType = node.summary_fields.job.type;
|
||||
}
|
||||
if(node.summary_fields.unified_job_template) {
|
||||
nodeRef[nodeIdCounter].unifiedJobTemplate = nodeObj.unifiedJobTemplate = node.summary_fields.unified_job_template;
|
||||
|
||||
@ -279,32 +279,12 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions',
|
||||
|
||||
$scope.graphState.arrayOfNodesForChart.forEach((node) => {
|
||||
if (nodeRef[node.id] && nodeRef[node.id].originalNodeObject.id === data.workflow_node_id) {
|
||||
if (!nodeRef[node.id].jobType && nodeRef[node.id].unifiedJobTemplate.unified_job_type === "job") {
|
||||
workflowResultsService.getWorkflowNode(nodeRef[node.id].originalNodeObject.url)
|
||||
.then((nodeData) => {
|
||||
nodeRef[node.id].jobType = nodeData.data.summary_fields.job.type;
|
||||
node.job = {
|
||||
id: data.unified_job_id,
|
||||
status: data.status
|
||||
};
|
||||
|
||||
node.job = {
|
||||
id: data.unified_job_id,
|
||||
status: data.status,
|
||||
type: nodeRef[node.id].jobType
|
||||
};
|
||||
|
||||
$scope.$broadcast("refreshWorkflowChart");
|
||||
})
|
||||
.catch(({ data, status }) => {
|
||||
const params = { hdr: 'Error!', msg: `Call to get workflow node failed. Return status: ${status}` };
|
||||
ProcessErrors($scope, data, status, null, params);
|
||||
});
|
||||
} else {
|
||||
node.job = {
|
||||
id: data.unified_job_id,
|
||||
status: data.status,
|
||||
type: nodeRef[node.id].jobType || nodeRef[node.id].unifiedJobTemplate.unified_job_type
|
||||
};
|
||||
|
||||
$scope.$broadcast("refreshWorkflowChart");
|
||||
}
|
||||
$scope.$broadcast("refreshWorkflowChart");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -132,10 +132,6 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getWorkflowNode: (nodeUrl) => {
|
||||
Rest.setUrl(nodeUrl);
|
||||
return Rest.get();
|
||||
}
|
||||
};
|
||||
return val;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user