Skip to content

Commit 2bc5520

Browse files
committed
Italic label when name set
1 parent 58bc048 commit 2bc5520

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

arduino-cloud.html

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@
1313
return (v !== null && v !== "" && v !== undefined && Number.isInteger(parseInt(v)) && parseInt(v) !== 0);
1414
}
1515

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+
};
2425

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 };
2728
ret['timeWindowUnit'] = { value: '3600', required: true };
2829
}
2930
return ret;
@@ -41,6 +42,9 @@
4142
label: function () {
4243
return this.name || labelName;
4344
},
45+
labelStyle: function () {
46+
return this.name ? "node_label_italic" : "";
47+
},
4448
paletteLabel: labelName,
4549
oneditprepare: function () {
4650
if (this.connection && this.connection !== "_ADD_") {
@@ -52,9 +56,9 @@
5256
const thing_id = $("#node-input-thing").val();
5357
$("select#node-input-thing").empty();
5458
$("select#node-input-property").empty();
55-
if(connection === "_ADD_") {
59+
if (connection === "_ADD_") {
5660
$("<option value='" + "" + "'> " + "No connection selected" + "</option>").appendTo("#node-input-thing");
57-
if(this.defaultname){
61+
if (this.defaultname) {
5862
$("#node-input-name").val("");
5963
}
6064
}
@@ -75,7 +79,7 @@
7579
} else {
7680
$("select#node-input-property").empty();
7781
$("<option value='" + "" + "'> " + "No thing selected" + "</option>").appendTo("#node-input-property");
78-
}
82+
}
7983
$("#node-input-property").trigger("change");
8084
});
8185
$("#node-input-property").change(() => {
@@ -277,7 +281,7 @@
277281
</script>
278282
<script type="text/x-red" data-help-name="property out">
279283
<p>This node update a specific Arduino IoT Cloud property with the value received in input</p>
280-
</script>
284+
</script>
281285

282286
<script type="text/x-red" data-template-name="property in hist">
283287
<div class="form-row">

0 commit comments

Comments
 (0)