-
Notifications
You must be signed in to change notification settings - Fork 0
/
rstat.html
73 lines (64 loc) · 2.38 KB
/
rstat.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<script type="text/x-red" data-template-name="rstat in">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-ip"><i class="fa fa-location-arrow"></i> IP Address</label>
<div style="display:inline-block; width:70%">
<input type="text" id="node-input-ip" placeholder="0.0.0.0" dir="" class="input-error" style="width:85%">
<div style="display:inline-block; width:12%">
<a id="node-input-ip-lookup" class="btn" style="width:100%;margin-left: 4px;right:0px;padding-left: 0px;padding-right: 0px;">
<i id="node-input-ip-lookup-icon" class="fa fa-search"></i>
</a>
</div>
</div>
</div>
</script>
<script type="text/x-red" data-help-name="rstat in">
<p>Rstat.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('rstat in', {
category: 'weather',
color: "#d8455d",
defaults: {
name: {
value: ""
},
ip: {
value: "",
required: true
}
},
inputs: 1,
outputs: 1,
icon: "rstat.png",
label: function() {
//var dbNode = RED.nodes.node(this.mydb);
return this.name || "Radio Thermostat";
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function() {
$("#node-input-ip-lookup").click(function() {
$("#node-input-ip-lookup").addClass('disabled');
$.getJSON('thermostats', function(data) {
$("#node-input-ip-lookup").removeClass('disabled');
var addr = [];
$.each(data, function(i, ip) {
addr.push(ip);
});
$("#node-input-ip").autocomplete({
source: addr,
minLength: 0,
close: function(event, ui) {
$("#node-input-ip").autocomplete("destroy");
}
}).autocomplete("search", "");
});
});
}
});
</script>