@5minds/node-red-contrib-processcube 1.5.1-feature-e4e26a-m2ep4nwi → 1.5.2-debug-ddec88-m35qz372

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.5.1-feature-e4e26a-m2ep4nwi",
3
+ "version": "1.5.2-debug-ddec88-m35qz372",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -6,6 +6,7 @@ const DELAY_FACTOR = 0.85;
6
6
 
7
7
  module.exports = function (RED) {
8
8
  function ProcessCubeEngineNode(n) {
9
+ console.log('node-redeploy777');
9
10
  RED.nodes.createNode(this, n);
10
11
  const node = this;
11
12
  const identityChangedCallbacks = [];
@@ -15,6 +16,9 @@ module.exports = function (RED) {
15
16
  this.credentials.clientId = RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node);
16
17
  this.credentials.clientSecret = RED.util.evaluateNodeProperty(n.clientSecret, n.clientSecretType, node);
17
18
 
19
+ console.log('clientId777', this.credentials.clientId);
20
+ console.log('clientSecret777', this.credentials.clientSecret);
21
+
18
22
  this.registerOnIdentityChanged = function (callback) {
19
23
  identityChangedCallbacks.push(callback);
20
24
  };
@@ -44,6 +48,7 @@ module.exports = function (RED) {
44
48
  });
45
49
 
46
50
  if (this.credentials.clientId && this.credentials.clientSecret) {
51
+ console.log('credentials_set777');
47
52
  this.engineClient = new engine_client.EngineClient(this.url);
48
53
 
49
54
  this.engineClient.applicationInfo
@@ -64,6 +69,7 @@ module.exports = function (RED) {
64
69
  node.error(reason);
65
70
  });
66
71
  } else {
72
+ console.log('credentials_NOT_set777');
67
73
  this.engineClient = new engine_client.EngineClient(this.url);
68
74
  }
69
75
  }
@@ -125,6 +131,7 @@ async function startRefreshingIdentityCycle(clientId, clientSecret, authorityUrl
125
131
 
126
132
  const refresh = async () => {
127
133
  try {
134
+ console.log('refreshing_identity777', clientId, clientSecret);
128
135
  const newTokenSet = await getFreshTokenSet(clientId, clientSecret, authorityUrl);
129
136
  const expiresIn = await getExpiresInForExternalTaskWorkers(newTokenSet);
130
137
  const delay = expiresIn * DELAY_FACTOR * 1000;
@@ -134,7 +141,7 @@ async function startRefreshingIdentityCycle(clientId, clientSecret, authorityUrl
134
141
  configNode.setIdentity(freshIdentity);
135
142
 
136
143
  retries = 5;
137
- setTimeout(refresh, delay);
144
+ setTimeout(refresh, 2000);
138
145
  } catch (error) {
139
146
  if (retries === 0) {
140
147
  console.error(
@@ -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