node-red-contrib-mobius-flow-base 2.5.91 → 3.0.0-beta.13

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.
Files changed (44) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +16 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +16 -0
  3. package/.github/ISSUE_TEMPLATE/general.md +7 -0
  4. package/.github/workflows/build_publish.yml +80 -0
  5. package/README.md +4 -10
  6. package/dist/engine-api-calls.d.ts +19 -0
  7. package/dist/engine-api-calls.js +235 -0
  8. package/dist/engine-api-client.d.ts +8 -0
  9. package/dist/engine-api-client.js +106 -0
  10. package/dist/engine-websocket.d.ts +60 -0
  11. package/dist/engine-websocket.js +264 -0
  12. package/dist/node-red-ui-funcs.js +180 -0
  13. package/dist/nodes/common/mobsearch.js +602 -0
  14. package/dist/nodes/mobius-change-admin-password.d.ts +26 -0
  15. package/dist/nodes/mobius-change-admin-password.html +98 -0
  16. package/dist/nodes/mobius-change-admin-password.js +87 -0
  17. package/dist/nodes/mobius-clear-resource.html +37 -12
  18. package/dist/nodes/mobius-clear-resource.js +17 -13
  19. package/dist/nodes/mobius-connection-interface.d.ts +45 -0
  20. package/dist/nodes/mobius-connection-interface.js +2 -0
  21. package/dist/nodes/mobius-connection.html +30 -8
  22. package/dist/nodes/mobius-connection.js +216 -85
  23. package/dist/nodes/mobius-discover-object-list.html +185 -126
  24. package/dist/nodes/mobius-discover-object-list.js +24 -5
  25. package/dist/nodes/mobius-discover.js +7 -7
  26. package/dist/nodes/mobius-filter-by-rid-value.html +62 -42
  27. package/dist/nodes/mobius-filter-by-rid-value.js +38 -31
  28. package/dist/nodes/mobius-flow-inject.html +32 -2
  29. package/dist/nodes/mobius-get-multi-object.html +39 -5
  30. package/dist/nodes/mobius-get-multi-resource.html +37 -4
  31. package/dist/nodes/mobius-get-multi-resource.js +13 -12
  32. package/dist/nodes/mobius-get-object.html +39 -11
  33. package/dist/nodes/mobius-get-object.js +12 -9
  34. package/dist/nodes/mobius-get-resource.html +41 -12
  35. package/dist/nodes/mobius-get-resource.js +17 -12
  36. package/dist/nodes/mobius-object-cov.html +40 -11
  37. package/dist/nodes/mobius-object-cov.js +9 -6
  38. package/dist/nodes/mobius-resource-cov.html +37 -11
  39. package/dist/nodes/mobius-resource-cov.js +5 -5
  40. package/dist/nodes/mobius-set-multi-resource.html +39 -12
  41. package/dist/nodes/mobius-set-multi-resource.js +9 -11
  42. package/dist/nodes/mobius-set-resource.html +38 -11
  43. package/package.json +15 -8
  44. package/dist/nodes/node-red-ui-discover-devices.js +0 -103
