Skip to content

Commit e9f0081

Browse files
committed
Fixed bug of empty things list
1 parent a5f3061 commit e9f0081

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arduino-cloud.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,18 @@
4747
initThings(this.connection, this.thing);
4848
initProperties(this.connection, this.thing, this.property, outs);
4949
}
50-
$("select#node-input-connection").change(() => {
50+
$("select#node-input-connection").change((e) => {
5151
const connection = $("#node-input-connection").val();
52+
const thing_id = $("#node-input-thing").val();
5253
$("select#node-input-thing").empty();
5354
$("select#node-input-property").empty();
5455
if(connection === "_ADD_") {
55-
$("<option value='" + "" + "'> " + "Select a connection" + "</option>").appendTo("#node-input-thing");
56+
$("<option value='" + "" + "'> " + "No connection selected" + "</option>").appendTo("#node-input-thing");
5657
if(this.defaultname){
5758
$("#node-input-name").val("");
5859
}
5960
}
60-
if (this.connection !== connection && connection !== "_ADD_") {
61+
if ((this.connection !== connection && connection !== "_ADD_") || thing_id === "") {
6162
initThings(connection);
6263
}
6364
$("#node-input-thing").trigger("change");
@@ -70,15 +71,14 @@
7071
initProperties(connection, thing_id, undefined, outs);
7172
} else if (connection === "_ADD_") {
7273
$("select#node-input-property").empty();
73-
$("<option value='" + "" + "'> " + "Select a connection" + "</option>").appendTo("#node-input-property");
74+
$("<option value='" + "" + "'> " + "No connection selected" + "</option>").appendTo("#node-input-property");
7475
} else {
7576
$("select#node-input-property").empty();
76-
$("<option value='" + "" + "'> " + "Select a thing" + "</option>").appendTo("#node-input-property");
77+
$("<option value='" + "" + "'> " + "No thing selected" + "</option>").appendTo("#node-input-property");
7778
}
7879
$("#node-input-property").trigger("change");
7980
});
8081
$("#node-input-property").change(() => {
81-
debugger;
8282
const property_name = $("#node-input-property").find('option:selected').text();
8383
const property_value = $("#node-input-property").find('option:selected').val();
8484
if (property_name !== "" && property_value !== "" && property_value !== undefined && this.defaultname) {

0 commit comments

Comments
 (0)