Add new endpoint for creation of approval nodes

This commit is contained in:
beeankha
2019-07-18 09:33:16 -04:00
committed by Ryan Petrello
parent 83f9681941
commit 320284267c
20 changed files with 148 additions and 76 deletions

View File

@@ -26,7 +26,7 @@ function AtApprovalsDrawerController (strings, Rest, GetBasePath, $rootScope) {
const loadTheList = () => {
const queryParams = Object.keys(vm.queryset).map(key => `${key}=${vm.queryset[key]}`).join('&');
Rest.setUrl(`${GetBasePath('workflow_approval')}?${queryParams}`);
Rest.setUrl(`${GetBasePath('workflow_approvals')}?${queryParams}`);
return Rest.get()
.then(({ data }) => {
vm.dataset = data;
@@ -40,13 +40,13 @@ function AtApprovalsDrawerController (strings, Rest, GetBasePath, $rootScope) {
.then(() => { vm.listLoaded = true; });
vm.approve = (approval) => {
Rest.setUrl(`${GetBasePath('workflow_approval')}${approval.id}/approve`);
Rest.setUrl(`${GetBasePath('workflow_approvals')}${approval.id}/approve`);
Rest.post()
.then(() => loadTheList());
};
vm.deny = (approval) => {
Rest.setUrl(`${GetBasePath('workflow_approval')}${approval.id}/deny`);
Rest.setUrl(`${GetBasePath('workflow_approvals')}${approval.id}/deny`);
Rest.post()
.then(() => loadTheList());
};

View File

@@ -388,7 +388,7 @@ angular
});
});
Rest.setUrl(`${GetBasePath('workflow_approval')}?status=pending&page_size=1`);
Rest.setUrl(`${GetBasePath('workflow_approvals')}?status=pending&page_size=1`);
Rest.get()
.then(({data}) => {
$rootScope.pendingApprovalCount = data.count;

View File

@@ -140,7 +140,7 @@ export default ['$log', '$cookies', '$rootScope',
});
});
Rest.setUrl(`${GetBasePath('workflow_approval')}?status=pending&page_size=1`);
Rest.setUrl(`${GetBasePath('workflow_approvals')}?status=pending&page_size=1`);
Rest.get()
.then(({data}) => {
$rootScope.pendingApprovalCount = data.count;

View File

@@ -127,7 +127,7 @@ export default ['$scope', 'TemplatesService',
if (_.has(node, 'fullUnifiedJobTemplateObject') &&
(node.fullUnifiedJobTemplateObject.type === "workflow_job_template" ||
node.fullUnifiedJobTemplateObject.type === "job_template") &&
node.fullUnifiedJobTemplateObject.type === "job_template") &&
node.promptData
) {
sendableNodeData = PromptService.bundlePromptDataForSaving({
@@ -188,7 +188,7 @@ export default ['$scope', 'TemplatesService',
return credFromPrompt.id === defaultCred.id;
});
});
credentialIdsToPost.forEach((credentialToPost) => {
credentialRequests.push({
id: data.id,
@@ -309,7 +309,7 @@ export default ['$scope', 'TemplatesService',
let disassociatePromises = [];
let associatePromises = [];
let linkMap = {};
// Build a link map for easy access
$scope.graphState.arrayOfLinksForChart.forEach(link => {
// link.source.id of 1 is our artificial start node
@@ -319,11 +319,11 @@ export default ['$scope', 'TemplatesService',
if (!linkMap[sourceNodeId]) {
linkMap[sourceNodeId] = {};
}
linkMap[sourceNodeId][targetNodeId] = link.edgeType;
}
});
Object.keys(nodeRef).map((workflowNodeId) => {
let nodeId = nodeRef[workflowNodeId].originalNodeObject.id;
if (nodeRef[workflowNodeId].originalNodeObject.success_nodes) {
@@ -381,7 +381,7 @@ export default ['$scope', 'TemplatesService',
});
}
});
Object.keys(linkMap).map((sourceNodeId) => {
Object.keys(linkMap[sourceNodeId]).map((targetNodeId) => {
const sourceChartNodeId = nodeIdToChartNodeIdMapping[sourceNodeId];
@@ -432,7 +432,7 @@ export default ['$scope', 'TemplatesService',
}
});
});
$q.all(disassociatePromises)
.then(() => {
let credentialPromises = credentialRequests.map((request) => {
@@ -441,7 +441,7 @@ export default ['$scope', 'TemplatesService',
data: request.data
});
});
return $q.all(associatePromises.concat(credentialPromises))
.then(() => {
Wait('stop');