@5minds/node-red-contrib-processcube 0.14.0-fix-error-in-process-instance-query-433395-lyzh0xul → 0.14.0-fix-error-in-process-instance-query-9aeac9-lyzi0gix
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 +10 -10
- package/externaltask-error.js +12 -13
- package/externaltask-input.html +12 -12
- package/externaltask-input.js +21 -20
- package/externaltask-output.html +8 -8
- package/externaltask-output.js +8 -9
- package/message-event-trigger.html +14 -14
- package/message-event-trigger.js +21 -25
- package/nodered/settings.js +82 -92
- package/package.json +8 -2
- package/process-start.html +19 -23
- package/process-start.js +18 -18
- package/processcube-engine-config.html +10 -10
- package/processcube-engine-config.js +24 -17
- package/processdefinition-query.html +29 -23
- package/processdefinition-query.js +12 -16
- package/processinstance-query.html +19 -20
- package/processinstance-query.js +14 -23
- package/signal-event-trigger.html +14 -14
- package/signal-event-trigger.js +21 -25
- package/usertask-finished-listener.html +17 -12
- package/usertask-finished-listener.js +34 -16
- package/usertask-input.html +40 -27
- package/usertask-input.js +19 -18
- package/usertask-new-listener.html +17 -12
- package/usertask-new-listener.js +35 -18
- package/usertask-output.html +23 -24
- package/usertask-output.js +12 -12
@@ -3,9 +3,9 @@ const EventEmitter = require('node:events');
|
|
3
3
|
|
4
4
|
const engine_client = require('@5minds/processcube_engine_client');
|
5
5
|
|
6
|
-
module.exports = function(RED) {
|
6
|
+
module.exports = function (RED) {
|
7
7
|
function ProcessdefinitionQuery(config) {
|
8
|
-
RED.nodes.createNode(this,config);
|
8
|
+
RED.nodes.createNode(this, config);
|
9
9
|
var node = this;
|
10
10
|
var flowContext = node.context().flow;
|
11
11
|
var nodeContext = node.context();
|
@@ -28,43 +28,39 @@ module.exports = function(RED) {
|
|
28
28
|
eventEmitter = flowContext.get('emitter');
|
29
29
|
}
|
30
30
|
|
31
|
-
node.on(
|
31
|
+
node.on('close', async () => {
|
32
32
|
client.dispose();
|
33
33
|
client = null;
|
34
34
|
});
|
35
35
|
|
36
|
-
node.on('input', function(msg) {
|
37
|
-
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg)
|
36
|
+
node.on('input', function (msg) {
|
37
|
+
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
38
38
|
query = {
|
39
39
|
...query,
|
40
|
-
identity: node.server.identity
|
40
|
+
identity: node.server.identity,
|
41
41
|
};
|
42
|
-
|
43
|
-
client.processDefinitions.getAll(query).then((matchingProcessDefinitions) => {
|
44
42
|
|
45
|
-
|
43
|
+
client.processDefinitions.getAll(query).then((matchingProcessDefinitions) => {
|
46
44
|
if (config.models_only && matchingProcessDefinitions.totalCount > 0) {
|
47
45
|
let models = [];
|
48
46
|
|
49
|
-
matchingProcessDefinitions.processDefinitions.forEach(processDefinition => {
|
50
|
-
processDefinition.processModels.forEach(model => {
|
47
|
+
matchingProcessDefinitions.processDefinitions.forEach((processDefinition) => {
|
48
|
+
processDefinition.processModels.forEach((model) => {
|
51
49
|
models.push(model);
|
52
50
|
});
|
53
51
|
});
|
54
52
|
|
55
53
|
msg.payload = {
|
56
54
|
models: models,
|
57
|
-
totalCount: models.length
|
55
|
+
totalCount: models.length,
|
58
56
|
};
|
59
|
-
|
60
57
|
} else {
|
61
58
|
msg.payload = matchingProcessDefinitions;
|
62
59
|
}
|
63
60
|
|
64
|
-
|
65
61
|
node.send(msg);
|
66
62
|
});
|
67
63
|
});
|
68
64
|
}
|
69
|
-
RED.nodes.registerType(
|
70
|
-
}
|
65
|
+
RED.nodes.registerType('processdefinition-query', ProcessdefinitionQuery);
|
66
|
+
};
|
@@ -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) {
|
@@ -12,38 +12,29 @@ module.exports = function (RED) {
|
|
12
12
|
|
13
13
|
this.engine = this.server = RED.nodes.getNode(config.engine);
|
14
14
|
|
15
|
-
const engineUrl =
|
16
|
-
this.engine?.url || process.env.ENGINE_URL || "http://engine:8000";
|
15
|
+
const engineUrl = this.engine?.url || process.env.ENGINE_URL || 'http://engine:8000';
|
17
16
|
|
18
|
-
var client = nodeContext.get(
|
17
|
+
var client = nodeContext.get('client');
|
19
18
|
|
20
19
|
if (!client) {
|
21
|
-
nodeContext.set(
|
22
|
-
|
23
|
-
new engine_client.EngineClient(engineUrl)
|
24
|
-
);
|
25
|
-
client = nodeContext.get("client");
|
20
|
+
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
21
|
+
client = nodeContext.get('client');
|
26
22
|
}
|
27
23
|
|
28
|
-
var eventEmitter = flowContext.get(
|
24
|
+
var eventEmitter = flowContext.get('emitter');
|
29
25
|
|
30
26
|
if (!eventEmitter) {
|
31
|
-
flowContext.set(
|
32
|
-
eventEmitter = flowContext.get(
|
27
|
+
flowContext.set('emitter', new EventEmitter());
|
28
|
+
eventEmitter = flowContext.get('emitter');
|
33
29
|
}
|
34
30
|
|
35
|
-
node.on(
|
31
|
+
node.on('close', async () => {
|
36
32
|
client.dispose();
|
37
33
|
client = null;
|
38
34
|
});
|
39
35
|
|
40
|
-
node.on(
|
41
|
-
let query = RED.util.evaluateNodeProperty(
|
42
|
-
config.query,
|
43
|
-
config.query_type,
|
44
|
-
node,
|
45
|
-
msg
|
46
|
-
);
|
36
|
+
node.on('input', function (msg) {
|
37
|
+
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
47
38
|
|
48
39
|
client.processInstances
|
49
40
|
.query(query, { identity: node.server.identity })
|
@@ -58,5 +49,5 @@ module.exports = function (RED) {
|
|
58
49
|
});
|
59
50
|
});
|
60
51
|
}
|
61
|
-
RED.nodes.registerType(
|
52
|
+
RED.nodes.registerType('processinstance-query', ProcessinstanceQuery);
|
62
53
|
};
|
@@ -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
@@ -2,7 +2,7 @@ const process = require('process');
|
|
2
2
|
|
3
3
|
const engine_client = require('@5minds/processcube_engine_client');
|
4
4
|
|
5
|
-
module.exports = function(RED) {
|
5
|
+
module.exports = function (RED) {
|
6
6
|
function SignalEventTrigger(config) {
|
7
7
|
RED.nodes.createNode(this, config);
|
8
8
|
var node = this;
|
@@ -17,29 +17,25 @@ module.exports = function(RED) {
|
|
17
17
|
if (!client) {
|
18
18
|
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
19
19
|
client = nodeContext.get('client');
|
20
|
-
}
|
21
|
-
|
22
|
-
node.on('input', function(msg) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
}).catch((error) => {
|
40
|
-
node.error(error);
|
41
|
-
});
|
20
|
+
}
|
21
|
+
|
22
|
+
node.on('input', function (msg) {
|
23
|
+
client.events
|
24
|
+
.triggerSignalEvent(config.signalname, {
|
25
|
+
processInstanceId: config.processinstanceid,
|
26
|
+
payload: msg.payload,
|
27
|
+
identity: node.server.identity,
|
28
|
+
})
|
29
|
+
.then((result) => {
|
30
|
+
msg.payload = result;
|
31
|
+
|
32
|
+
node.send(msg);
|
33
|
+
node.status({ fill: 'blue', shape: 'dot', text: `signal event triggered` });
|
34
|
+
})
|
35
|
+
.catch((error) => {
|
36
|
+
node.error(error);
|
37
|
+
});
|
42
38
|
});
|
43
39
|
}
|
44
|
-
RED.nodes.registerType(
|
45
|
-
}
|
40
|
+
RED.nodes.registerType('signal-event-trigger', SignalEventTrigger);
|
41
|
+
};
|
@@ -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>
|
@@ -3,7 +3,7 @@ const EventEmitter = require('node:events');
|
|
3
3
|
|
4
4
|
const engine_client = require('@5minds/processcube_engine_client');
|
5
5
|
|
6
|
-
module.exports = function(RED) {
|
6
|
+
module.exports = function (RED) {
|
7
7
|
function UserTaskFinishedListener(config) {
|
8
8
|
RED.nodes.createNode(this, config);
|
9
9
|
var node = this;
|
@@ -19,7 +19,7 @@ module.exports = function(RED) {
|
|
19
19
|
if (!client) {
|
20
20
|
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
21
21
|
client = nodeContext.get('client');
|
22
|
-
}
|
22
|
+
}
|
23
23
|
|
24
24
|
var eventEmitter = flowContext.get('emitter');
|
25
25
|
|
@@ -30,29 +30,47 @@ module.exports = function(RED) {
|
|
30
30
|
|
31
31
|
const register = async () => {
|
32
32
|
let currentIdentity = node.server.identity;
|
33
|
-
let subscription = await client.userTasks.onUserTaskFinished(
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
let subscription = await client.userTasks.onUserTaskFinished(
|
34
|
+
(userTaskFinishedNotification) => {
|
35
|
+
node.send({
|
36
|
+
payload: {
|
37
|
+
flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId,
|
38
|
+
action: 'finished',
|
39
|
+
type: 'usertask',
|
40
|
+
},
|
41
|
+
});
|
42
|
+
},
|
43
|
+
{ identity: currentIdentity },
|
44
|
+
);
|
45
|
+
|
46
|
+
node.server.registerOnIdentityChanged(async (identity) => {
|
38
47
|
client.userTasks.removeSubscription(subscription, currentIdentity);
|
39
48
|
currentIdentity = identity;
|
40
|
-
|
41
|
-
subscription = await client.userTasks.onUserTaskFinished(
|
42
|
-
|
43
|
-
|
49
|
+
|
50
|
+
subscription = await client.userTasks.onUserTaskFinished(
|
51
|
+
(userTaskFinishedNotification) => {
|
52
|
+
node.send({
|
53
|
+
payload: {
|
54
|
+
flowNodeInstanceId: userTaskFinishedNotification.flowNodeInstanceId,
|
55
|
+
action: 'finished',
|
56
|
+
type: 'usertask',
|
57
|
+
},
|
58
|
+
});
|
59
|
+
},
|
60
|
+
{ identity: currentIdentity },
|
61
|
+
);
|
44
62
|
});
|
45
|
-
|
46
|
-
node.on(
|
63
|
+
|
64
|
+
node.on('close', async () => {
|
47
65
|
client.userTasks.removeSubscription(subscription, currentIdentity);
|
48
66
|
client.dispose();
|
49
67
|
client = null;
|
50
68
|
});
|
51
|
-
}
|
69
|
+
};
|
52
70
|
|
53
71
|
if (node.server) {
|
54
72
|
register();
|
55
73
|
}
|
56
74
|
}
|
57
|
-
RED.nodes.registerType(
|
58
|
-
}
|
75
|
+
RED.nodes.registerType('usertask-finished-listener', UserTaskFinishedListener);
|
76
|
+
};
|
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
@@ -5,15 +5,15 @@ const engine_client = require('@5minds/processcube_engine_client');
|
|
5
5
|
|
6
6
|
function showStatus(node, msgCounter) {
|
7
7
|
if (msgCounter >= 1) {
|
8
|
-
node.status({fill:
|
8
|
+
node.status({ fill: 'blue', shape: 'dot', text: `handling tasks ${msgCounter}` });
|
9
9
|
} else {
|
10
|
-
node.status({fill:
|
10
|
+
node.status({ fill: 'blue', shape: 'ring', text: `subcribed ${msgCounter}` });
|
11
11
|
}
|
12
12
|
}
|
13
13
|
|
14
|
-
module.exports = function(RED) {
|
14
|
+
module.exports = function (RED) {
|
15
15
|
function UserTaskInput(config) {
|
16
|
-
RED.nodes.createNode(this,config);
|
16
|
+
RED.nodes.createNode(this, config);
|
17
17
|
var node = this;
|
18
18
|
var msgCounter = 0;
|
19
19
|
var flowContext = node.context().flow;
|
@@ -37,20 +37,24 @@ module.exports = function(RED) {
|
|
37
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('input', function(msg) {
|
46
|
-
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg)
|
45
|
+
node.on('input', function (msg) {
|
46
|
+
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
47
47
|
query = {
|
48
48
|
...query,
|
49
|
-
identity: node.server.identity
|
50
|
-
}
|
49
|
+
identity: node.server.identity,
|
50
|
+
};
|
51
51
|
client.userTasks.query(query).then((matchingFlowNodes) => {
|
52
|
-
|
53
|
-
|
52
|
+
if (
|
53
|
+
!config.force_send_array &&
|
54
|
+
matchingFlowNodes &&
|
55
|
+
matchingFlowNodes.userTasks &&
|
56
|
+
matchingFlowNodes.userTasks.length == 1
|
57
|
+
) {
|
54
58
|
userTask = matchingFlowNodes.userTasks[0];
|
55
59
|
|
56
60
|
msg.payload = { userTask: userTask };
|
@@ -59,23 +63,20 @@ module.exports = function(RED) {
|
|
59
63
|
if (!config.force_send_array) {
|
60
64
|
if (config.multisend && matchingFlowNodes.userTasks && matchingFlowNodes.userTasks.length > 1) {
|
61
65
|
matchingFlowNodes.userTasks.forEach((userTask) => {
|
62
|
-
|
63
|
-
msg.payload = { userTask: userTask } ;
|
66
|
+
msg.payload = { userTask: userTask };
|
64
67
|
node.send(msg);
|
65
68
|
});
|
66
69
|
} else {
|
67
|
-
|
68
70
|
msg.payload = { userTasks: matchingFlowNodes.userTasks };
|
69
71
|
node.send(msg);
|
70
72
|
}
|
71
73
|
} else {
|
72
|
-
|
73
74
|
msg.payload = { userTasks: matchingFlowNodes.userTasks || [] };
|
74
75
|
node.send(msg);
|
75
76
|
}
|
76
|
-
|
77
|
+
}
|
77
78
|
});
|
78
79
|
});
|
79
80
|
}
|
80
|
-
RED.nodes.registerType(
|
81
|
-
}
|
81
|
+
RED.nodes.registerType('usertask-input', UserTaskInput);
|
82
|
+
};
|