@@ -0,0 +1,98 @@
1
+ <!--
2
+ Copyright (C) 2016, IAConnects Technology Limited
3
+ All Rights Reserved
4
+
5
+ ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
6
+ THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
7
+ IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
8
+ HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
9
+ AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
10
+ DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
11
+ IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
12
+ FROM IACONNECTS TECHNOLOGY LIMITED.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
18
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
+ POSSIBILITY OF SUCH DAMAGE.
25
+ -->
26
+
27
+ <script type="text/x-red" data-template-name="mobius change admin password">
28
+ <div class="form-row">
29
+ <label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
30
+ <input type="text" id="node-input-connection">
31
+ </div>
32
+ <hr>
33
+
34
+ <div class="form-row" id="input-row">
35
+ <label for="node-input-password"><i class="fa fa-key"></i> Password</label>
36
+ <input type="text" id="node-input-password" placeholder="Password (Min 8 Chars)">
37
+ </div>
38
+
39
+ <hr>
40
+
41
+ <div class="form-row">
42
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
43
+ <input type="text" id="node-input-name" placeholder="Name">
44
+ </div>
45
+ </script>
46
+
47
+ <script type="text/javascript">
48
+ RED.nodes.registerType('mobius change admin password',{
49
+ category: 'mobius',
50
+ defaults: {
51
+ name: {value:""},
52
+ password: {value:"", validate:function(v) {
53
+ if (v.length < 8) {
54
+ return false;
55
+ } else {
56
+ return true;
57
+ }
58
+ }},
59
+ connection: {type:"mobius connection", required:true}
60
+ },
61
+ color:"#6a8cc8",
62
+ inputs:1,
63
+ outputs:0,
64
+ icon: "mobius.png",
65
+ align: "right",
66
+ paletteLabel: 'change admin password',
67
+ label: 'Change Admin Password',
68
+ labelStyle: function() {
69
+ return this.name ? "node_label_italic":"";
70
+ },
71
+ });
72
+ </script>
73
+
74
+ <script type="text/x-red" data-help-name="mobius change admin password">
75
+ <p>Set MOBiUS admin password.</p>
76
+
77
+ <h3>Configuration Page</h3>
78
+ <dl class="message-properties">
79
+ <dt>MOBiUS <span class="property-type">node</span></dt>
80
+ <dd>Shared MOBiUS connection for communication with the MOBiUS Hub.</dd>
81
+ <dt>Password <span class="property-type">string</span></dt>
82
+ <dd>The new admin passsord (must be at least 8 characters).</dd>
83
+ </dl>
84
+
85
+ <h3>Inputs</h3>
86
+ <ol class="node-ports">
87
+ <li>Input message to trigger changes of password
88
+ <dl class="message-properties">
89
+ <dt class="optional">payload.passsword <span class="property-type">string</span></dt>
90
+ <dd>An optional property that overwrites the new password set in the node configuration page.
91
+ If the property is not valid (less than 8 characters) no action is taken.</dd>
92
+ </dl>
93
+ </li>
94
+ </ol>
95
+
96
+ <br>
97
+ <p align="center" style="color:#000080">mobiusflow © 2023</p>
98
+ </script>
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ /**
3
+ Copyright (C) 2016, IAConnects Technology Limited
4
+ All Rights Reserved
5
+
6
+ ALL INFORMATION CONTAINED HEREIN IS, AND REMAINS
7
+ THE PROPERTY OF IACONNECTS TECHNOLOGY LIMITED AND ITS SUPPLIERS,
8
+ IF ANY. THE INTELLECTUAL AND TECHNICAL CONCEPTS CONTAINED
9
+ HEREIN ARE PROPRIETARY TO IACONNECTS TECHNOLOGY LIMITED
10
+ AND ITS SUPPLIERS AND ARE PROTECTED BY TRADE SECRET OR COPYRIGHT LAW.
11
+ DISSEMINATION OF THIS INFORMATION OR REPRODUCTION OF THIS MATERIAL
12
+ IS STRICTLY FORBIDDEN UNLESS PRIOR WRITTEN PERMISSION IS OBTAINED
13
+ FROM IACONNECTS TECHNOLOGY LIMITED.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
19
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
+ POSSIBILITY OF SUCH DAMAGE.
26
+ **/
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ module.exports = function (RED) {
29
+ RED.nodes.registerType('mobius change admin password', function (n) {
30
+ RED.nodes.createNode(this, n);
31
+ let node = (() => {
32
+ this['password'] = n.password;
33
+ this['serviceConn'] = RED.nodes.getNode(n.connection);
34
+ return this;
35
+ })();
36
+ if (node.serviceConn) {
37
+ node.status({
38
+ fill: 'red',
39
+ shape: 'ring',
40
+ text: 'Disconnected',
41
+ });
42
+ node.on('input', function (msg) {
43
+ let password = node.password;
44
+ if (msg.hasOwnProperty('payload')) {
45
+ if (msg.payload.hasOwnProperty('password')) {
46
+ password = msg.payload.password;
47
+ }
48
+ }
49
+ if (password.length < 8) {
50
+ node.error('Password provided must be at least 8 characters long');
51
+ return;
52
+ }
53
+ if (password) {
54
+ node.status({
55
+ fill: 'green',
56
+ shape: 'ring',
57
+ text: 'Busy',
58
+ });
59
+ node.serviceConn.changeAdminPassword(password, (err, response) => {
60
+ if (err) {
61
+ node.status({
62
+ fill: 'yellow',
63
+ shape: 'dot',
64
+ text: 'Error: ' + JSON.stringify(err.code),
65
+ });
66
+ node.error('Mobius error setting admin password ' + JSON.stringify(err));
67
+ }
68
+ else {
69
+ node.status({
70
+ fill: 'green',
71
+ shape: 'dot',
72
+ text: 'Admin password changed (use on next login)',
73
+ });
74
+ }
75
+ });
76
+ }
77
+ });
78
+ node.serviceConn.register(node);
79
+ node.on('close', function (done) {
80
+ node.serviceConn.deregister(node, done);
81
+ });
82
+ }
83
+ else {
84
+ node.error(RED._('Mobius service not defined'));
85
+ }
86
+ });
87
+ };
@@ -29,10 +29,16 @@ POSSIBILITY OF SUCH DAMAGE.
29
29
  <label for="node-input-connection"><i class="fa fa-globe"></i> MOBiUS</label>
