@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
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,34 +1,39 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('usertask-new-listener',{
|
2
|
+
RED.nodes.registerType('usertask-new-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-open',
|
13
|
+
label: function () {
|
14
|
+
return this.name || 'usertask-new-listener';
|
15
|
+
},
|
16
16
|
});
|
17
17
|
</script>
|
18
18
|
|
19
19
|
<script type="text/html" data-template-name="usertask-new-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-new-listener">
|
38
43
|
<p>A node which subscribes to an User Task of https://processcube.io</p>
|
39
|
-
</script>
|
44
|
+
</script>
|
package/usertask-new-listener.js
CHANGED
@@ -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 UserTaskNewListener(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
|
|
@@ -27,33 +27,50 @@ module.exports = function(RED) {
|
|
27
27
|
flowContext.set('emitter', new EventEmitter());
|
28
28
|
eventEmitter = flowContext.get('emitter');
|
29
29
|
}
|
30
|
-
|
30
|
+
|
31
31
|
const register = async () => {
|
32
32
|
let currentIdentity = node.server.identity;
|
33
|
-
let subscription = await client.userTasks.onUserTaskWaiting(
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
let subscription = await client.userTasks.onUserTaskWaiting(
|
34
|
+
(userTaskWaitingNotification) => {
|
35
|
+
node.send({
|
36
|
+
payload: {
|
37
|
+
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
|
38
|
+
action: 'new',
|
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.onUserTaskWaiting(
|
42
|
-
|
43
|
-
|
49
|
+
|
50
|
+
subscription = await client.userTasks.onUserTaskWaiting(
|
51
|
+
(userTaskWaitingNotification) => {
|
52
|
+
node.send({
|
53
|
+
payload: {
|
54
|
+
flowNodeInstanceId: userTaskWaitingNotification.flowNodeInstanceId,
|
55
|
+
action: 'new',
|
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
|
-
|
57
74
|
}
|
58
|
-
RED.nodes.registerType(
|
59
|
-
}
|
75
|
+
RED.nodes.registerType('usertask-new-listener', UserTaskNewListener);
|
76
|
+
};
|
package/usertask-output.html
CHANGED
@@ -1,48 +1,47 @@
|
|
1
1
|
<script type="text/javascript">
|
2
|
-
RED.nodes.registerType('usertask-output',{
|
2
|
+
RED.nodes.registerType('usertask-output', {
|
3
3
|
category: 'ProcessCube',
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
|
-
name: {value:
|
7
|
-
engine: {value:
|
8
|
-
result: {value:
|
9
|
-
result_type: {value:
|
6
|
+
name: { value: '' },
|
7
|
+
engine: { value: '', type: 'processcube-engine-config' },
|
8
|
+
result: { value: 'payload' },
|
9
|
+
result_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',
|
14
|
+
label: function () {
|
15
|
+
return this.name || 'usertask-output';
|
16
16
|
},
|
17
|
-
oneditprepare: function() {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
oneditprepare: function () {
|
18
|
+
$('#node-input-result').typedInput({
|
19
|
+
default: 'msg',
|
20
|
+
types: ['msg', 'json'],
|
21
|
+
});
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
23
|
+
$('#node-input-result').typedInput('value', this.result);
|
24
|
+
$('#node-input-result').typedInput('type', this.result_type);
|
25
|
+
},
|
26
|
+
oneditsave: function () {
|
27
|
+
(this.result = $('#node-input-result').typedInput('value')),
|
28
|
+
(this.result_type = $('#node-input-result').typedInput('type'));
|
29
|
+
},
|
31
30
|
});
|
32
31
|
</script>
|
33
32
|
|
34
33
|
<script type="text/html" data-template-name="usertask-output">
|
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-result"><i class="fa fa-tag"></i> Result</label>
|
45
|
-
<input type="text" id="node-input-result"
|
44
|
+
<input type="text" id="node-input-result" />
|
46
45
|
</div>
|
47
46
|
</script>
|
48
47
|
|
package/usertask-output.js
CHANGED
@@ -3,9 +3,8 @@ 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 UserTaskOutput(config) {
|
8
|
-
|
9
8
|
RED.nodes.createNode(this, config);
|
10
9
|
|
11
10
|
var node = this;
|
@@ -30,24 +29,25 @@ module.exports = function(RED) {
|
|
30
29
|
eventEmitter = flowContext.get('emitter');
|
31
30
|
}
|
32
31
|
|
33
|
-
node.on('input', function(msg) {
|
32
|
+
node.on('input', function (msg) {
|
34
33
|
if (msg.payload.userTask) {
|
35
|
-
|
36
34
|
const flowNodeInstanceId = msg.payload.userTask.flowNodeInstanceId;
|
37
35
|
|
38
36
|
const userTaskResult = RED.util.evaluateNodeProperty(config.result, config.result_type, node, msg);
|
39
37
|
|
40
|
-
client.userTasks
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
38
|
+
client.userTasks
|
39
|
+
.finishUserTask(flowNodeInstanceId, userTaskResult, node.server.identity)
|
40
|
+
.then(() => {
|
41
|
+
node.send(msg);
|
42
|
+
})
|
43
|
+
.catch((error) => {
|
44
|
+
node.error(error);
|
45
|
+
});
|
46
46
|
} else {
|
47
47
|
node.error(`No UserTask found in message: ${JSON.stringify(msg.payload)}`);
|
48
48
|
}
|
49
49
|
});
|
50
50
|
}
|
51
51
|
|
52
|
-
RED.nodes.registerType(
|
53
|
-
}
|
52
|
+
RED.nodes.registerType('usertask-output', UserTaskOutput);
|
53
|
+
};
|