From 0dc7fa9890a2051bd2f4c0dc2aa21cdf25254744 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Thu, 1 Dec 2016 17:13:50 -0500 Subject: [PATCH] Denoting incomplete nodes (nodes where the resource has been deleted or null'd out by copy) --- .../workflow-chart/workflow-chart.block.less | 9 +- .../workflow-chart.directive.js | 13 ++ .../workflow-maker.controller.js | 187 +++++++++--------- .../workflow-maker.partial.html | 2 +- .../templates/workflows/workflow.service.js | 5 +- 5 files changed, 120 insertions(+), 96 deletions(-) diff --git a/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.block.less b/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.block.less index db51a1b8de..4c795d2a40 100644 --- a/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.block.less +++ b/awx/ui/client/src/templates/workflows/workflow-chart/workflow-chart.block.less @@ -22,7 +22,7 @@ .node { font-size: 12px; - font-family: 'Open Sans', sans-serif; + font-family: 'Open Sans', sans-serif, 'FontAwesome'; } .WorkflowChart-defaultText { @@ -83,3 +83,10 @@ fill: @default-link; cursor: pointer; } +.WorkflowChart-incompleteIcon { + color: @default-warning; +} +.WorkflowChart-incompleteText { + width: 90px; + color: @default-interface-txt; +} 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 2b6a8037f7..ac8e9c44ac 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 @@ -171,6 +171,17 @@ export default [ '$state', return (d.unifiedJobTemplate && d.unifiedJobTemplate.name) ? d.unifiedJobTemplate.name : ""; }).each(wrap); + thisNode.append("foreignObject") + .attr("x", 17) + .attr("y", 22) + .attr("dy", ".35em") + .attr("text-anchor", "middle") + .attr("class", "WorkflowChart-defaultText WorkflowChart-incompleteText") + .html(function () { + return "\uf06a INCOMPLETE"; + }) + .style("display", function(d) { return d.unifiedJobTemplate || d.placeholder ? "none" : null; }); + thisNode.append("circle") .attr("cy", rectH) .attr("r", 10) @@ -544,6 +555,8 @@ export default [ '$state', t.selectAll(".WorkflowChart-detailsLink") .style("display", function(d){ return d.job && d.job.jobStatus && d.job.unified_job_id ? null : "none"; }); + t.selectAll(".WorkflowChart-incompleteText") + .style("display", function(d){ return d.unifiedJobTemplate || d.placeholder ? "none" : null; }); } 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 7c7564ef40..7414826f53 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 @@ -228,107 +228,108 @@ export default ['$scope', 'WorkflowService', 'generateList', 'TemplateList', 'Pr let formValues = {}; - // build any prompt values - if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_credential_on_launch) { - if ($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.credential) { - formValues.credential_name = $scope.nodeBeingEdited.promptValues.credential.name; - formValues.credential = $scope.nodeBeingEdited.promptValues.credential.id; - } else if ($scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential) { - formValues.credential_name = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.name ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.name : null; - formValues.credential = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.id ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.id : null; - } else { - formValues.credential_name = null; - formValues.credential = null; - } - } - - if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_inventory_on_launch) { - if ($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.inventory) { - formValues.inventory_name = $scope.nodeBeingEdited.promptValues.inventory.name; - formValues.inventory = $scope.nodeBeingEdited.promptValues.inventory.id; - } else if ($scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory) { - formValues.inventory_name = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.name ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.name : null; - formValues.inventory = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.id ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.id : null; - } else { - formValues.inventory_name = null; - formValues.inventory = null; - } - } - - if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_job_type_on_launch) { - if ($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.job_type) { - formValues.job_type = { - value: $scope.nodeBeingEdited.promptValues.job_type - }; - } else if ($scope.nodeBeingEdited.originalNodeObj.job_type) { - formValues.job_type = { - value: $scope.nodeBeingEdited.originalNodeObj.job_type - }; - } else if ($scope.nodeBeingEdited.unifiedJobTemplate.job_type) { - formValues.job_type = { - value: $scope.nodeBeingEdited.unifiedJobTemplate.job_type - }; - } else { - formValues.job_type = { - value: null - }; + if($scope.nodeBeingEdited.unifiedJobTemplate){ + // build any prompt values + if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_credential_on_launch) { + if ($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.credential) { + formValues.credential_name = $scope.nodeBeingEdited.promptValues.credential.name; + formValues.credential = $scope.nodeBeingEdited.promptValues.credential.id; + } else if ($scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential) { + formValues.credential_name = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.name ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.name : null; + formValues.credential = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.id ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.credential.id : null; + } else { + formValues.credential_name = null; + formValues.credential = null; + } } - } - - if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_limit_on_launch) { - if ($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.limit === 'string') { - formValues.limit = $scope.nodeBeingEdited.promptValues.limit; - } else if (typeof $scope.nodeBeingEdited.originalNodeObj.limit === 'string') { - formValues.limit = $scope.nodeBeingEdited.originalNodeObj.limit; - } else if (typeof $scope.nodeBeingEdited.unifiedJobTemplate.limit === 'string') { - formValues.limit = $scope.nodeBeingEdited.unifiedJobTemplate.limit; - } else { - formValues.limit = null; + if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_inventory_on_launch) { + if ($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.inventory) { + formValues.inventory_name = $scope.nodeBeingEdited.promptValues.inventory.name; + formValues.inventory = $scope.nodeBeingEdited.promptValues.inventory.id; + } else if ($scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory) { + formValues.inventory_name = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.name ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.name : null; + formValues.inventory = $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.id ? $scope.nodeBeingEdited.unifiedJobTemplate.summary_fields.inventory.id : null; + } else { + formValues.inventory_name = null; + formValues.inventory = null; + } } - } - if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_skip_tags_on_launch) { - if ($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.skip_tags === 'string') { - formValues.skip_tags = $scope.nodeBeingEdited.promptValues.skip_tags; - } else if (typeof $scope.nodeBeingEdited.originalNodeObj.skip_tags === 'string') { - formValues.skip_tags = $scope.nodeBeingEdited.originalNodeObj.skip_tags; - } else if (typeof $scope.nodeBeingEdited.unifiedJobTemplate.skip_tags === 'string') { - formValues.skip_tags = $scope.nodeBeingEdited.unifiedJobTemplate.skip_tags; - } else { - formValues.skip_tags = null; + + if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_job_type_on_launch) { + if ($scope.nodeBeingEdited.promptValues && $scope.nodeBeingEdited.promptValues.job_type) { + formValues.job_type = { + value: $scope.nodeBeingEdited.promptValues.job_type + }; + } else if ($scope.nodeBeingEdited.originalNodeObj.job_type) { + formValues.job_type = { + value: $scope.nodeBeingEdited.originalNodeObj.job_type + }; + } else if ($scope.nodeBeingEdited.unifiedJobTemplate.job_type) { + formValues.job_type = { + value: $scope.nodeBeingEdited.unifiedJobTemplate.job_type + }; + } else { + formValues.job_type = { + value: null + }; + } + } - } - if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_tags_on_launch) { - if ($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.job_tags === 'string') { - formValues.job_tags = $scope.nodeBeingEdited.promptValues.job_tags; - } else if (typeof $scope.nodeBeingEdited.originalNodeObj.job_tags === 'string') { - formValues.job_tags = $scope.nodeBeingEdited.originalNodeObj.job_tags; - } else if (typeof $scope.nodeBeingEdited.unifiedJobTemplate.job_tags === 'string') { - formValues.job_tags = $scope.nodeBeingEdited.unifiedJobTemplate.job_tags; - } else { - formValues.job_tags = null; + + if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_limit_on_launch) { + if ($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.limit === 'string') { + formValues.limit = $scope.nodeBeingEdited.promptValues.limit; + } else if (typeof $scope.nodeBeingEdited.originalNodeObj.limit === 'string') { + formValues.limit = $scope.nodeBeingEdited.originalNodeObj.limit; + } else if (typeof $scope.nodeBeingEdited.unifiedJobTemplate.limit === 'string') { + formValues.limit = $scope.nodeBeingEdited.unifiedJobTemplate.limit; + } else { + formValues.limit = null; + } + } + if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_skip_tags_on_launch) { + if ($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.skip_tags === 'string') { + formValues.skip_tags = $scope.nodeBeingEdited.promptValues.skip_tags; + } else if (typeof $scope.nodeBeingEdited.originalNodeObj.skip_tags === 'string') { + formValues.skip_tags = $scope.nodeBeingEdited.originalNodeObj.skip_tags; + } else if (typeof $scope.nodeBeingEdited.unifiedJobTemplate.skip_tags === 'string') { + formValues.skip_tags = $scope.nodeBeingEdited.unifiedJobTemplate.skip_tags; + } else { + formValues.skip_tags = null; + } + } + if ($scope.nodeBeingEdited.unifiedJobTemplate.ask_tags_on_launch) { + if ($scope.nodeBeingEdited.promptValues && typeof $scope.nodeBeingEdited.promptValues.job_tags === 'string') { + formValues.job_tags = $scope.nodeBeingEdited.promptValues.job_tags; + } else if (typeof $scope.nodeBeingEdited.originalNodeObj.job_tags === 'string') { + formValues.job_tags = $scope.nodeBeingEdited.originalNodeObj.job_tags; + } else if (typeof $scope.nodeBeingEdited.unifiedJobTemplate.job_tags === 'string') { + formValues.job_tags = $scope.nodeBeingEdited.unifiedJobTemplate.job_tags; + } else { + formValues.job_tags = null; + } } - } - if ($scope.nodeBeingEdited.unifiedJobTemplate.type === "job_template") { - $scope.workflowMakerFormConfig.activeTab = "jobs"; - } - - $scope.selectedTemplate = $scope.nodeBeingEdited.unifiedJobTemplate; - - switch ($scope.nodeBeingEdited.unifiedJobTemplate.type) { - case "job_template": + if ($scope.nodeBeingEdited.unifiedJobTemplate.type === "job_template") { $scope.workflowMakerFormConfig.activeTab = "jobs"; - break; - case "project": - $scope.workflowMakerFormConfig.activeTab = "project_sync"; - break; - case "inventory_source": - $scope.workflowMakerFormConfig.activeTab = "inventory_sync"; - break; + } + + $scope.selectedTemplate = $scope.nodeBeingEdited.unifiedJobTemplate; + + switch ($scope.nodeBeingEdited.unifiedJobTemplate.type) { + case "job_template": + $scope.workflowMakerFormConfig.activeTab = "jobs"; + break; + case "project": + $scope.workflowMakerFormConfig.activeTab = "project_sync"; + break; + case "inventory_source": + $scope.workflowMakerFormConfig.activeTab = "inventory_sync"; + break; + } } - //formValues.edgeType = $scope.nodeBeingEdited.edgeType; $scope.showTypeOptions = (parent && parent.isStartNode) ? false : true; $scope.$broadcast('setEdgeType', $scope.nodeBeingEdited.edgeType); @@ -344,7 +345,7 @@ export default ['$scope', 'WorkflowService', 'generateList', 'TemplateList', 'Pr // Determine whether or not we need to go out and GET this nodes unified job template // in order to determine whether or not prompt fields are needed - if (!$scope.nodeBeingEdited.isNew && !$scope.nodeBeingEdited.edited && $scope.nodeBeingEdited.unifiedJobTemplate.unified_job_type && $scope.nodeBeingEdited.unifiedJobTemplate.unified_job_type === 'job') { + if (!$scope.nodeBeingEdited.isNew && !$scope.nodeBeingEdited.edited && $scope.nodeBeingEdited.unifiedJobTemplate && $scope.nodeBeingEdited.unifiedJobTemplate.unified_job_type && $scope.nodeBeingEdited.unifiedJobTemplate.unified_job_type === 'job') { // This is a node that we got back from the api with an incomplete // unified job template so we're going to pull down the whole object diff --git a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.partial.html b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.partial.html index 8674576710..81a6261738 100644 --- a/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.partial.html +++ b/awx/ui/client/src/templates/workflows/workflow-maker/workflow-maker.partial.html @@ -63,7 +63,7 @@
-
{{(workflowMakerFormConfig.nodeMode === 'edit' && nodeBeingEdited && nodeBeingEdited.unifiedJobTemplate && nodeBeingEdited.unifiedJobTemplate.name) ? nodeBeingEdited.unifiedJobTemplate.name : "ADD A TEMPLATE"}}
+
{{(workflowMakerFormConfig.nodeMode === 'edit' && nodeBeingEdited) ? ((nodeBeingEdited.unifiedJobTemplate && nodeBeingEdited.unifiedJobTemplate.name) ? nodeBeingEdited.unifiedJobTemplate.name : "EDIT TEMPLATE") : "ADD A TEMPLATE"}}
Please hover over a template and click the Add button.
diff --git a/awx/ui/client/src/templates/workflows/workflow.service.js b/awx/ui/client/src/templates/workflows/workflow.service.js index 6dce55f179..36282fac29 100644 --- a/awx/ui/client/src/templates/workflows/workflow.service.js +++ b/awx/ui/client/src/templates/workflows/workflow.service.js @@ -203,7 +203,6 @@ export default [function(){ canAddTo: true, placeholder: false, edgeType: params.edgeType, - unifiedJobTemplate: _.clone(params.nodesObj[params.nodeId].summary_fields.unified_job_template), isNew: false, edited: false, originalEdge: params.edgeType, @@ -227,6 +226,10 @@ export default [function(){ }; } + if(params.nodesObj[params.nodeId].summary_fields.unified_job_template) { + treeNode.unifiedJobTemplate = _.clone(params.nodesObj[params.nodeId].summary_fields.unified_job_template); + } + // Loop across the success nodes and add them recursively _.forEach(params.nodesObj[params.nodeId].success_nodes, function(successNodeId) { treeNode.children.push(_this.buildBranch({