30
30
  <input type="text" id="node-input-connection">
31
31
  </div>
32
- <div class="form-row">
33
- <label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
34
- <input type="text" id="node-input-resource" placeholder="Resource URI (hid/sid/pid/ins/rid)">
32
+ <hr>
33
+
34
+ <div id="instance-row">
35
+ <div class="form-row" id="input-row">
36
+ <label for="node-input-resource"><i class="fa fa-tasks"></i> URI</label>
37
+ <input type="text" id="node-input-resource" style="width:61%;" placeholder="Resource URI (hid/sid/pid/ins/rid)">
38
+ </div>
35
39
  </div>
40
+ <div id="mobsearch"></div>
41
+
36
42
  <div class="form-row">
37
43
  <label for="node-input-priority"><i class="fa fa-exclamation-triangle"></i> Priority</label>
38
44
  <input type="text" id="node-input-priority" placeholder="Priotity to clear">
@@ -41,6 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
41
47
  <label>&nbsp;</label>
42
48
  <input type="checkbox" id="node-input-detailedOutput" style="display: inline-block; width: auto; vertical-align: top;">
43
49
  <label for="node-input-detailedOutput" style="width: 70%;"> Use detailed outputs</label>
50
+ <input type="hidden" id="node-input-outputs"/>
44
51
  </div>
45
52
  <hr>
46
53
  <div class="form-row">
@@ -49,6 +56,8 @@ POSSIBILITY OF SUCH DAMAGE.
49
56
  </div>
50
57
  </script>
51
58
 
59
+ <script src="common/mobsearch.js"></script>
60
+
52
61
  <script type="text/javascript">
53
62
  RED.nodes.registerType('mobius clear resource',{
54
63
  category: 'mobius',
@@ -66,11 +75,12 @@ POSSIBILITY OF SUCH DAMAGE.
66
75
  return false;
67
76
  }},
68
77
  priority: {value:15, type: 'Number', validate:function(v) { return (v > 0 && v < 16) }},
69
- connection: {type:"mobius connection", required:true}
78
+ connection: {type:"mobius connection", required:true},
79
+ outputs: {value:2},
70
80
  },
71
81
  color:"#8abff5",
72
82
  inputs:1,
73
- outputs:2,
83
+ outputs: 2,
74
84
  outputLabels: function (index) {
75
85
  if(index === 0) return ("Resource's PV");
76
86
  if(index === 1) return ("Resource's PV and name");
@@ -90,13 +100,28 @@ POSSIBILITY OF SUCH DAMAGE.
90
100
  labelStyle: function() {
91
101
  return this.name ? "node_label_italic":"";
92
102
  },
93
- oneditsave: function() {
94
- if($("#node-input-detailedOutput").prop('checked')) {
95
- this.outputs = 4;
96
- } else {
97
- this.outputs = 2;
98
- }
99
- }
103
+ oneditprepare: function () {
104
+ $("#node-input-outputs").val(this.detailedOutput ? 4 : 2);
105
+ $("#node-input-detailedOutput").change(function() {
106
+ $("#node-input-outputs").val(this.checked ? 4 : 2);
107
+ });
108
+ var node = this;
109
+ let mobiusSrvc = $("#node-input-connection").val();
110
+
111
+ opts = {
112
+ htmlElementId: 'mobsearch',
113
+ uriFieldName: 'node-input-resource',
114
+ inputRowId: 'input-row',
115
+ };
116
+ initMobsearch.toRid(mobiusSrvc, opts);
117
+ },
118
+ // oneditsave: function() {
119
+ // if($("#node-input-detailedOutput").prop('checked')) {
120
+ // this.outputs = 4;
121
+ // } else {
122
+ // this.outputs = 2;
123
+ // }
124
+ // }
100
125
  });
101
126
  </script>
102
127
 
@@ -28,19 +28,18 @@
28
28
  'use strict';
29
29
 
