@5minds/node-red-contrib-processcube 1.6.0-process-instance-delete-hotfix-babe1e-m4ve9aj6 → 1.6.0-process-instance-delete-hotfix-5dd524-m4vf68wc
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.
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@5minds/node-red-contrib-processcube",
|
3
|
-
"version": "1.6.0-process-instance-delete-hotfix-
|
3
|
+
"version": "1.6.0-process-instance-delete-hotfix-5dd524-m4vf68wc",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "Node-RED nodes for ProcessCube",
|
6
6
|
"scripts": {
|
@@ -7,7 +7,7 @@
|
|
7
7
|
engine: { value: '', type: 'processcube-engine-config' },
|
8
8
|
modelid: { value: '' },
|
9
9
|
duration: { value: '', type: 'number' },
|
10
|
-
|
10
|
+
time_type: { value: '' },
|
11
11
|
batch_size: { value: '100', type: 'number' },
|
12
12
|
},
|
13
13
|
inputs: 1,
|
@@ -37,8 +37,8 @@
|
|
37
37
|
<input type="text" id="node-input-duration" />
|
38
38
|
</div>
|
39
39
|
<div class="form-row">
|
40
|
-
<label for="node-input-
|
41
|
-
<select id="node-input-
|
40
|
+
<label for="node-input-time_type"><i class="fa fa-sliders"></i> Time Unit</label>
|
41
|
+
<select id="node-input-time_type" style="width: 70%;">
|
42
42
|
<option value="hours">Hours</option>
|
43
43
|
<option value="days">Days</option>
|
44
44
|
</select>
|
@@ -55,7 +55,7 @@ Delete old instances of a process model in the ProcessCube.
|
|
55
55
|
## Inputs
|
56
56
|
|
57
57
|
: payload.duration (number): The number of given time periods.
|
58
|
-
: payload.
|
58
|
+
: payload.time_type ('hours' | 'days'): The type of time period to use.
|
59
59
|
: payload.batch_size (number): The number of instances to be deleted simultaneously. (default 100)
|
60
60
|
|
61
61
|
## Outputs
|
@@ -18,14 +18,26 @@ module.exports = function (RED) {
|
|
18
18
|
return;
|
19
19
|
}
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
// Gültige Werte für time_type
|
22
|
+
const validTimeTypes = ['days', 'hours'];
|
23
|
+
const timeType = msg.payload.time_type
|
24
|
+
? msg.payload.time_type.toLowerCase()
|
25
|
+
: config.time_type?.toLowerCase();
|
26
|
+
|
27
|
+
// time_type validieren
|
28
|
+
if (!timeType || !validTimeTypes.includes(timeType)) {
|
29
|
+
node.error(`Invalid time_type provided: ${timeType}. Allowed values are 'days' or 'hours'.`);
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
33
|
+
// Zeitmultiplikator berechnen
|
34
|
+
const multiplier = timeType === 'hours' ? 1 : 24;
|
35
|
+
node.log(`Time type: ${timeType}, multiplier: ${multiplier}`);
|
36
|
+
|
26
37
|
const deletionDate = new Date(Date.now() - timeToUse * multiplier * 60 * 60 * 1000);
|
27
38
|
node.log(`Errechnetes Datum: ${deletionDate}`);
|
28
39
|
const modelId = msg.payload.processModelId?.trim() || config.modelid?.trim();
|
40
|
+
|
29
41
|
if (!modelId) {
|
30
42
|
node.error('processModelId is not defined or empty.');
|
31
43
|
return;
|