Skip to content

Commit

Permalink
Fix handling of user tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
moellenbeck committed Jun 16, 2024
1 parent 6c9546c commit 3e7fb8d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions nodered/.node-red-contrib-processcube-flows.json.backup
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
{
"id": "d042a4c68f51d6ab",
"type": "processcube-engine-config",
"url": "http://engine:8000"
"url": "http://localhost:56000"
},
{
"id": "8e2205abbb41495b",
Expand Down Expand Up @@ -1804,7 +1804,7 @@
"g": "ec36901abb138306",
"name": "",
"engine": "d042a4c68f51d6ab",
"multisend": true,
"multisend": false,
"x": 600,
"y": 660,
"wires": [
Expand Down
5 changes: 3 additions & 2 deletions nodered/node-red-contrib-processcube-flows.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
{
"id": "d042a4c68f51d6ab",
"type": "processcube-engine-config",
"url": "http://engine:8000"
"url": "http://localhost:56000"
},
{
"id": "8e2205abbb41495b",
Expand Down Expand Up @@ -1809,7 +1809,8 @@
"y": 660,
"wires": [
[
"da518322186bd83b"
"da518322186bd83b",
"8e2a2f993ee7156a"
]
]
},
Expand Down
19 changes: 8 additions & 11 deletions usertask-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,24 @@ module.exports = function(RED) {
console.log(`UserTaskInput received message: ${JSON.stringify(msg.payload)}`);

let query = msg.payload;
query = {"flowNodeInstanceId":"1f7225f4-f3c0-4865-91ad-8c6c71d23c22"};

console.log(`UserTaskInput query: ${JSON.stringify(query)}`);

client.userTasks.query({
"flowNodeInstanceId" : "1f7225f4-f3c0-4865-91ad-8c6c71d23c22"
}).then((matchingFlowNodes) => {
client.userTasks.query(query).then((matchingFlowNodes) => {

console.log(`UserTaskInput query result: ${JSON.stringify(matchingFlowNodes)}`);

if (matchingFlowNodes && matchingFlowNodes.flowNodeInstances && matchingFlowNodes.flowNodeInstances.length == 1) {
userTask = matchingFlowNodes.flowNodeInstances[0];
if (matchingFlowNodes && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length == 1) {
userTask = matchingFlowNodes.userTasks[0];

node.send({ payload: {userTask: userTask } });
} else {
if (config.multisend) {
//matchingFlowNodes.forEach((userTask) => {
// node.send({ payload: { userTask: userTask } });
//});
if (config.multisend && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length > 1) {
matchingFlowNodes.userTasks.forEach((userTask) => {
node.send({ payload: { userTask: userTask } });
});
} else {
node.send({ payload: { userTasks: matchingFlowNodes } });
node.send({ payload: { userTasks: matchingFlowNodes.userTasks } });
}
}
});
Expand Down

0 comments on commit 3e7fb8d

Please sign in to comment.