30
30
  module.exports = function (RED) {
31
- function MobiusClearResourceNode (n) {
31
+ function MobiusClearResourceNode(n) {
32
32
  RED.nodes.createNode(this, n);
33
33
  this.detailedOutput = n.detailedOutput;
34
34
  this.resource = n.resource;
35
35
  this.priority = n.priority;
36
36
  this.serviceConn = RED.nodes.getNode(n.connection);
37
37
  var node = this;
38
-
39
38
  if (node.serviceConn) {
40
39
  node.status({
41
40
  fill: 'red',
42
41
  shape: 'ring',
43
- text: 'Disconnected'
42
+ text: 'Disconnected',
44
43
  });
45
44
 
46
45
  node.on('input', function (msg) {
@@ -57,7 +56,7 @@ module.exports = function (RED) {
57
56
  node.status({
58
57
  fill: 'green',
59
58
  shape: 'ring',
60
- text: 'Busy'
59
+ text: 'Busy',
61
60
  });
62
61
 
63
62
  node.serviceConn.clearResourcePriority(uri, pri, (err, response) => {
@@ -65,29 +64,34 @@ module.exports = function (RED) {
65
64
  node.status({
66
65
  fill: 'yellow',
67
66
  shape: 'dot',
68
- text: 'Error: ' + JSON.stringify(err.code)
67
+ text: 'Error: ' + JSON.stringify(err.code),
69
68
  });
70
69
  node.error('Mobius error clearing resource priority ' + JSON.stringify(err));
71
70
  if (node.detailedOutput === true) {
72
- node.send([null, null, null, {topic: uri, payload: { error: true, response: err }}]);
71
+ node.send([
72
+ null,
73
+ null,
74
+ null,
75
+ { topic: uri, payload: { error: true, response: err } },
76
+ ]);
73
77
  }
74
78
  } else {
75
79
  node.status({
76
80
  fill: 'green',
77
81
  shape: 'dot',
78
- text: JSON.stringify(response.value.pv)
82
+ text: JSON.stringify(response.data.pv),
79
83
  });
80
84
  if (node.detailedOutput === true) {
81
85
  node.send([
82
- { topic: uri, payload: response.value.pv },
83
- { topic: uri, payload: { pv: response.value.pv, name: response.value.name } },
84
- { topic: uri, payload: response.value },
85
- { topic: uri, payload: { error: false, response: response } }
86
+ { topic: uri, payload: response.data.pv },
87
+ { topic: uri, payload: { pv: response.data.pv, name: response.data.name } },
88
+ { topic: uri, payload: response.data },
89
+ { topic: uri, payload: { error: false, response: response } },
86
90
  ]);
87
91
  } else {
88
92
  node.send([
89
- { topic: uri, payload: response.value.pv },
90
- { topic: uri, payload: { pv: response.value.pv, name: response.value.name } }
93
+ { topic: uri, payload: response.data.pv },
94
+ { topic: uri, payload: { pv: response.data.pv, name: response.data.name } },
91
95
  ]);
92
96
  }
93
97
  }
@@ -0,0 +1,45 @@
1
+ export interface NodeInterface {
2
+ on(type: 'input', callback: (msg: any, done?: any) => void): any;
3
+ on(type: 'close', callback: (done?: any) => void): any;
4
+ send(msg: any): any;
5
+ status(status: any): void;
6
+ log(msg: string): any;
7
+ warn(msg: string): any;
8
+ error(msg: string): any;
9
+ }
10
+ export interface MobiusConnectionInterface {
11
+ host: string;
12
+ port: number;
13
+ username: string;
14
+ password: string;
15
+ secure: boolean;
16
+ connected: boolean;
17
+ register(node: any): void;
18
+ deregister(node: any, done: () => void): void;
19
+ discover(uri: string, callback: (err: any, response: any) => void): void;
20
+ writeResourceValue(uri: string, value: string, callback: (err: any, response: any) => void): void;
21
+ writeMultiResourceValue(uri: string, updates: {
22
+ r: string;
23
+ p: number;
24
+ v: string | number | boolean;
25
+ }[], callback: (err: any, response: any) => void): void;
26
+ clearResourcePriority(uri: string, priority: number, callback: (err: any, response: any) => void): void;
27
+ readResource(uri: string, callback: (err: any, response: any) => void): void;
28
+ readObject(uri: string, callback: (err: any, response: any) => void): void;
29
+ filterObjectsByRidValue(uri: string, pids: string[], linit: number, func: Function, callback: (err: any, response: any) => void): void;
30
+ changeAdminPassword(password: string, callback: (err: any, response: string) => void): void;
31
+ subscribeToCov(uri: string, ref: string, callback: (err: any, response: any) => void): void;
32
+ unsubscribeToCov(uri: string, ref: string, callback: (err: any, response: any) => void): void;
33
+ subscribeToObjectCOV(uri: string, ref: string, callback: (err: any, response: any) => void): void;
34
+ unsubscribeToObjectCOV(uri: string, ref: string, callback: (err: any, response: any) => void): void;
35
+ subscribeToBCMD(uri: string, ref: string, callback: (err: any, response: any) => void): void;
36
+ unsubscribeToBCMD(uri: string, ref: string, callback: (err: any, response: any) => void): void;
37
+ sendBroadcastCommand(cid: string, commandData: any): void;
38
+ sendDirectCommand(uri: string, cid: string, timeout: number, callback: (err: any, response: any) => void): void;
39
+ getServiceConfig(hid: string, sid: string, callback: (err: any, response: any) => void): void;
40
+ updateObjectInServiceConfig(hid: string, sid: string, pid: string, ins: string, config: any, callback: (err: any, response: any) => void): void;
41
+ getNodeConfig(uri: string, callback: (err: any, response: any) => void): void;
42
+ }
43
+ export interface ServiceConn {
44
+ serviceConn: MobiusConnectionInterface;
45
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -26,28 +26,50 @@ POSSIBILITY OF SUCH DAMAGE.
26
26
 
27
27
  <script type="text/x-red" data-template-name="mobius connection">
28
28
  <div class="form-row">
29
- <label for="node-config-input-host"><i class="fa fa-globe"></i> Host</label>
29
+ <div style="white-space: nowrap; display: inline-block;"><label for="node-config-input-host" style="width: 100px;" ><i class="fa fa-globe"></i> Host <span id="hostLabel" style="color: grey;">?</span></label></div>
30
30
  <input class="input-append-left" type="text" id="node-config-input-host" placeholder="e.g. localhost" style="width: 40%;" >
31
31
  <label for="node-config-input-port" style="margin-left: 10px; width: 35px; "> Port</label>
32
32
  <input type="text" id="node-config-input-port" placeholder="1890" style="width:50px">
33
33
  </div>
34
34
  <div class="form-row">
35
- <label for="node-config-input-psk"><i class="fa fa-key"></i> PSK</label>
36
- <input type="text" id="node-config-input-psk" placeholder="Pre-shared key">
35
+ <label for="node-config-input-username"><i class="fa fa-user"></i> Username</label>
36
+ <input class="input-append-left" type="text" id="node-config-input-username" style="width: 40%;" >
37
+ </div>
38
+ <div class="form-row">
39
+ <label for="node-config-input-password"><i class="fa fa-key"></i> Password</label>
40
+ <input class="input-append-left" type="text" id="node-config-input-password" style="width: 40%;" >
41
+ </div>
42
+ <div class="form-row">
43
+ <label for="node-config-input-secure" style="width: 100px;"> Use SSL/TLS</label>
44
+ <input type="checkbox" id="node-config-input-secure" style="display: inline-block; width: auto; vertical-align: top;">
45
+
37
46
  </div>
38
47
  </script>
39
48
 
40
49
  <script type="text/javascript">
50
+ hostLabel = 'test';
41
51
  RED.nodes.registerType('mobius connection', {
42
52
  category: 'config',
43
53
  defaults: {
44
- host: {required: true, value: 'localhost'},
45
- port: {required: true, value: 1890, validate: RED.validators.number()},
46
- psk: {required: true}
54
+ host: { required: true, value: 'localhost' },
55
+ port: { required: true, value: 8443, validate: RED.validators.number() },
56
+ username: { required: true, value: 'admin' },
57
+ password: { required: true, value: 'adm123' },
58
+ secure: { required: true, value: true },
47
59
  },
48
- label: function() {
60
+ label: function () {
49
61
  return `${this.host}:${this.port}`;
50
- }
62
+ },
63
+ oneditprepare: function () {
64
+ $('#node-config-input-secure').change(function () {
65
+ let secure = $('#node-config-input-secure').is(':checked');
66
+ if (secure) {
67
+ document.getElementById('hostLabel').innerHTML = 'https://';
68
+ } else {
69
+ document.getElementById('hostLabel').innerHTML = 'http://';
70
+ }
71
+ });
72
+ },
51
73
  });
52
74
  </script>
53
75