|
13 | 13 | return (v !== null && v !== "" && v !== undefined && Number.isInteger(parseInt(v)) && parseInt(v) !== 0); |
14 | 14 | } |
15 | 15 |
|
16 | | - function getDefaults(nodeName){ |
17 | | - var ret={connection: { type: "arduino-connection", validate: validateConnection }, |
18 | | - thing: { value: "", validate: validator }, |
19 | | - property: { value: "", validate: validator }, |
20 | | - name: { value: "", validate: validator }, |
21 | | - propname: { value: "" }, |
22 | | - defaultname: { value: true } |
23 | | - }; |
| 16 | + function getDefaults(nodeName) { |
| 17 | + var ret = { |
| 18 | + connection: { type: "arduino-connection", validate: validateConnection }, |
| 19 | + thing: { value: "", validate: validator }, |
| 20 | + property: { value: "", validate: validator }, |
| 21 | + name: { value: "", validate: validator }, |
| 22 | + propname: { value: "" }, |
| 23 | + defaultname: { value: true } |
| 24 | + }; |
24 | 25 |
|
25 | | - if (nodeName === "property in hist" || nodeName === "property in poll"){ |
26 | | - ret['timeWindowCount'] = { value: 1, validate: validateTime}; |
| 26 | + if (nodeName === "property in hist" || nodeName === "property in poll") { |
| 27 | + ret['timeWindowCount'] = { value: 1, validate: validateTime }; |
27 | 28 | ret['timeWindowUnit'] = { value: '3600', required: true }; |
28 | 29 | } |
29 | 30 | return ret; |
|
41 | 42 | label: function () { |
42 | 43 | return this.name || labelName; |
43 | 44 | }, |
| 45 | + labelStyle: function () { |
| 46 | + return this.name ? "node_label_italic" : ""; |
| 47 | + }, |
44 | 48 | paletteLabel: labelName, |
45 | 49 | oneditprepare: function () { |
46 | 50 | if (this.connection && this.connection !== "_ADD_") { |
|
52 | 56 | const thing_id = $("#node-input-thing").val(); |
53 | 57 | $("select#node-input-thing").empty(); |
54 | 58 | $("select#node-input-property").empty(); |
55 | | - if(connection === "_ADD_") { |
| 59 | + if (connection === "_ADD_") { |
56 | 60 | $("<option value='" + "" + "'> " + "No connection selected" + "</option>").appendTo("#node-input-thing"); |
57 | | - if(this.defaultname){ |
| 61 | + if (this.defaultname) { |
58 | 62 | $("#node-input-name").val(""); |
59 | 63 | } |
60 | 64 | } |
|
75 | 79 | } else { |
76 | 80 | $("select#node-input-property").empty(); |
77 | 81 | $("<option value='" + "" + "'> " + "No thing selected" + "</option>").appendTo("#node-input-property"); |
78 | | - } |
| 82 | + } |
79 | 83 | $("#node-input-property").trigger("change"); |
80 | 84 | }); |
81 | 85 | $("#node-input-property").change(() => { |
|
277 | 281 | </script> |
278 | 282 | <script type="text/x-red" data-help-name="property out"> |
279 | 283 | <p>This node update a specific Arduino IoT Cloud property with the value received in input</p> |
280 | | -</script> |
| 284 | +</script> |
281 | 285 |
|
282 | 286 | <script type="text/x-red" data-template-name="property in hist"> |
283 | 287 | <div class="form-row"> |
|
0 commit comments