@5minds/node-red-contrib-processcube 0.14.0 → 0.15.0-error-handling-in-process-instance-query-and-add-prettier-6b3dae-lz096tqk
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc.json +6 -0
- package/externaltask-error.html +21 -21
- package/externaltask-error.js +9 -10
- package/externaltask-input.html +24 -24
- package/externaltask-input.js +40 -36
- package/externaltask-output.html +15 -15
- package/externaltask-output.js +8 -9
- package/message-event-trigger.html +14 -14
- package/message-event-trigger.js +6 -6
- package/nodered/settings.js +82 -92
- package/package.json +4 -1
- package/process-start.html +19 -23
- package/process-start.js +6 -6
- package/processcube-engine-config.html +10 -10
- package/processcube-engine-config.js +23 -16
- package/processdefinition-query.html +29 -23
- package/processdefinition-query.js +30 -44
- package/processinstance-query.html +19 -20
- package/processinstance-query.js +13 -15
- package/signal-event-trigger.html +14 -14
- package/signal-event-trigger.js +6 -6
- package/usertask-finished-listener.html +17 -12
- package/usertask-finished-listener.js +18 -29
- package/usertask-input.html +40 -27
- package/usertask-input.js +15 -24
- package/usertask-new-listener.html +17 -12
- package/usertask-new-listener.js +18 -26
- package/usertask-output.html +23 -24
- package/usertask-output.js +12 -24
@@ -1,7 +1,7 @@
|
|
1
|
-
const process = require(
|
2
|
-
const EventEmitter = require(
|
1
|
+
const process = require('process');
|
2
|
+
const EventEmitter = require('node:events');
|
3
3
|
|
4
|
-
const engine_client = require(
|
4
|
+
const engine_client = require('@5minds/processcube_engine_client');
|
5
5
|
|
6
6
|
module.exports = function (RED) {
|
7
7
|
function ProcessdefinitionQuery(config) {
|
@@ -13,60 +13,46 @@ module.exports = function (RED) {
|
|
13
13
|
|
14
14
|
const client = this.engine.getEngineClient();
|
15
15
|
|
16
|
-
var eventEmitter = flowContext.get(
|
16
|
+
var eventEmitter = flowContext.get('emitter');
|
17
17
|
|
18
18
|
if (!eventEmitter) {
|
19
|
-
flowContext.set(
|
20
|
-
eventEmitter = flowContext.get(
|
19
|
+
flowContext.set('emitter', new EventEmitter());
|
20
|
+
eventEmitter = flowContext.get('emitter');
|
21
21
|
}
|
22
22
|
|
23
|
-
node.on(
|
23
|
+
node.on('close', async () => {
|
24
24
|
client.dispose();
|
25
25
|
client = null;
|
26
26
|
});
|
27
27
|
|
28
|
-
node.on(
|
29
|
-
let query = RED.util.evaluateNodeProperty(
|
30
|
-
config.query,
|
31
|
-
config.query_type,
|
32
|
-
node,
|
33
|
-
msg
|
34
|
-
);
|
28
|
+
node.on('input', function (msg) {
|
29
|
+
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
35
30
|
query = {
|
36
31
|
...query,
|
37
32
|
identity: node.server.identity,
|
38
33
|
};
|
39
34
|
|
40
|
-
client.processDefinitions
|
41
|
-
.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
models: models,
|
61
|
-
totalCount: models.length,
|
62
|
-
};
|
63
|
-
} else {
|
64
|
-
msg.payload = matchingProcessDefinitions;
|
65
|
-
}
|
66
|
-
|
67
|
-
node.send(msg);
|
68
|
-
});
|
35
|
+
client.processDefinitions.getAll(query).then((matchingProcessDefinitions) => {
|
36
|
+
if (config.models_only && matchingProcessDefinitions.totalCount > 0) {
|
37
|
+
let models = [];
|
38
|
+
|
39
|
+
matchingProcessDefinitions.processDefinitions.forEach((processDefinition) => {
|
40
|
+
processDefinition.processModels.forEach((model) => {
|
41
|
+
models.push(model);
|
42
|
+
});
|
43
|
+
});
|
44
|
+
|
45
|
+
msg.payload = {
|
46
|
+
models: models,
|
47
|
+
totalCount: models.length,
|
48
|
+
};
|
49
|
+
} else {
|
50
|
+
msg.payload = matchingProcessDefinitions;
|
51
|
+
}
|
52
|
+
|
53
|
+
node.send(msg);
|
54
|
+
});
|
69
55
|
});
|
70
56
|
}
|
71
|
-
RED.nodes.registerType(
|
57
|
+
RED.nodes.registerType('processdefinition-query', ProcessdefinitionQuery);
|
72
58
|
};
|
@@ -3,46 +3,45 @@
|
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
query: {value:
|
9
|
-
query_type: {value:
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
query: { value: 'payload' },
|
9
|
+
query_type: { value: 'msg' },
|
10
10
|
},
|
11
11
|
inputs: 1,
|
12
12
|
outputs: 1,
|
13
|
-
icon:
|
14
|
-
label: function() {
|
15
|
-
return this.name ||
|
13
|
+
icon: 'font-awesome/fa-envelope-open',
|
14
|
+
label: function () {
|
15
|
+
return this.name || 'processinstance-query';
|
16
16
|
},
|
17
|
-
oneditprepare: function() {
|
18
|
-
$(
|
17
|
+
oneditprepare: function () {
|
18
|
+
$('#node-input-query').typedInput({
|
19
19
|
default: 'msg',
|
20
|
-
types: ['msg', 'json']
|
20
|
+
types: ['msg', 'json'],
|
21
21
|
});
|
22
22
|
|
23
|
-
$(
|
24
|
-
$(
|
23
|
+
$('#node-input-query').typedInput('value', this.query);
|
24
|
+
$('#node-input-query').typedInput('type', this.query_type);
|
25
|
+
},
|
26
|
+
oneditsave: function () {
|
27
|
+
(this.query = $('#node-input-query').typedInput('value')),
|
28
|
+
(this.query_type = $('#node-input-query').typedInput('type'));
|
25
29
|
},
|
26
|
-
oneditsave: function() {
|
27
|
-
this.query = $("#node-input-query").typedInput('value'),
|
28
|
-
this.query_type = $("#node-input-query").typedInput('type')
|
29
|
-
|
30
|
-
}
|
31
30
|
});
|
32
31
|
</script>
|
33
32
|
|
34
33
|
<script type="text/html" data-template-name="processinstance-query">
|
35
34
|
<div class="form-row">
|
36
35
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
37
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
36
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
38
37
|
</div>
|
39
38
|
<div class="form-row">
|
40
39
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
41
|
-
<input type="text" id="node-input-engine" placeholder="http://engine:8000"
|
40
|
+
<input type="text" id="node-input-engine" placeholder="http://engine:8000" />
|
42
41
|
</div>
|
43
42
|
<div class="form-row">
|
44
43
|
<label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
|
45
|
-
<input type="text" id="node-input-query"
|
44
|
+
<input type="text" id="node-input-query" />
|
46
45
|
</div>
|
47
46
|
</script>
|
48
47
|
|
package/processinstance-query.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
const process = require(
|
2
|
-
const EventEmitter = require(
|
1
|
+
const process = require('process');
|
2
|
+
const EventEmitter = require('node:events');
|
3
3
|
|
4
|
-
const engine_client = require(
|
4
|
+
const engine_client = require('@5minds/processcube_engine_client');
|
5
5
|
|
6
6
|
module.exports = function (RED) {
|
7
7
|
function ProcessinstanceQuery(config) {
|
@@ -13,25 +13,20 @@ module.exports = function (RED) {
|
|
13
13
|
|
14
14
|
const client = this.engine.getEngineClient();
|
15
15
|
|
16
|
-
var eventEmitter = flowContext.get(
|
16
|
+
var eventEmitter = flowContext.get('emitter');
|
17
17
|
|
18
18
|
if (!eventEmitter) {
|
19
|
-
flowContext.set(
|
20
|
-
eventEmitter = flowContext.get(
|
19
|
+
flowContext.set('emitter', new EventEmitter());
|
20
|
+
eventEmitter = flowContext.get('emitter');
|
21
21
|
}
|
22
22
|
|
23
|
-
node.on(
|
23
|
+
node.on('close', async () => {
|
24
24
|
client.dispose();
|
25
25
|
client = null;
|
26
26
|
});
|
27
27
|
|
28
|
-
node.on(
|
29
|
-
let query = RED.util.evaluateNodeProperty(
|
30
|
-
config.query,
|
31
|
-
config.query_type,
|
32
|
-
node,
|
33
|
-
msg
|
34
|
-
);
|
28
|
+
node.on('input', function (msg) {
|
29
|
+
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
35
30
|
|
36
31
|
client.processInstances
|
37
32
|
.query(query, { identity: node.server.identity })
|
@@ -39,8 +34,11 @@ module.exports = function (RED) {
|
|
39
34
|
msg.payload = matchingInstances;
|
40
35
|
|
41
36
|
node.send(msg);
|
37
|
+
})
|
38
|
+
.catch((error) => {
|
39
|
+
node.error(`Processinstancequery failed: ${error.message}`);
|
42
40
|
});
|
43
41
|
});
|
44
42
|
}
|
45
|
-
RED.nodes.registerType(
|
43
|
+
RED.nodes.registerType('processinstance-query', ProcessinstanceQuery);
|
46
44
|
};
|
@@ -1,41 +1,41 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('signal-event-trigger',{
|
2
|
+
RED.nodes.registerType('signal-event-trigger', {
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
signalname: {value:
|
9
|
-
processInstanceId: {value:
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
signalname: { value: '', required: true },
|
9
|
+
processInstanceId: { value: '' },
|
10
10
|
},
|
11
11
|
inputs: 1,
|
12
12
|
outputs: 1,
|
13
|
-
icon:
|
14
|
-
label: function() {
|
15
|
-
return this.name||
|
16
|
-
}
|
13
|
+
icon: 'font-awesome/fa-envelope-open',
|
14
|
+
label: function () {
|
15
|
+
return this.name || 'signal-event-trigger';
|
16
|
+
},
|
17
17
|
});
|
18
18
|
</script>
|
19
19
|
|
20
20
|
<script type="text/html" data-template-name="signal-event-trigger">
|
21
21
|
<div class="form-row">
|
22
22
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
23
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
23
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
24
24
|
</div>
|
25
25
|
<div class="form-row">
|
26
26
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine</label>
|
27
|
-
<input type="text" id="node-input-engine" placeholder="Engine"
|
27
|
+
<input type="text" id="node-input-engine" placeholder="Engine" />
|
28
28
|
</div>
|
29
29
|
<div class="form-row">
|
30
30
|
<label for="node-input-signalname"><i class="fa fa-tag"></i> Signal Name</label>
|
31
|
-
<input type="text" id="node-input-signalname" placeholder="Name of the Signal"
|
31
|
+
<input type="text" id="node-input-signalname" placeholder="Name of the Signal" />
|
32
32
|
</div>
|
33
33
|
<div class="form-row">
|
34
34
|
<label for="node-input-processinstanceid"><i class="fa fa-tag"></i> Process Instance Id</label>
|
35
|
-
<input type="text" id="node-input-processinstanceid" placeholder="Id of the recipient process instance"
|
35
|
+
<input type="text" id="node-input-processinstanceid" placeholder="Id of the recipient process instance" />
|
36
36
|
</div>
|
37
37
|
</script>
|
38
38
|
|
39
39
|
<script type="text/html" data-help-name="signal-event-trigger">
|
40
40
|
<p>A node which emmits a signal event to the Engine.</p>
|
41
|
-
</script>
|
41
|
+
</script>
|
package/signal-event-trigger.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
const process = require(
|
1
|
+
const process = require('process');
|
2
2
|
|
3
|
-
const engine_client = require(
|
3
|
+
const engine_client = require('@5minds/processcube_engine_client');
|
4
4
|
|
5
5
|
module.exports = function (RED) {
|
6
6
|
function SignalEventTrigger(config) {
|
@@ -11,7 +11,7 @@ module.exports = function (RED) {
|
|
11
11
|
|
12
12
|
const client = this.engine.getEngineClient();
|
13
13
|
|
14
|
-
node.on(
|
14
|
+
node.on('input', function (msg) {
|
15
15
|
client.events
|
16
16
|
.triggerSignalEvent(config.signalname, {
|
17
17
|
processInstanceId: config.processinstanceid,
|
@@ -23,8 +23,8 @@ module.exports = function (RED) {
|
|
23
23
|
|
24
24
|
node.send(msg);
|
25
25
|
node.status({
|
26
|
-
fill:
|
27
|
-
shape:
|
26
|
+
fill: 'blue',
|
27
|
+
shape: 'dot',
|
28
28
|
text: `signal event triggered`,
|
29
29
|
});
|
30
30
|
})
|
@@ -33,5 +33,5 @@ module.exports = function (RED) {
|
|
33
33
|
});
|
34
34
|
});
|
35
35
|
}
|
36
|
-
RED.nodes.registerType(
|
36
|
+
RED.nodes.registerType('signal-event-trigger', SignalEventTrigger);
|
37
37
|
};
|
@@ -1,34 +1,39 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('usertask-finished-listener',{
|
2
|
+
RED.nodes.registerType('usertask-finished-listener', {
|
3
3
|
category: 'ProcessCube Events',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
multisend: {value: false}
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
multisend: { value: false },
|
9
9
|
},
|
10
10
|
inputs: 0,
|
11
11
|
outputs: 1,
|
12
|
-
icon:
|
13
|
-
label: function() {
|
14
|
-
return this.name ||
|
15
|
-
}
|
12
|
+
icon: 'font-awesome/fa-envelope',
|
13
|
+
label: function () {
|
14
|
+
return this.name || 'usertask-finished-listener';
|
15
|
+
},
|
16
16
|
});
|
17
17
|
</script>
|
18
18
|
|
19
19
|
<script type="text/html" data-template-name="usertask-finished-listener">
|
20
20
|
<div class="form-row">
|
21
21
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
22
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
22
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
23
23
|
</div>
|
24
24
|
<div class="form-row">
|
25
25
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
26
|
-
<input type="text" id="node-input-engine" placeholder="http://engine:8000"
|
26
|
+
<input type="text" id="node-input-engine" placeholder="http://engine:8000" />
|
27
27
|
</div>
|
28
28
|
<div class="form-row" style="display:flex; margin-bottom: 3px;">
|
29
29
|
<label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
|
30
30
|
<div>
|
31
|
-
<input
|
31
|
+
<input
|
32
|
+
type="checkbox"
|
33
|
+
checked
|
34
|
+
id="node-input-multisend"
|
35
|
+
style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
|
36
|
+
/>
|
32
37
|
<label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
|
33
38
|
</div>
|
34
39
|
</div>
|
@@ -36,4 +41,4 @@
|
|
36
41
|
|
37
42
|
<script type="text/html" data-help-name="usertask-finished-listener">
|
38
43
|
<p>A node which subscribes to an User Task of https://processcube.io</p>
|
39
|
-
</script>
|
44
|
+
</script>
|
@@ -1,7 +1,7 @@
|
|
1
|
-
const process = require(
|
2
|
-
const EventEmitter = require(
|
1
|
+
const process = require('process');
|
2
|
+
const EventEmitter = require('node:events');
|
3
3
|
|
4
|
-
const engine_client = require(
|
4
|
+
const engine_client = require('@5minds/processcube_engine_client');
|
5
5
|
|
6
6
|
module.exports = function (RED) {
|
7
7
|
function UserTaskFinishedListener(config) {
|
@@ -13,11 +13,11 @@ module.exports = function (RED) {
|
|
13
13
|
|
14
14
|
const client = this.engine.getEngineClient();
|
15
15
|
|
16
|
-
var eventEmitter = flowContext.get(
|
16
|
+
var eventEmitter = flowContext.get('emitter');
|
17
17
|
|
18
18
|
if (!eventEmitter) {
|
19
|
-
flowContext.set(
|
20
|
-
eventEmitter = flowContext.get(
|
19
|
+
flowContext.set('emitter', new EventEmitter());
|
20
|
+
eventEmitter = flowContext.get('emitter');
|
21
21
|
}
|
22
22
|
|
23
23
|
const register = async () => {
|
@@ -26,43 +26,35 @@ module.exports = function (RED) {
|
|
26
26
|
(userTaskFinishedNotification) => {
|
27
27
|
node.send({
|
28
28
|
payload: {
|
29
|
-
flowNodeInstanceId:
|
30
|
-
|
31
|
-
|
32
|
-
type: "usertask",
|
29
|
+
flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId,
|
30
|
+
action: 'finished',
|
31
|
+
type: 'usertask',
|
33
32
|
},
|
34
33
|
});
|
35
34
|
},
|
36
|
-
{ identity: currentIdentity }
|
35
|
+
{ identity: currentIdentity },
|
37
36
|
);
|
38
37
|
|
39
38
|
node.server.registerOnIdentityChanged(async (identity) => {
|
40
|
-
client.userTasks.removeSubscription(
|
41
|
-
subscription,
|
42
|
-
currentIdentity
|
43
|
-
);
|
39
|
+
client.userTasks.removeSubscription(subscription, currentIdentity);
|
44
40
|
currentIdentity = identity;
|
45
41
|
|
46
42
|
subscription = await client.userTasks.onUserTaskFinished(
|
47
43
|
(userTaskFinishedNotification) => {
|
48
44
|
node.send({
|
49
45
|
payload: {
|
50
|
-
flowNodeInstanceId:
|
51
|
-
|
52
|
-
|
53
|
-
type: "usertask",
|
46
|
+
flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId,
|
47
|
+
action: 'finished',
|
48
|
+
type: 'usertask',
|
54
49
|
},
|
55
50
|
});
|
56
51
|
},
|
57
|
-
{ identity: currentIdentity }
|
52
|
+
{ identity: currentIdentity },
|
58
53
|
);
|
59
54
|
});
|
60
55
|
|
61
|
-
node.on(
|
62
|
-
client.userTasks.removeSubscription(
|
63
|
-
subscription,
|
64
|
-
currentIdentity
|
65
|
-
);
|
56
|
+
node.on('close', async () => {
|
57
|
+
client.userTasks.removeSubscription(subscription, currentIdentity);
|
66
58
|
client.dispose();
|
67
59
|
client = null;
|
68
60
|
});
|
@@ -72,8 +64,5 @@ module.exports = function (RED) {
|
|
72
64
|
register();
|
73
65
|
}
|
74
66
|
}
|
75
|
-
RED.nodes.registerType(
|
76
|
-
"usertask-finished-listener",
|
77
|
-
UserTaskFinishedListener
|
78
|
-
);
|
67
|
+
RED.nodes.registerType('usertask-finished-listener', UserTaskFinishedListener);
|
79
68
|
};
|
package/usertask-input.html
CHANGED
@@ -1,62 +1,75 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('usertask-input',{
|
2
|
+
RED.nodes.registerType('usertask-input', {
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
query: {value:
|
9
|
-
query_type: {value:
|
10
|
-
force_send_array: {value: false},
|
11
|
-
multisend: {value: false}
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
query: { value: 'payload' },
|
9
|
+
query_type: { value: 'msg' },
|
10
|
+
force_send_array: { value: false },
|
11
|
+
multisend: { value: false },
|
12
12
|
},
|
13
13
|
inputs: 1,
|
14
14
|
outputs: 1,
|
15
|
-
icon:
|
16
|
-
label: function() {
|
17
|
-
return this.name ||
|
15
|
+
icon: 'font-awesome/fa-envelope-open',
|
16
|
+
label: function () {
|
17
|
+
return this.name || 'usertask-input';
|
18
18
|
},
|
19
|
-
oneditprepare: function() {
|
20
|
-
$(
|
19
|
+
oneditprepare: function () {
|
20
|
+
$('#node-input-query').typedInput({
|
21
21
|
default: 'msg',
|
22
|
-
types: ['msg', 'json']
|
22
|
+
types: ['msg', 'json'],
|
23
23
|
});
|
24
24
|
|
25
|
-
$(
|
26
|
-
$(
|
25
|
+
$('#node-input-query').typedInput('value', this.query);
|
26
|
+
$('#node-input-query').typedInput('type', this.query_type);
|
27
|
+
},
|
28
|
+
oneditsave: function () {
|
29
|
+
(this.query = $('#node-input-query').typedInput('value')),
|
30
|
+
(this.query_type = $('#node-input-query').typedInput('type'));
|
27
31
|
},
|
28
|
-
oneditsave: function() {
|
29
|
-
this.query = $("#node-input-query").typedInput('value'),
|
30
|
-
this.query_type = $("#node-input-query").typedInput('type')
|
31
|
-
|
32
|
-
}
|
33
32
|
});
|
34
33
|
</script>
|
35
34
|
|
36
35
|
<script type="text/html" data-template-name="usertask-input">
|
37
36
|
<div class="form-row">
|
38
37
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
39
|
-
<input type="text" id="node-input-name" placeholder="Name"
|
38
|
+
<input type="text" id="node-input-name" placeholder="Name" />
|
40
39
|
</div>
|
41
40
|
<div class="form-row">
|
42
41
|
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
|
43
|
-
<input type="text" id="node-input-engine" placeholder="http://engine:8000"
|
42
|
+
<input type="text" id="node-input-engine" placeholder="http://engine:8000" />
|
44
43
|
</div>
|
45
44
|
<div class="form-row">
|
46
45
|
<label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
|
47
|
-
<input type="text" id="node-input-query"
|
46
|
+
<input type="text" id="node-input-query" />
|
48
47
|
</div>
|
49
48
|
<div class="form-row" style="display:flex; margin-bottom: 3px;">
|
50
|
-
<label for="node-input-force_send_array" style="vertical-align:top"
|
49
|
+
<label for="node-input-force_send_array" style="vertical-align:top"
|
50
|
+
><i class="fa fa-list-alt"></i> Force send payload as array</label
|
51
|
+
>
|
51
52
|
<div>
|
52
|
-
<input
|
53
|
-
|
53
|
+
<input
|
54
|
+
type="checkbox"
|
55
|
+
checked
|
56
|
+
id="node-input-force_send_array"
|
57
|
+
style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
|
58
|
+
/>
|
59
|
+
<label style="width:auto" for="node-input-force_send_array"
|
60
|
+
>Alway send an array? Only works if <i>Send multi</i> is false.</label
|
61
|
+
>
|
54
62
|
</div>
|
55
63
|
</div>
|
56
64
|
<div class="form-row" style="display:flex; margin-bottom: 3px;">
|
57
65
|
<label for="node-input-multisend" style="vertical-align:top"><i class="fa fa-list-alt"></i> Send multi</label>
|
58
66
|
<div>
|
59
|
-
<input
|
67
|
+
<input
|
68
|
+
type="checkbox"
|
69
|
+
checked
|
70
|
+
id="node-input-multisend"
|
71
|
+
style="display: inline-block; width: auto; margin: 0px 0px 0px 4px;"
|
72
|
+
/>
|
60
73
|
<label style="width:auto" for="node-input-multisend">Send one output of each usertask input?</label>
|
61
74
|
</div>
|
62
75
|
</div>
|
package/usertask-input.js
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
const process = require(
|
2
|
-
const EventEmitter = require(
|
1
|
+
const process = require('process');
|
2
|
+
const EventEmitter = require('node:events');
|
3
3
|
|
4
|
-
const engine_client = require(
|
4
|
+
const engine_client = require('@5minds/processcube_engine_client');
|
5
5
|
|
6
6
|
function showStatus(node, msgCounter) {
|
7
7
|
if (msgCounter >= 1) {
|
8
8
|
node.status({
|
9
|
-
fill:
|
10
|
-
shape:
|
9
|
+
fill: 'blue',
|
10
|
+
shape: 'dot',
|
11
11
|
text: `handling tasks ${msgCounter}`,
|
12
12
|
});
|
13
13
|
} else {
|
14
14
|
node.status({
|
15
|
-
fill:
|
16
|
-
shape:
|
15
|
+
fill: 'blue',
|
16
|
+
shape: 'ring',
|
17
17
|
text: `subcribed ${msgCounter}`,
|
18
18
|
});
|
19
19
|
}
|
@@ -30,25 +30,20 @@ module.exports = function (RED) {
|
|
30
30
|
|
31
31
|
const client = this.engine.getEngineClient();
|
32
32
|
|
33
|
-
var eventEmitter = flowContext.get(
|
33
|
+
var eventEmitter = flowContext.get('emitter');
|
34
34
|
|
35
35
|
if (!eventEmitter) {
|
36
|
-
flowContext.set(
|
37
|
-
eventEmitter = flowContext.get(
|
36
|
+
flowContext.set('emitter', new EventEmitter());
|
37
|
+
eventEmitter = flowContext.get('emitter');
|
38
38
|
}
|
39
39
|
|
40
|
-
node.on(
|
40
|
+
node.on('close', async () => {
|
41
41
|
client.dispose();
|
42
42
|
client = null;
|
43
43
|
});
|
44
44
|
|
45
|
-
node.on(
|
46
|
-
let query = RED.util.evaluateNodeProperty(
|
47
|
-
config.query,
|
48
|
-
config.query_type,
|
49
|
-
node,
|
50
|
-
msg
|
51
|
-
);
|
45
|
+
node.on('input', function (msg) {
|
46
|
+
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
52
47
|
query = {
|
53
48
|
...query,
|
54
49
|
identity: node.server.identity,
|
@@ -66,11 +61,7 @@ module.exports = function (RED) {
|
|
66
61
|
node.send(msg);
|
67
62
|
} else {
|
68
63
|
if (!config.force_send_array) {
|
69
|
-
if (
|
70
|
-
config.multisend &&
|
71
|
-
matchingFlowNodes.userTasks &&
|
72
|
-
matchingFlowNodes.userTasks.length > 1
|
73
|
-
) {
|
64
|
+
if (config.multisend && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length > 1) {
|
74
65
|
matchingFlowNodes.userTasks.forEach((userTask) => {
|
75
66
|
msg.payload = { userTask: userTask };
|
76
67
|
node.send(msg);
|
@@ -91,5 +82,5 @@ module.exports = function (RED) {
|
|
91
82
|
});
|
92
83
|
});
|
93
84
|
}
|
94
|
-
RED.nodes.registerType(
|
85
|
+
RED.nodes.registerType('usertask-input', UserTaskInput);
|
95
86
|
};
|