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