@5minds/node-red-contrib-processcube 0.4.0-feature-1801aa-lxkqknsa → 0.4.0-feature-c86557-lxlmvpx4
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 +10 -4
- 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,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@5minds/node-red-contrib-processcube",
|
3
|
-
"version": "0.4.0-feature-
|
3
|
+
"version": "0.4.0-feature-c86557-lxlmvpx4",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Node-RED nodes for ProcessCube",
|
6
6
|
"authors": [
|
@@ -11,6 +11,10 @@
|
|
11
11
|
{
|
12
12
|
"name": "Robin Lenz",
|
13
13
|
"email": "Robin.Lenz@5Minds.de"
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"name": "André Siebelist",
|
17
|
+
"email": "Andre.Siebelist@5Minds.de"
|
14
18
|
}
|
15
19
|
],
|
16
20
|
"repository": {
|
@@ -32,14 +36,16 @@
|
|
32
36
|
"externaltaskOutput": "externaltask-output.js",
|
33
37
|
"externaltaskError": "externaltask-error.js",
|
34
38
|
"processStart": "process-start.js",
|
39
|
+
"processcubeEngineConfig": "processcube-engine-config.js",
|
40
|
+
"messageEventTrigger": "message-event-trigger.js",
|
41
|
+
"signalEventTrigger": "signal-event-trigger.js",
|
35
42
|
"UserTaskNewListener": "usertask-new-listener.js",
|
36
43
|
"UserTaskInput": "usertask-input.js",
|
37
|
-
"UserTaskOutput": "usertask-output.js"
|
38
|
-
"processcubeEngineConfig": "processcube-engine-config.js"
|
44
|
+
"UserTaskOutput": "usertask-output.js"
|
39
45
|
}
|
40
46
|
},
|
41
47
|
"dependencies": {
|
42
|
-
"@5minds/processcube_engine_client": "
|
48
|
+
"@5minds/processcube_engine_client": "^5.0.0"
|
43
49
|
},
|
44
50
|
"keywords": [
|
45
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
|
+
}
|