-
Notifications
You must be signed in to change notification settings - Fork 2
/
webthingsio-gateway.html
54 lines (52 loc) · 2.64 KB
/
webthingsio-gateway.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<script type="text/javascript">
const script = document.createElement('script');
script.type = 'text/javascript';
// eslint-disable-next-line max-len
script.src = 'resources/node-red-contrib-webthingsio/webthingsio-client-core.js';
document.head.appendChild(script);
window.RED.nodes.registerType('webthingsio-gateway', {
category: 'config',
defaults: {
name: {value: '', required: false},
host: {value: 'localhost', required: true},
port: {
value: 8080,
required: true,
validate: window.RED.validators.number(),
},
https: {value: false, required: true},
accessToken: {value: '', required: true},
skipValidation: {value: false, required: true},
},
label: function() {
return this.name ||
`http${this.https ? 's' : ''}://${this.host}:${this.port}`;
},
});
</script>
<script type="text/html" data-template-name="webthingsio-gateway">
<div class="form-row">
<label for="node-config-input-name" data-i18n="webthingsio-gateway.labelName"><i class="fa fa-bookmark"></i></label>
<input type="text" id="node-config-input-name" data-i18n="[placeholder]webthingsio-gateway.placeholderName">
</div>
<div class="form-row">
<label for="node-config-input-host" data-i18n="webthingsio-gateway.labelHost"><i class="fa fa-bookmark"></i></label>
<input type="text" id="node-config-input-host" data-i18n="[placeholder]webthingsio-gateway.placeholderHost">
</div>
<div class="form-row">
<label for="node-config-input-port" data-i18n="webthingsio-gateway.labelPort"><i class="fa fa-bookmark"></i></label>
<input type="text" id="node-config-input-port" data-i18n="[placeholder]webthingsio-gateway.placeholderPort">
</div>
<div class="form-row">
<label for="node-config-input-https" data-i18n="webthingsio-gateway.labelHttps"><i class="fa fa-bookmark"></i></label>
<input type="checkbox" id="node-config-input-https">
</div>
<div class="form-row">
<label for="node-config-input-accessToken" data-i18n="webthingsio-gateway.labelAccessToken"><i class="fa fa-bookmark"></i></label>
<input type="text" id="node-config-input-accessToken" data-i18n="[placeholder]webthingsio-gateway.placeholderAccessToken">
</div>
<div class="form-row">
<label for="node-config-input-skipValidation" data-i18n="webthingsio-gateway.labelSkipValidation"><i class="fa fa-bookmark"></i></label>
<input type="checkbox" id="node-config-input-skipValidation">
</div>
</script>