From a380830861c345d2c4bf9f3a013ed58e12a68e00 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Wed, 25 Jan 2017 10:46:28 -0500 Subject: [PATCH] Building workflow node tree now returns a promise. Code needed to be updated accordingly --- .../workflow-results.controller.js | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) 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 9522aa0e9f..43d4423a9f 100644 --- a/awx/ui/client/src/workflow-results/workflow-results.controller.js +++ b/awx/ui/client/src/workflow-results/workflow-results.controller.js @@ -85,27 +85,23 @@ export default ['workflowData', // Click binding for the expand/collapse button on the standard out log $scope.stdoutFullScreen = false; - $scope.treeData = WorkflowService.buildTree({ + WorkflowService.buildTree({ workflowNodes: workflowNodes + }).then(function(data){ + $scope.treeData = data; + + // TODO: I think that the workflow chart directive (and eventually d3) is meddling with + // this treeData object and removing the children object for some reason (?) + // This happens on occasion and I think is a race condition (?) + if(!$scope.treeData.data.children) { + $scope.treeData.data.children = []; + } + + $scope.canAddWorkflowJobTemplate = false; }); - // TODO: I think that the workflow chart directive (and eventually d3) is meddling with - // this treeData object and removing the children object for some reason (?) - // This happens on occasion and I think is a race condition (?) - if(!$scope.treeData.data.children) { - $scope.treeData.data.children = []; - } - - $scope.canAddWorkflowJobTemplate = false; - } - // var getTotalHostCount = function(count) { - // return Object - // .keys(count).reduce((acc, i) => acc += count[i], 0); - // }; - - $scope.toggleStdoutFullscreen = function() { $scope.stdoutFullScreen = !$scope.stdoutFullScreen;