@5minds/node-red-contrib-processcube 1.1.4-develop-42c299-m05bmm2k → 1.1.4-develop-f12497-m0akrvxl

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.1.4-develop-42c299-m05bmm2k",
3
+ "version": "1.1.4-develop-f12497-m0akrvxl",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -40,6 +40,7 @@
40
40
  "externaltaskOutput": "externaltask-output.js",
41
41
  "externaltaskError": "externaltask-error.js",
42
42
  "processStart": "process-start.js",
43
+ "processTerminate": "process-terminate.js",
43
44
  "processEventListener": "process-event-listener.js",
44
45
  "processcubeEngineConfig": "processcube-engine-config.js",
45
46
  "ProcessinstanceQuery": "processinstance-query.js",
@@ -0,0 +1,37 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('process-terminate', {
3
+ category: 'ProcessCube',
4
+ color: '#02AFD6',
5
+ defaults: {
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ },
9
+ inputs: 1,
10
+ outputs: 1,
11
+ icon: 'font-awesome/fa-sign-in',
12
+ label: function () {
13
+ return this.name || 'process-terminate';
14
+ },
15
+ });
16
+ </script>
17
+
18
+ <script type="text/html" data-template-name="process-terminate">
19
+ <div class="form-row">
20
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
21
+ <input type="text" id="node-input-name" placeholder="Name" />
22
+ </div>
23
+ <div class="form-row">
24
+ <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
25
+ <input type="text" id="node-input-engine" placeholder="Engine-URL" />
26
+ </div>
27
+ </script>
28
+
29
+ <script type="text/markdown" data-help-name="process-terminate">
30
+ Terminate an instance of a process model in the ProcessCube.
31
+
32
+ ### References
33
+
34
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
35
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
36
+
37
+ </script>
@@ -0,0 +1,27 @@
1
+ module.exports = function (RED) {
2
+ function ProcessTerminate(config) {
3
+ RED.nodes.createNode(this, config);
4
+ var node = this;
5
+
6
+ node.on('input', function (msg) {
7
+ const engine = RED.nodes.getNode(config.engine);
8
+ const client = engine.engineClient;
9
+
10
+ if (!client) {
11
+ node.error('No engine configured.');
12
+ return;
13
+ }
14
+
15
+ client.processInstances
16
+ .terminateProcessInstance(msg.payload, engine.identity)
17
+ .then(() => {
18
+ node.send(msg);
19
+ })
20
+ .catch((error) => {
21
+ node.error(error);
22
+ });
23
+ });
24
+ }
25
+
26
+ RED.nodes.registerType('process-terminate', ProcessTerminate);
27
+ };