diff --git a/awx/ui/client/src/templates/main.js b/awx/ui/client/src/templates/main.js
index d18b1e5fc2..df92821c7f 100644
--- a/awx/ui/client/src/templates/main.js
+++ b/awx/ui/client/src/templates/main.js
@@ -112,7 +112,7 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplatesA
},
views: {
'modal': {
- template: ` `
+ template: ``
},
'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
templateProvider: function(WorkflowMakerJobTemplateList, generateList) {
diff --git a/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js b/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js
index 93ea82d27d..c0cbeb417d 100644
--- a/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js
+++ b/awx/ui/client/src/templates/workflows/edit-workflow/workflow-edit.controller.js
@@ -149,54 +149,7 @@
$scope.url = workflowJobTemplateData.url;
$scope.survey_enabled = workflowJobTemplateData.survey_enabled;
- let allNodes = [];
- let page = 1;
-
- let buildTreeFromNodes = function(){
- $scope.workflowTree = WorkflowService.buildTree({
- workflowNodes: allNodes
- });
-
- // TODO: I think that the workflow chart directive (and eventually d3) is meddling with
- // this workflowTree object and removing the children object for some reason (?)
- // This happens on occasion and I think is a race condition (?)
- if(!$scope.workflowTree.data.children) {
- $scope.workflowTree.data.children = [];
- }
-
- $scope.workflowTree.workflow_job_template_obj = $scope.workflow_job_template_obj;
-
- // In the partial, the workflow maker directive has an ng-if attribute which is pointed at this scope variable.
- // It won't get included until this the tree has been built - I'm open to better ways of doing this.
- $scope.includeWorkflowMaker = true;
- };
-
- let getNodes = function(){
- // Get the workflow nodes
- TemplatesService.getWorkflowJobTemplateNodes(id, page)
- .then(function(data){
- for(var i=0; i
-
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 5a2f0c80cc..0f0b9e1f58 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
@@ -779,11 +779,15 @@ export default [ '$state','moment',
scope.$watch('canAddWorkflowJobTemplate', function() {
// Redraw the graph if permissions change
- update();
+ if(scope.treeData) {
+ update();
+ }
});
- scope.$on('refreshWorkflowChart', function(){
- update();
+ scope.$on('refreshWorkflowChart', function(){console.log(scope.treeData);
+ if(scope.treeData) {
+ update();
+ }
});
scope.$on('panWorkflowChart', function(evt, params) {
@@ -798,6 +802,13 @@ export default [ '$state','moment',
manualZoom(params.zoom);
});
+ let clearWatchTreeData = scope.$watch('treeData', function(newVal) {
+ if(newVal) {
+ update();
+ clearWatchTreeData();
+ }
+ });
+
}
};
}];
diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.block.less b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.block.less
index 4fd54ad08f..aa61efa0b7 100644
--- a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.block.less
+++ b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.block.less
@@ -154,7 +154,7 @@
padding-left: 20px;
}
.WorkflowLegend-maker--right {
- flex: 0 0 206px;
+ flex: 0 0 215px;
text-align: right;
padding-right: 20px;
position: relative;
@@ -226,7 +226,7 @@
}
.WorkflowMaker-manualControls {
position: absolute;
- left: -86px;
+ left: -77px;
height: 60px;
width: 293px;
background-color: @default-bg;
diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js
index 368effdaaf..63c36bca39 100644
--- a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js
+++ b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.controller.js
@@ -40,9 +40,56 @@ export default ['$scope', 'WorkflowService', 'generateList', 'TemplateList', 'Pr
$scope.disassociateRequests = [];
function init() {
- $scope.treeDataMaster = angular.copy($scope.treeData.data);
- $scope.showManualControls = false;
- $scope.$broadcast("refreshWorkflowChart");
+
+ let allNodes = [];
+ let page = 1;
+
+ let buildTreeFromNodes = function(){
+ WorkflowService.buildTree({
+ workflowNodes: allNodes
+ }).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.treeData.workflow_job_template_obj = $scope.workflowJobTemplateObj;
+
+ $scope.treeDataMaster = angular.copy($scope.treeData.data);
+ $scope.showManualControls = false;
+ });
+ };
+
+ let getNodes = function(){
+ // Get the workflow nodes
+ TemplatesService.getWorkflowJobTemplateNodes($scope.workflowJobTemplateObj.id, page)
+ .then(function(data){
+ for(var i=0; i