@5minds/node-red-contrib-processcube 1.4.0-develop-819a52-m2bvwfgk → 1.4.0-feature-d2cbe1-m2dh23ei

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,8 @@
6
6
  name: { value: '' },
7
7
  engine: { value: '', type: 'processcube-engine-config' },
8
8
  topic: { value: '' },
9
- workerConfig: { value: '', type: 'json' },
9
+ workerConfig: { value: '{}'},
10
+ workerConfigType: { value: 'json'}
10
11
  },
11
12
  inputs: 0,
12
13
  outputs: 1,
@@ -19,9 +20,17 @@
19
20
  default: 'json',
20
21
  types: ['json'],
21
22
  });
23
+
24
+ $('#node-input-workerConfig').typedInput('value', this.workerConfig);
25
+ $('#node-input-workerConfig').typedInput('type', this.workerConfigType);
22
26
  },
23
27
  oneditsave: function () {
24
28
  this.workerConfig = $('#node-input-workerConfig').typedInput('value');
29
+ if (this.workerConfig == '') {
30
+ this.workerConfig = '{}'
31
+ $('#node-input-workerConfig').typedInput('value', '{}');
32
+ }
33
+ this.workerConfigType = $('#node-input-workerConfig').typedInput('type');
25
34
  },
26
35
  });
27
36
  </script>
@@ -39,8 +48,8 @@
39
48
  <label for="node-input-topic"><i class="fa fa-tag"></i> Topic</label>
40
49
  <input type="text" id="node-input-topic" placeholder="Topic of ExternalTask" />
41
50
  </div>
42
- <div class="form-row"></div>
43
- <label for="node-input-workerConfig"><i class="fa fa-tag"></i> Worker Config</label>
51
+ <div class="form-row">
52
+ <label for="node-input-workerConfig"><i class="fa fa-tag"></i> Config</label>
44
53
  <input type="text" id="node-input-workerConfig" />
45
54
  </div>
46
55
  </script>
@@ -110,7 +110,7 @@ module.exports = function (RED) {
110
110
  };
111
111
 
112
112
  client.externalTasks
113
- .subscribeToExternalTaskTopic(config.topic, etwCallback, config.workerConfig)
113
+ .subscribeToExternalTaskTopic(config.topic, etwCallback, RED.util.evaluateNodeProperty(config.workerConfig, 'json', node))
114
114
  .then(async (externalTaskWorker) => {
115
115
  node.status({ fill: 'blue', shape: 'ring', text: 'subcribed' });
116
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.4.0-develop-819a52-m2bvwfgk",
3
+ "version": "1.4.0-feature-d2cbe1-m2dh23ei",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -4,6 +4,7 @@
4
4
  defaults: {
5
5
  name: { value: '' },
6
6
  url: { value: 'http://engine:8000', required: true },
7
+ urlType: { type: 'str'},
7
8
  clientId: { value: '' },
8
9
  clientIdType: { type: 'str' },
9
10
  clientSecret: { value: '' },
@@ -13,6 +14,11 @@
13
14
  return this.name || this.url;
14
15
  },
15
16
  oneditprepare: function () {
17
+ $('#node-config-input-url').typedInput({
18
+ default: 'str',
19
+ types: ['str', 'global', 'flow', 'env', 'msg', 'cred'],
20
+ });
21
+
16
22
  $('#node-config-input-clientId').typedInput({
17
23
  default: 'str',
18
24
  types: ['str', 'global', 'flow', 'env', 'msg', 'cred'],
@@ -23,6 +29,9 @@
23
29
  types: ['str', 'global', 'flow', 'env', 'msg', 'cred'],
24
30
  });
25
31
 
32
+ $('#node-config-input-url').typedInput('value', this.url);
33
+ $('#node-config-input-url').typedInput('type', this.urlType);
34
+
26
35
  $('#node-config-input-clientId').typedInput('value', this.clientId);
27
36
  $('#node-config-input-clientId').typedInput('type', this.clientIdType);
28
37
 
@@ -30,6 +39,9 @@
30
39
  $('#node-config-input-clientSecret').typedInput('type', this.clientSecretType);
31
40
  },
32
41
  oneditsave: function () {
42
+ this.url = $('#node-config-input-url').typedInput('value');
43
+ this.urlType = $('#node-config-input-url').typedInput('type');
44
+
33
45
  this.clientId = $('#node-config-input-clientId').typedInput('value');
34
46
  this.clientIdType = $('#node-config-input-clientId').typedInput('type');
35
47
 
@@ -9,7 +9,7 @@ module.exports = function (RED) {
9
9
  RED.nodes.createNode(this, n);
10
10
  const node = this;
11
11
  const identityChangedCallbacks = [];
12
- this.url = n.url;
12
+ this.url = RED.util.evaluateNodeProperty(n.url, n.urlType, node);
13
13
  this.identity = null;
14
14
 
15
15
  this.credentials.clientId = RED.util.evaluateNodeProperty(n.clientId, n.clientIdType, node);