@5minds/node-red-contrib-processcube 0.4.0 → 0.5.0-feature-f950ad-lxlmw0a8
Sign up to get free protection for your applications and to get access to all the features.
- package/message-event-trigger.html +41 -0
- package/message-event-trigger.js +44 -0
- package/package.json +12 -5
- package/signal-event-trigger.html +41 -0
- package/signal-event-trigger.js +44 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
<script type="text/javascript">
|
2
|
+
RED.nodes.registerType('message-event-trigger',{
|
3
|
+
category: 'ProcessCube',
|
4
|
+
color: '#00aed7',
|
5
|
+
defaults: {
|
6
|
+
name: {value: ""},
|
7
|
+
engine: {value: "", type: "processcube-engine-config"},
|
8
|
+
messagename: {value: "", required: true},
|
9
|
+
processInstanceId: {value:""}
|
10
|
+
},
|
11
|
+
inputs: 1,
|
12
|
+
outputs: 1,
|
13
|
+
icon: "font-awesome/fa-envelope-open",
|
14
|
+
label: function() {
|
15
|
+
return this.name||"message-event-trigger";
|
16
|
+
}
|
17
|
+
});
|
18
|
+
</script>
|
19
|
+
|
20
|
+
<script type="text/html" data-template-name="message-event-trigger">
|
21
|
+
<div class="form-row">
|
22
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
23
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
24
|
+
</div>
|
25
|
+
<div class="form-row">
|
26
|
+
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine</label>
|
27
|
+
<input type="text" id="node-input-engine" placeholder="Engine">
|
28
|
+
</div>
|
29
|
+
<div class="form-row">
|
30
|
+
<label for="node-input-messagename"><i class="fa fa-tag"></i> Message Name</label>
|
31
|
+
<input type="text" id="node-input-messagename" placeholder="Name of the Message-Event">
|
32
|
+
</div>
|
33
|
+
<div class="form-row">
|
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">
|
36
|
+
</div>
|
37
|
+
</script>
|
38
|
+
|
39
|
+
<script type="text/html" data-help-name="externaltask-input">
|
40
|
+
<p>A node which emmits an message event to the Engine.</p>
|
41
|
+
</script>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const process = require('process');
|
2
|
+
|
3
|
+
const engine_client = require('@5minds/processcube_engine_client');
|
4
|
+
|
5
|
+
module.exports = function(RED) {
|
6
|
+
function MessageEventTrigger(config) {
|
7
|
+
RED.nodes.createNode(this, config);
|
8
|
+
var node = this;
|
9
|
+
var nodeContext = node.context();
|
10
|
+
|
11
|
+
this.engine = this.server = RED.nodes.getNode(config.engine);
|
12
|
+
|
13
|
+
const engineUrl = this.engine?.url || process.env.ENGINE_URL || 'http://engine:8000';
|
14
|
+
|
15
|
+
var client = nodeContext.get('client');
|
16
|
+
|
17
|
+
if (!client) {
|
18
|
+
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
19
|
+
client = nodeContext.get('client');
|
20
|
+
}
|
21
|
+
|
22
|
+
node.on('input', function(msg) {
|
23
|
+
|
24
|
+
client.events.triggerMessageEvent(
|
25
|
+
config.messagename,
|
26
|
+
{
|
27
|
+
processInstanceId: config.processinstanceid,
|
28
|
+
payload: msg.payload
|
29
|
+
}
|
30
|
+
|
31
|
+
).then((result) => {
|
32
|
+
|
33
|
+
msg.payload = result;
|
34
|
+
|
35
|
+
node.send(msg);
|
36
|
+
node.status({fill: "blue", shape: "dot", text: `message event triggered`});
|
37
|
+
|
38
|
+
}).catch((error) => {
|
39
|
+
node.error(error);
|
40
|
+
});
|
41
|
+
});
|
42
|
+
}
|
43
|
+
RED.nodes.registerType("message-event-trigger", MessageEventTrigger);
|
44
|
+
}
|
package/package.json
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
{
|
2
2
|
"name": "@5minds/node-red-contrib-processcube",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.5.0-feature-f950ad-lxlmw0a8",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Node-RED nodes for ProcessCube",
|
6
|
-
"authors": [
|
6
|
+
"authors": [
|
7
|
+
{
|
7
8
|
"name": "Martin Moellenbeck",
|
8
9
|
"email": "Martin.Moellenbeck@5Minds.de"
|
9
10
|
},
|
10
11
|
{
|
11
12
|
"name": "Robin Lenz",
|
12
13
|
"email": "Robin.Lenz@5Minds.de"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"name": "André Siebelist",
|
17
|
+
"email": "Andre.Siebelist@5Minds.de"
|
13
18
|
}
|
14
19
|
],
|
15
20
|
"repository": {
|
@@ -31,14 +36,16 @@
|
|
31
36
|
"externaltaskOutput": "externaltask-output.js",
|
32
37
|
"externaltaskError": "externaltask-error.js",
|
33
38
|
"processStart": "process-start.js",
|
39
|
+
"processcubeEngineConfig": "processcube-engine-config.js",
|
40
|
+
"messageEventTrigger": "message-event-trigger.js",
|
41
|
+
"signalEventTrigger": "signal-event-trigger.js",
|
34
42
|
"UserTaskNewListener": "usertask-new-listener.js",
|
35
43
|
"UserTaskInput": "usertask-input.js",
|
36
|
-
"UserTaskOutput": "usertask-output.js"
|
37
|
-
"processcubeEngineConfig": "processcube-engine-config.js"
|
44
|
+
"UserTaskOutput": "usertask-output.js"
|
38
45
|
}
|
39
46
|
},
|
40
47
|
"dependencies": {
|
41
|
-
"@5minds/processcube_engine_client": "
|
48
|
+
"@5minds/processcube_engine_client": "^5.0.0"
|
42
49
|
},
|
43
50
|
"keywords": [
|
44
51
|
"node-red",
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<script type="text/javascript">
|
2
|
+
RED.nodes.registerType('signal-event-trigger',{
|
3
|
+
category: 'ProcessCube',
|
4
|
+
color: '#00aed7',
|
5
|
+
defaults: {
|
6
|
+
name: {value: ""},
|
7
|
+
engine: {value: "", type: "processcube-engine-config"},
|
8
|
+
signalname: {value: "", required: true},
|
9
|
+
processInstanceId: {value:""}
|
10
|
+
},
|
11
|
+
inputs: 1,
|
12
|
+
outputs: 1,
|
13
|
+
icon: "font-awesome/fa-envelope-open",
|
14
|
+
label: function() {
|
15
|
+
return this.name||"signal-event-trigger";
|
16
|
+
}
|
17
|
+
});
|
18
|
+
</script>
|
19
|
+
|
20
|
+
<script type="text/html" data-template-name="signal-event-trigger">
|
21
|
+
<div class="form-row">
|
22
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
23
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
24
|
+
</div>
|
25
|
+
<div class="form-row">
|
26
|
+
<label for="node-input-engine"><i class="fa fa-tag"></i> Engine</label>
|
27
|
+
<input type="text" id="node-input-engine" placeholder="Engine">
|
28
|
+
</div>
|
29
|
+
<div class="form-row">
|
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">
|
32
|
+
</div>
|
33
|
+
<div class="form-row">
|
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">
|
36
|
+
</div>
|
37
|
+
</script>
|
38
|
+
|
39
|
+
<script type="text/html" data-help-name="signal-event-trigger">
|
40
|
+
<p>A node which emmits a signal event to the Engine.</p>
|
41
|
+
</script>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
const process = require('process');
|
2
|
+
|
3
|
+
const engine_client = require('@5minds/processcube_engine_client');
|
4
|
+
|
5
|
+
module.exports = function(RED) {
|
6
|
+
function SignalEventTrigger(config) {
|
7
|
+
RED.nodes.createNode(this, config);
|
8
|
+
var node = this;
|
9
|
+
var nodeContext = node.context();
|
10
|
+
|
11
|
+
this.engine = this.server = RED.nodes.getNode(config.engine);
|
12
|
+
|
13
|
+
const engineUrl = this.engine?.url || process.env.ENGINE_URL || 'http://engine:8000';
|
14
|
+
|
15
|
+
var client = nodeContext.get('client');
|
16
|
+
|
17
|
+
if (!client) {
|
18
|
+
nodeContext.set('client', new engine_client.EngineClient(engineUrl));
|
19
|
+
client = nodeContext.get('client');
|
20
|
+
}
|
21
|
+
|
22
|
+
node.on('input', function(msg) {
|
23
|
+
|
24
|
+
client.events.triggerSignalEvent(
|
25
|
+
config.signalname,
|
26
|
+
{
|
27
|
+
processInstanceId: config.processinstanceid,
|
28
|
+
payload: msg.payload
|
29
|
+
}
|
30
|
+
|
31
|
+
).then((result) => {
|
32
|
+
|
33
|
+
msg.payload = result;
|
34
|
+
|
35
|
+
node.send(msg);
|
36
|
+
node.status({fill: "blue", shape: "dot", text: `signal event triggered`});
|
37
|
+
|
38
|
+
}).catch((error) => {
|
39
|
+
node.error(error);
|
40
|
+
});
|
41
|
+
});
|
42
|
+
}
|
43
|
+
RED.nodes.registerType("signal-event-trigger", SignalEventTrigger);
|
44
|
+
}
|