1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Denoting incomplete nodes (nodes where the resource has been deleted or null'd out by copy)

This commit is contained in:
Michael Abashian 2016-12-01 17:13:50 -05:00
parent 496d6ae278
commit 0dc7fa9890
5 changed files with 120 additions and 96 deletions

View File

@ -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;
}

View File

@ -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 "<span class=\"WorkflowChart-incompleteIcon\">\uf06a</span><span> INCOMPLETE</span>";
})
.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; });
}

View File

@ -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

View File

@ -63,7 +63,7 @@
<workflow-chart tree-data="treeData.data" add-node="startAddNode(parent, betweenTwoNodes)" edit-node="startEditNode(nodeToEdit)" delete-node="startDeleteNode(nodeToDelete)" can-add-workflow-job-template="canAddWorkflowJobTemplate" mode="edit" class="WorkflowMaker-chart"></workflow-chart>
</div>
<div class="WorkflowMaker-contentRight">
<div class="WorkflowMaker-formTitle">{{(workflowMakerFormConfig.nodeMode === 'edit' && nodeBeingEdited && nodeBeingEdited.unifiedJobTemplate && nodeBeingEdited.unifiedJobTemplate.name) ? nodeBeingEdited.unifiedJobTemplate.name : "ADD A TEMPLATE"}}</div>
<div class="WorkflowMaker-formTitle">{{(workflowMakerFormConfig.nodeMode === 'edit' && nodeBeingEdited) ? ((nodeBeingEdited.unifiedJobTemplate && nodeBeingEdited.unifiedJobTemplate.name) ? nodeBeingEdited.unifiedJobTemplate.name : "EDIT TEMPLATE") : "ADD A TEMPLATE"}}</div>
<div class="WorkflowMaker-formHelp" ng-show="workflowMakerFormConfig.nodeMode === 'idle'">Please hover over a template and click the Add button.</div>
<div class="WorkflowMaker-form" ng-show="workflowMakerFormConfig.nodeMode === 'add' || workflowMakerFormConfig.nodeMode === 'edit'">
<div class="Form-tabHolder">

View File

@ -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({