mirror of
https://github.com/ansible/awx.git
synced 2026-02-17 03:00:04 -03:30
Various workflow maker bug fixes
This commit is contained in:
@@ -326,7 +326,7 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplates.
|
|||||||
},
|
},
|
||||||
views: {
|
views: {
|
||||||
'modal': {
|
'modal': {
|
||||||
template: `<workflow-maker ng-if="includeWorkflowMaker" workflow-job-template-obj="workflow_job_template_obj" can-add-workflow-job-template="canAddWorkflowJobTemplate" edge-type="edgeType"></workflow-maker>`
|
template: `<workflow-maker ng-if="includeWorkflowMaker" workflow-job-template-obj="workflow_job_template_obj" can-add-workflow-job-template="canAddWorkflowJobTemplate"></workflow-maker>`
|
||||||
},
|
},
|
||||||
'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
|
'jobTemplateList@templates.editWorkflowJobTemplate.workflowMaker': {
|
||||||
templateProvider: function(WorkflowMakerJobTemplateList, generateList) {
|
templateProvider: function(WorkflowMakerJobTemplateList, generateList) {
|
||||||
@@ -620,6 +620,9 @@ angular.module('templates', [surveyMaker.name, templatesList.name, jobTemplates.
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.$on('setEdgeType', function(e, edgeType) {
|
||||||
|
$scope.edgeType = edgeType;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ export default ['$state','moment', '$timeout', '$window', '$filter', 'Rest', 'Ge
|
|||||||
}).each(wrap);
|
}).each(wrap);
|
||||||
|
|
||||||
thisNode.append("foreignObject")
|
thisNode.append("foreignObject")
|
||||||
.attr("x", 43)
|
.attr("x", 54)
|
||||||
.attr("y", 45)
|
.attr("y", 45)
|
||||||
.style("font-size","0.7em")
|
.style("font-size","0.7em")
|
||||||
.attr("class", "WorkflowChart-conflictText")
|
.attr("class", "WorkflowChart-conflictText")
|
||||||
|
|||||||
@@ -109,26 +109,6 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
// params.parentId
|
// params.parentId
|
||||||
// params.node
|
// params.node
|
||||||
|
|
||||||
let generatePostUrl = function(){
|
|
||||||
|
|
||||||
let base = (params.parentId) ? GetBasePath('workflow_job_template_nodes') + params.parentId : $scope.treeData.workflow_job_template_obj.related.workflow_nodes;
|
|
||||||
|
|
||||||
if(params.parentId) {
|
|
||||||
if(params.node.edgeType === 'success') {
|
|
||||||
base += "/success_nodes";
|
|
||||||
}
|
|
||||||
else if(params.node.edgeType === 'failure') {
|
|
||||||
base += "/failure_nodes";
|
|
||||||
}
|
|
||||||
else if(params.node.edgeType === 'always') {
|
|
||||||
base += "/always_nodes";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return base;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
let buildSendableNodeData = function() {
|
let buildSendableNodeData = function() {
|
||||||
// Create the node
|
// Create the node
|
||||||
let sendableNodeData = {
|
let sendableNodeData = {
|
||||||
@@ -198,10 +178,17 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
if(params.node.isNew) {
|
if(params.node.isNew) {
|
||||||
|
|
||||||
TemplatesService.addWorkflowNode({
|
TemplatesService.addWorkflowNode({
|
||||||
url: generatePostUrl(),
|
url: $scope.treeData.workflow_job_template_obj.related.workflow_nodes,
|
||||||
data: buildSendableNodeData()
|
data: buildSendableNodeData()
|
||||||
})
|
})
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
|
|
||||||
|
$scope.associateRequests.push({
|
||||||
|
parentId: params.parentId,
|
||||||
|
nodeId: data.data.id,
|
||||||
|
edge: params.node.edgeType
|
||||||
|
});
|
||||||
|
|
||||||
params.node.isNew = false;
|
params.node.isNew = false;
|
||||||
continueRecursing(data.data.id);
|
continueRecursing(data.data.id);
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
@@ -227,12 +214,22 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
|
|
||||||
if((params.node.originalParentId && params.parentId !== params.node.originalParentId) || params.node.originalEdge !== params.node.edgeType) {//beep
|
if((params.node.originalParentId && params.parentId !== params.node.originalParentId) || params.node.originalEdge !== params.node.edgeType) {//beep
|
||||||
|
|
||||||
$scope.disassociateRequests.push({
|
let parentIsDeleted = false;
|
||||||
parentId: params.node.originalParentId,
|
|
||||||
nodeId: params.node.nodeId,
|
_.forEach($scope.treeData.data.deletedNodes, function(deletedNode) {
|
||||||
edge: params.node.originalEdge
|
if(deletedNode === params.node.originalParentId) {
|
||||||
|
parentIsDeleted = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(!parentIsDeleted) {
|
||||||
|
$scope.disassociateRequests.push({
|
||||||
|
parentId: params.node.originalParentId,
|
||||||
|
nodeId: params.node.nodeId,
|
||||||
|
edge: params.node.originalEdge
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Can only associate if we have a parent.
|
// Can only associate if we have a parent.
|
||||||
// If we don't have a parent then this is a root node
|
// If we don't have a parent then this is a root node
|
||||||
// and the act of disassociating will make it a root node
|
// and the act of disassociating will make it a root node
|
||||||
@@ -365,12 +362,12 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Set the default to success
|
// Set the default to success
|
||||||
$scope.edgeType = "success";
|
let edgeType = "success";
|
||||||
|
|
||||||
if (parent && ((betweenTwoNodes && parent.source.isStartNode) || (!betweenTwoNodes && parent.isStartNode))) {
|
if (parent && ((betweenTwoNodes && parent.source.isStartNode) || (!betweenTwoNodes && parent.isStartNode))) {
|
||||||
// We don't want to give the user the option to select
|
// We don't want to give the user the option to select
|
||||||
// a type as this node will always be executed
|
// a type as this node will always be executed
|
||||||
$scope.edgeType = "always";
|
edgeType = "always";
|
||||||
$scope.edgeFlags.showTypeOptions = false;
|
$scope.edgeFlags.showTypeOptions = false;
|
||||||
} else {
|
} else {
|
||||||
if ((_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) && _.includes(siblingConnectionTypes, "always")) {
|
if ((_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) && _.includes(siblingConnectionTypes, "always")) {
|
||||||
@@ -378,10 +375,10 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
$scope.edgeFlags.typeRestriction = null;
|
$scope.edgeFlags.typeRestriction = null;
|
||||||
} else if (_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) {
|
} else if (_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) {
|
||||||
$scope.edgeFlags.typeRestriction = "successFailure";
|
$scope.edgeFlags.typeRestriction = "successFailure";
|
||||||
$scope.edgeType = "success";
|
edgeType = "success";
|
||||||
} else if (_.includes(siblingConnectionTypes, "always")) {
|
} else if (_.includes(siblingConnectionTypes, "always")) {
|
||||||
$scope.edgeFlags.typeRestriction = "always";
|
$scope.edgeFlags.typeRestriction = "always";
|
||||||
$scope.edgeType = "always";
|
edgeType = "always";
|
||||||
} else {
|
} else {
|
||||||
$scope.edgeFlags.typeRestriction = null;
|
$scope.edgeFlags.typeRestriction = null;
|
||||||
}
|
}
|
||||||
@@ -392,6 +389,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
// Reset the edgeConflict flag
|
// Reset the edgeConflict flag
|
||||||
resetEdgeConflict();
|
resetEdgeConflict();
|
||||||
|
|
||||||
|
$scope.$broadcast("setEdgeType", edgeType);
|
||||||
$scope.$broadcast("refreshWorkflowChart");
|
$scope.$broadcast("refreshWorkflowChart");
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -660,7 +658,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
$scope.edgeFlags.showTypeOptions = true;
|
$scope.edgeFlags.showTypeOptions = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.edgeType = $scope.nodeBeingEdited.edgeType;
|
$scope.$broadcast('setEdgeType', $scope.nodeBeingEdited.edgeType);
|
||||||
|
|
||||||
$scope.$broadcast('templateSelected', {
|
$scope.$broadcast('templateSelected', {
|
||||||
presetValues: formValues,
|
presetValues: formValues,
|
||||||
@@ -763,7 +761,6 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
|||||||
|
|
||||||
if($scope.workflowMakerFormConfig.nodeMode === "add") {
|
if($scope.workflowMakerFormConfig.nodeMode === "add") {
|
||||||
if($scope.placeholderNode.isRoot) {
|
if($scope.placeholderNode.isRoot) {
|
||||||
$scope.edgeType = "always";
|
|
||||||
$scope.edgeFlags.showTypeOptions = false;
|
$scope.edgeFlags.showTypeOptions = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ export default ['templateUrl', 'CreateDialog', 'Wait', '$state', '$window',
|
|||||||
return {
|
return {
|
||||||
scope: {
|
scope: {
|
||||||
workflowJobTemplateObj: '=',
|
workflowJobTemplateObj: '=',
|
||||||
canAddWorkflowJobTemplate: '=',
|
canAddWorkflowJobTemplate: '='
|
||||||
edgeType: '='
|
|
||||||
},
|
},
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: templateUrl('templates/workflows/workflow-maker/workflow-maker'),
|
templateUrl: templateUrl('templates/workflows/workflow-maker/workflow-maker'),
|
||||||
|
|||||||
Reference in New Issue
Block a user