Files
baserow/web-frontend/modules/automation/services/automationWorkflowNode.js
Tsering Paljor c95046c2f9 feat: Add Automation recipes for For and While loops (#6338)
* Add recipies for For and While loops

* Add tests

* Add changelog

* Fix the clean-up when rolling back
2026-10-16 08:57:23 +04:00

39 lines
1.1 KiB
JavaScript

export default (client) => {
return {
create(workflowId, type, referenceNode, position, output, config = {}) {
const payload = { type }
if (referenceNode) {
payload.reference_node_id = referenceNode.id
payload.position = position
payload.output = output
}
return client.post(
`automation/workflow/${workflowId}/nodes/`,
payload,
config
)
},
get(workflowId) {
return client.get(`automation/workflow/${workflowId}/nodes/`)
},
update(nodeId, values, config = {}) {
return client.patch(`automation/node/${nodeId}/`, values, config)
},
delete(nodeId, config = {}) {
return client.delete(`automation/node/${nodeId}/`, config)
},
move(nodeId, values) {
return client.post(`automation/node/${nodeId}/move/`, values)
},
replace(nodeId, values) {
return client.post(`automation/node/${nodeId}/replace/`, values)
},
simulateDispatch(nodeId) {
return client.post(`automation/node/${nodeId}/simulate-dispatch/`)
},
duplicate(nodeId) {
return client.post(`automation/node/${nodeId}/duplicate/`)
},
}
}