-
Notifications
You must be signed in to change notification settings - Fork 1
/
mmg2-isolate.html
71 lines (59 loc) · 1.48 KB
/
mmg2-isolate.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
<script type="text/javascript">
const ISOLATION_OPTIONS = [
{ value: 1, label: "Reading"},
{ value: 2, label: "Relay"},
{ value: 3, label: "Switch"},
{ value: 4, label: "Timestamp"},
{ value: 5, label: "Hardware Faults"},
{ value: 6, label: "Serial Number"},
{ value: 7, label: "locationID" },
{ value: 8, label: "Service Classification" },
{ value: 9, label: "Device Type" }
],
getIsolationName = (id) => {
for (let a = 0; a < ISOLATION_OPTIONS.length; a += 1) {
if (ISOLATION_OPTIONS[a].value === parseInt(id)) {
return ISOLATION_OPTIONS[a].label;
}
}
return null;
};
RED.nodes.registerType(
"mmg2-isolate",
{
category: "MMG2",
color: "#E6EEF2",
defaults: {
isolate: {
value: 0
}
},
inputs: 2,
outputs: 1,
icon: "swap.svg",
label: function() {
return "Isolate: " + getIsolationName(this.isolate);
},
oneditprepare: () => {
let el = $("#node-input-isolate");
el.typedInput({
types: [
{
value: "isolate",
options: ISOLATION_OPTIONS
}
]
});
}
}
);
</script>
<script type="text/html" data-template-name="mmg2-isolate">
<div class="form-row">
<label for="node-input-isolate"><i class="fa fa-tag"></i> Field</label>
<input type="text" id="node-input-isolate">
</div>
</script>
<script type="text/html" data-help-name="mmg2-isolate">
<p>A simple node that extracts a single property from a reading set.</p>
</script>