diff --git a/awx/ui/client/features/output/legacy.route.js b/awx/ui/client/features/output/legacy.route.js index b2425c85af..838cc5c25d 100644 --- a/awx/ui/client/features/output/legacy.route.js +++ b/awx/ui/client/features/output/legacy.route.js @@ -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' })); } diff --git a/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js b/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js index aa37b1a1d5..bea6c7d1a3 100644 --- a/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js +++ b/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.directive.js @@ -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 `${TemplatesStrings.get('workflow_maker.DETAILS')}`; }); @@ -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 `${TemplatesStrings.get('workflow_maker.DETAILS')}`; }); diff --git a/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.service.js b/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.service.js index d38fc23031..beec159e37 100644 --- a/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.service.js +++ b/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.service.js @@ -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; diff --git a/awx/ui/client/src/workflow-results/workflow-results.controller.js b/awx/ui/client/src/workflow-results/workflow-results.controller.js index 9f20e2b5b2..8b8f60e859 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.controller.js +++ b/awx/ui/client/src/workflow-results/workflow-results.controller.js @@ -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"); } }); } diff --git a/awx/ui/client/src/workflow-results/workflow-results.service.js b/awx/ui/client/src/workflow-results/workflow-results.service.js index 9860b3726b..6fbfc59371 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.service.js +++ b/awx/ui/client/src/workflow-results/workflow-results.service.js @@ -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;