@5minds/node-red-contrib-processcube 1.14.0-develop-da639a-m9v93t0h → 1.14.0-develop-495d78-magw0hhy

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.14.0-develop-da639a-m9v93t0h",
3
+ "version": "1.14.0-develop-495d78-magw0hhy",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -48,6 +48,7 @@
48
48
  "processcubeEngineConfig": "processcube-engine-config.js",
49
49
  "ProcessinstanceQuery": "processinstance-query.js",
50
50
  "ProcessinstanceDelete": "processinstance-delete.js",
51
+ "ProcessinstanceDeleteAdvanced": "processinstance-delete-advanced.js",
51
52
  "ProcessdefinitionDeploy": "processdefinition-deploy.js",
52
53
  "ProcessdefinitionQuery": "processdefinition-query.js",
53
54
  "messageEventTrigger": "message-event-trigger.js",
@@ -0,0 +1,79 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('processinstance-delete-advanced', {
3
+ category: 'ProcessCube DevOps',
4
+ color: '#02AFD6',
5
+ defaults: {
6
+ name: { value: '' },
7
+ engine: { value: '', type: 'processcube-engine-config' },
8
+ query: { value: 'payload' },
9
+ query_type: { value: 'msg' },
10
+ delete_releated: { value: false },
11
+ },
12
+ inputs: 1,
13
+ outputs: 1,
14
+ icon: 'font-awesome/fa-sign-in',
15
+ label: function () {
16
+ return this.name || 'processinstance-delete-advanced';
17
+ },
18
+ oneditprepare: function () {
19
+ $('#node-input-query').typedInput({
20
+ default: 'msg',
21
+ types: ['msg', 'json'],
22
+ });
23
+
24
+ $('#node-input-query').typedInput('value', this.query);
25
+ $('#node-input-query').typedInput('type', this.query_type);
26
+ },
27
+ oneditsave: function () {
28
+ (this.query = $('#node-input-query').typedInput('value')),
29
+ (this.query_type = $('#node-input-query').typedInput('type'));
30
+ },
31
+ });
32
+ </script>
33
+
34
+ <script type="text/html" data-template-name="processinstance-delete-advanced">
35
+ <div class="form-row">
36
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
37
+ <input type="text" id="node-input-name" placeholder="Name" />
38
+ </div>
39
+ <div class="form-row">
40
+ <label for="node-input-engine"><i class="fa fa-tag"></i> Engine-URL</label>
41
+ <input type="text" id="node-input-engine" placeholder="Engine-URL" />
42
+ </div>
43
+ <div class="form-row">
44
+ <label for="node-input-query"><i class="fa fa-tag"></i> Query</label>
45
+ <input type="text" id="node-input-query" />
46
+ </div>
47
+ <div class="form-row" style="margin-bottom: 3px;">
48
+ <input type="checkbox" checked id="node-input-delete_releated" style="display: inline-block; width: auto; vertical-align: top; margin-left: 30px; margin-right: 5px;">
49
+ <label style="width:auto" for="node-input-delete_releated">Delete related</label>
50
+ </div>
51
+ </script>
52
+
53
+ <script type="text/markdown" data-help-name="processinstance-delete-advanced">
54
+ Delete old instances of a process model in the ProcessCube.
55
+
56
+ Only engines version >= 19 are supported.
57
+
58
+ ## Inputs
59
+
60
+ : payload (json): The Parameter to delete the instances.
61
+
62
+
63
+ ## Outputs
64
+
65
+ : Explanation of the payload:
66
+
67
+ Object
68
+ {
69
+ processInstanceId: The IDs of the ProcessInstances to delete (Example : 12345678,87654321).
70
+ processModelId: The ID of the ProcessModel to delete the instances from.
71
+ finishedBefore: The date before which the instances should be deleted.
72
+ finshedAfter: The date after which the instances should be deleted.
73
+ }
74
+
75
+ ### References
76
+
77
+ - [The ProcessCube Developer Network](https://processcube.io) - All documentation for the ProcessCube&copy; platform
78
+ - [Node-RED Integration in ProcessCube&copy;](https://processcube.io/docs/node-red) - Node-RED integration in ProcessCube&copy;
79
+ </script>
@@ -0,0 +1,33 @@
1
+ module.exports = function (RED) {
2
+ function ProcessInstanceDeleteAdvanced(config) {
3
+ RED.nodes.createNode(this, config);
4
+ const node = this;
5
+
6
+ node.on('input', async function (msg) {
7
+ node.engine = RED.nodes.getNode(config.engine);
8
+ const client = node.engine ? node.engine.engineClient : null;
9
+
10
+ let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
11
+
12
+ const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
13
+ const userIdentity = isUser ? { userId: msg._client.user.id, token: msg._client.user.accessToken } : null;
14
+
15
+ if (!client || !client.processInstances) {
16
+ node.error('No engine or processInstances API configured.', msg);
17
+ return;
18
+ }
19
+
20
+ try {
21
+ const result = await client.processInstances.delete(query, config.delete_releated, userIdentity)
22
+
23
+ msg.payload = result
24
+
25
+ node.send(msg);
26
+ } catch (queryError) {
27
+ node.error(`Failed to delete process instances Error: ${queryError.message}`, msg);
28
+ }
29
+ });
30
+ }
31
+
32
+ RED.nodes.registerType('processinstance-delete-advanced', ProcessInstanceDeleteAdvanced);
33
+ };
@@ -50,7 +50,7 @@
50
50
  </script>
51
51
 
52
52
  <script type="text/markdown" data-help-name="processinstance-delete">
53
- Delete old instances of a process model in the ProcessCube.
53
+ Delete old instances of a process model in the ProcessCube.
54
54
 
55
55
  ## Inputs
56
56
 
@@ -14,7 +14,8 @@
14
14
  outputs: 1,
15
15
  icon: 'usertask_event_listener.svg',
16
16
  label: function () {
17
- return this.name || 'usertask-event-listener';
17
+ return this.name || (this.eventtype ? `usertask: ${this.eventtype}` : 'usertask-event-listener');
18
+
18
19
  },
19
20
  oneditprepare: function () {
20
21
  $('#node-input-query').typedInput({