mirror of
https://github.com/ansible/awx.git
synced 2026-05-24 17:17:45 -02:30
Merge pull request #1120 from mabashian/1066-workflow-node-credentials
Fixed workflow node credential bug
This commit is contained in:
@@ -74,7 +74,8 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
let buildSendableNodeData = function() {
|
||||
// Create the node
|
||||
let sendableNodeData = {
|
||||
unified_job_template: params.node.unifiedJobTemplate.id
|
||||
unified_job_template: params.node.unifiedJobTemplate.id,
|
||||
credential: _.get(params, 'node.originalNodeObj.credential') || null
|
||||
};
|
||||
|
||||
if (_.has(params, 'node.promptData.extraVars')) {
|
||||
@@ -120,8 +121,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
if ($scope.totalIteratedNodes === $scope.treeData.data.totalNodes) {
|
||||
// We're done recursing, lets move on
|
||||
completionCallback();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (params.node.children && params.node.children.length > 0) {
|
||||
_.forEach(params.node.children, function(child) {
|
||||
if (child.edgeType === "success") {
|
||||
@@ -129,14 +129,12 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
parentId: parentId,
|
||||
node: child
|
||||
}, completionCallback);
|
||||
}
|
||||
else if(child.edgeType === "failure") {
|
||||
} else if (child.edgeType === "failure") {
|
||||
recursiveNodeUpdates({
|
||||
parentId: parentId,
|
||||
node: child
|
||||
}, completionCallback);
|
||||
}
|
||||
else if(child.edgeType === "always") {
|
||||
} else if (child.edgeType === "always") {
|
||||
recursiveNodeUpdates({
|
||||
parentId: parentId,
|
||||
node: child
|
||||
@@ -193,8 +191,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
error.status
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (params.node.edited || !params.node.originalParentId || (params.node.originalParentId && params.parentId !== params.node.originalParentId)) {
|
||||
|
||||
if (params.node.edited) {
|
||||
@@ -243,7 +240,6 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((params.node.originalParentId && params.parentId !== params.node.originalParentId) || params.node.originalEdge !== params.node.edgeType) {//beep
|
||||
@@ -275,8 +271,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
else if(!params.node.originalParentId && params.parentId) {
|
||||
} else if (!params.node.originalParentId && params.parentId) {
|
||||
// This used to be a root node but is now not a root node
|
||||
associateRequests.push({
|
||||
parentId: params.parentId,
|
||||
@@ -376,13 +371,6 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
});
|
||||
});
|
||||
|
||||
let credentialPromises = credentialRequests.map(function(request) {
|
||||
return TemplatesService.postWorkflowNodeCredential({
|
||||
id: request.id,
|
||||
data: request.data
|
||||
});
|
||||
});
|
||||
|
||||
let editNodePromises = editRequests.map(function(request) {
|
||||
return TemplatesService.editWorkflowNode({
|
||||
id: request.id,
|
||||
@@ -394,9 +382,16 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
return TemplatesService.deleteWorkflowJobTemplateNode(nodeId);
|
||||
});
|
||||
|
||||
$q.all(disassociatePromises.concat(editNodePromises, deletePromises, credentialPromises))
|
||||
$q.all(disassociatePromises.concat(editNodePromises, deletePromises))
|
||||
.then(function() {
|
||||
|
||||
let credentialPromises = credentialRequests.map(function(request) {
|
||||
return TemplatesService.postWorkflowNodeCredential({
|
||||
id: request.id,
|
||||
data: request.data
|
||||
});
|
||||
});
|
||||
|
||||
let associatePromises = associateRequests.map(function(request) {
|
||||
return TemplatesService.associateWorkflowNode({
|
||||
parentId: request.parentId,
|
||||
@@ -405,7 +400,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
});
|
||||
});
|
||||
|
||||
$q.all(associatePromises)
|
||||
$q.all(associatePromises.concat(credentialPromises))
|
||||
.then(function() {
|
||||
$scope.closeDialog();
|
||||
});
|
||||
@@ -417,8 +412,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
node: child
|
||||
}, completionCallback);
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
let deletePromises = $scope.treeData.data.deletedNodes.map(function(nodeId) {
|
||||
return TemplatesService.deleteWorkflowJobTemplateNode(nodeId);
|
||||
@@ -709,8 +703,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
|
||||
watchForPromptChanges();
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$scope.nodeBeingEdited.promptData = $scope.promptData = {
|
||||
launchConf: launchConf,
|
||||
launchOptions: launchOptions,
|
||||
@@ -741,8 +734,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
$scope.workflowMakerFormConfig.activeTab = "inventory_sync";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if($scope.selectedTemplate.type) {
|
||||
} else if ($scope.selectedTemplate.type) {
|
||||
switch ($scope.selectedTemplate.type) {
|
||||
case "job_template":
|
||||
$scope.workflowMakerFormConfig.activeTab = "jobs";
|
||||
@@ -862,8 +854,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
if ($scope.placeholderNode.isRoot) {
|
||||
updateEdgeDropdownOptions(["always"]);
|
||||
edgeType = {label: "Always", value: "always"};
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// we need to update the possible edges based on any new siblings
|
||||
let siblingConnectionTypes = WorkflowService.getSiblingConnectionTypes({
|
||||
tree: $scope.treeData.data,
|
||||
@@ -889,8 +880,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
|
||||
}
|
||||
$scope.edgeType = edgeType;
|
||||
}
|
||||
else if($scope.nodeBeingEdited) {
|
||||
} else if ($scope.nodeBeingEdited) {
|
||||
let siblingConnectionTypes = WorkflowService.getSiblingConnectionTypes({
|
||||
tree: $scope.treeData.data,
|
||||
parentId: $scope.nodeBeingEdited.parent.id,
|
||||
@@ -1021,8 +1011,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
|
||||
watchForPromptChanges();
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$scope.promptData = {
|
||||
launchConf: responses[1].data,
|
||||
launchOptions: responses[0].data,
|
||||
@@ -1120,8 +1109,7 @@ export default ['$scope', 'WorkflowService', 'GetBasePath', 'TemplatesService',
|
||||
// Get the next page
|
||||
page++;
|
||||
getNodes();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// This is the last page
|
||||
buildTreeFromNodes();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user