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 91d2f82e30..b3f4110050 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,7 +764,7 @@ 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 ? null : "none"; }) + .style("display", function(d){ return d.job && d.job.status && d.job.id && d.job.type ? null : "none"; }) .html(function (d) { let href = ""; if (d.job) { @@ -1065,8 +1065,8 @@ 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 ? null : "none"; }) - .html(function () { + .style("display", function(d){ return d.job && d.job.status && d.job.id && d.job.type ? null : "none"; }) + .html(function (d) { let href = ""; if (d.job) { if(d.job.type === 'job') { 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 beec159e37..d38fc23031 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,6 +33,7 @@ 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 0ec32ad69c..9f20e2b5b2 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.controller.js +++ b/awx/ui/client/src/workflow-results/workflow-results.controller.js @@ -1,10 +1,10 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions', 'jobLabels', 'workflowNodes', '$scope', 'ParseTypeChange', 'ParseVariableString', 'count', '$state', 'i18n', 'WorkflowChartService', '$filter', - 'moment', function(workflowData, workflowResultsService, + 'moment', 'ProcessErrors', function(workflowData, workflowResultsService, workflowDataOptions, jobLabels, workflowNodes, $scope, ParseTypeChange, ParseVariableString, count, $state, i18n, WorkflowChartService, $filter, - moment) { + moment, ProcessErrors) { let nodeRef; var runTimeElapsedTimer = null; @@ -279,15 +279,34 @@ export default ['workflowData', 'workflowResultsService', 'workflowDataOptions', $scope.graphState.arrayOfNodesForChart.forEach((node) => { if (nodeRef[node.id] && nodeRef[node.id].originalNodeObject.id === data.workflow_node_id) { - node.job = { - id: data.unified_job_id, - status: data.status, - type: nodeRef[node.id].unifiedJobTemplate.unified_job_type - }; + 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, + 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"); } getLabelsAndTooltips(); }); 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 0db1f7a78c..9860b3726b 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.service.js +++ b/awx/ui/client/src/workflow-results/workflow-results.service.js @@ -133,6 +133,10 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr } return false; }, + getWorkflowNode: (nodeUrl) => { + Rest.setUrl(nodeUrl); + return Rest.get(); + } }; return val; }];