mirror of
https://github.com/ansible/awx.git
synced 2026-03-28 22:35:08 -02: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:
@@ -67,8 +67,8 @@ function LegacyRedirect ($http, $stateRegistry) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'workflowPlaybookNodeRedirect',
|
name: 'workflowNodeRedirect',
|
||||||
url: '/workflow_node_playbook_results/:id',
|
url: '/workflow_node_results/:id',
|
||||||
redirectTo: (trans) => {
|
redirectTo: (trans) => {
|
||||||
// The workflow job viewer uses this route for playbook job nodes. The provided id
|
// 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
|
// 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 { results } = data;
|
||||||
const [obj] = results;
|
const [obj] = results;
|
||||||
|
|
||||||
if (obj && obj.type === 'workflow_job') {
|
if (obj) {
|
||||||
return { state: 'workflowResults', params: { id } };
|
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' }));
|
.catch(() => ({ state: 'dashboard' }));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -764,21 +764,11 @@ export default ['$state','moment', '$timeout', '$window', '$filter', 'Rest', 'Ge
|
|||||||
});
|
});
|
||||||
|
|
||||||
baseSvg.selectAll(".WorkflowChart-detailsLink")
|
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) {
|
.html(function (d) {
|
||||||
let href = "";
|
let href = "";
|
||||||
if (d.job) {
|
if (d.job) {
|
||||||
if(d.job.type === 'job') {
|
href = `/#/workflow_node_results/${d.job.id}`;
|
||||||
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}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return `<a href="${href}">${TemplatesStrings.get('workflow_maker.DETAILS')}</a>`;
|
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("y", nodeH - 15)
|
||||||
.attr("dy", ".35em")
|
.attr("dy", ".35em")
|
||||||
.attr("class", "WorkflowChart-detailsLink")
|
.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) {
|
.html(function (d) {
|
||||||
let href = "";
|
let href = "";
|
||||||
if (d.job) {
|
if (d.job) {
|
||||||
if(d.job.type === 'job') {
|
href = `/#/workflow_node_results/${d.job.id}`;
|
||||||
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}`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return `<a href="${href}">${TemplatesStrings.get('workflow_maker.DETAILS')}</a>`;
|
return `<a href="${href}">${TemplatesStrings.get('workflow_maker.DETAILS')}</a>`;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ export default [function(){
|
|||||||
|
|
||||||
if(node.summary_fields.job) {
|
if(node.summary_fields.job) {
|
||||||
nodeObj.job = 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) {
|
if(node.summary_fields.unified_job_template) {
|
||||||
nodeRef[nodeIdCounter].unifiedJobTemplate = nodeObj.unifiedJobTemplate = 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) => {
|
$scope.graphState.arrayOfNodesForChart.forEach((node) => {
|
||||||
if (nodeRef[node.id] && nodeRef[node.id].originalNodeObject.id === data.workflow_node_id) {
|
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") {
|
node.job = {
|
||||||
workflowResultsService.getWorkflowNode(nodeRef[node.id].originalNodeObject.url)
|
id: data.unified_job_id,
|
||||||
.then((nodeData) => {
|
status: data.status
|
||||||
nodeRef[node.id].jobType = nodeData.data.summary_fields.job.type;
|
};
|
||||||
|
|
||||||
node.job = {
|
$scope.$broadcast("refreshWorkflowChart");
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,10 +132,6 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
|
||||||
getWorkflowNode: (nodeUrl) => {
|
|
||||||
Rest.setUrl(nodeUrl);
|
|
||||||
return Rest.get();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return val;
|
return val;
|
||||||
|
|||||||
Reference in New Issue
Block a user