@5minds/node-red-contrib-processcube 1.5.1-develop-7901c3-m2ed18yb → 1.5.1-develop-995f5e-m2xez4u2

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.
@@ -23,7 +23,7 @@ module.exports = function (RED) {
23
23
  }
24
24
 
25
25
  const error = new Error(msgError.message);
26
- error.errorCode = config.error;
26
+ error.errorCode = config.error || {};
27
27
  error.errorDetails = RED.util.encodeObject(msg);
28
28
 
29
29
  msg.errorCode = config.error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.5.1-develop-7901c3-m2ed18yb",
3
+ "version": "1.5.1-develop-995f5e-m2xez4u2",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -5,6 +5,7 @@
5
5
  defaults: {
6
6
  name: { value: '' },
7
7
  engine: { value: '', type: 'processcube-engine-config' },
8
+ modelid: { value: '' },
8
9
  time: { value: '', type: 'number' },
9
10
  time_type: { value: 'hours' },
10
11
  },
@@ -27,11 +28,15 @@
27
28
  <input type="text" id="node-input-engine" placeholder="Engine-URL" />
28
29
  </div>
29
30
  <div class="form-row">
30
- <label for="node-input-time"><i class="fa fa-tag"></i> Time</label>
31
+ <label for="node-input-modelid"><i class="fa fa-tag"></i> Model-ID</label>
32
+ <input type="text" id="node-input-modelid" />
33
+ </div>
34
+ <div class="form-row">
35
+ <label for="node-input-time"><i class="fa fa-tag"></i> Duration</label>
31
36
  <input type="text" id="node-input-time" />
32
37
  </div>
33
38
  <div class="form-row">
34
- <label for="node-input-time_type"><i class="fa fa-sliders"></i> Period</label>
39
+ <label for="node-input-time_type"><i class="fa fa-sliders"></i> Time Unit</label>
35
40
  <select id="node-input-time_type" style="width: 70%;">
36
41
  <option value="hours">Hours</option>
37
42
  <option value="days">Days</option>
@@ -40,19 +45,19 @@
40
45
  </script>
41
46
 
42
47
  <script type="text/markdown" data-help-name="processinstance-delete">
43
- Delete old instances of a process model in the ProcessCube.
48
+ Delete old instances of a process model in the ProcessCube.
44
49
 
45
- ## Inputs
50
+ ## Inputs
46
51
 
47
- : payload.time (number): The number of given time periods.
48
- : payload.time_type ('hours' | 'days'): The type of time period to use.
52
+ : payload.time (number): The number of given time periods.
53
+ : payload.time_type ('hours' | 'days'): The type of time period to use.
49
54
 
50
- ## Outputs
55
+ ## Outputs
51
56
 
52
- : payload (string[]): The ids of the processinstances that were deleted.
57
+ : payload (string[]): The ids of the processinstances that were deleted.
53
58
 
54
- ### References
59
+ ### References
55
60
 
56
- - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
57
- - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
61
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
62
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
58
63
  </script>
@@ -19,18 +19,21 @@ module.exports = function (RED) {
19
19
  }
20
20
 
21
21
  const timeToUse = msg.payload.time ? msg.payload.time : config.time;
22
+ const modelId = msg.payload.processModelId
23
+ ? msg.payload.processModelId != ''
24
+ ? msg.payload.processModelId
25
+ : undefined
26
+ : config.modelid != ''
27
+ ? config.modelid
28
+ : undefined;
22
29
 
23
30
  try {
24
- const fetchInstancesByState = async (state) => {
25
- const result = await client.processInstances.query({ state });
26
- return result.processInstances;
27
- };
28
-
29
- const finishedInstances = await fetchInstancesByState('finished');
30
- const terminatedInstances = await fetchInstancesByState('terminated');
31
- const errorInstances = await fetchInstancesByState('error');
31
+ const result = await client.processInstances.query({
32
+ processModelId: modelId,
33
+ identity: engine.identity,
34
+ });
32
35
 
33
- let allInstances = [...finishedInstances, ...terminatedInstances, ...errorInstances];
36
+ let allInstances = result.processInstances.filter((instance) => instance.state != 'suspended');
34
37
 
35
38
  const today = new Date();
36
39