Skip to content

Commit 9f89684

Browse files
authored
fix: space_selector edit property (#46)
1 parent 4f0cb01 commit 9f89684

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

arduino-iot-cloud.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@
7474
oneditprepare: function () {
7575

7676
if (this.connection && this.connection !== "_ADD_") {
77-
initThings(this.connection, this._, this.thing,);
78-
initProperties(this.connection, this.thing, this.property, outs, this._);
77+
if (this.organization) {
78+
$("#node-input-organization").val(this.organization);
79+
}
80+
initThings(this.connection, this._, this.thing, this.organization);
81+
initProperties(this.connection, this.thing, this.organization, this.property, outs, this._);
7982
}
8083
$("select#node-input-connection").change((e) => {
8184
var msg = this._("arduino-iot-cloud.config.connection.placeholders.no-conn-selected");
@@ -97,9 +100,10 @@
97100
}
98101
}
99102
});
100-
$("#node-input-organization").focusout(() => {
103+
$("#node-input-organization").change(() => {
101104
const connection = $("#node-input-connection").val();
102105
const organization = $("#node-input-organization").val();
106+
this.organization = organization;
103107
if (connection === "_ADD_") {
104108
$("#node-input-organization").empty();
105109
str = this._("arduino-iot-cloud.config.connection.placeholders.no-conn-selected");

arduino-iot-cloud.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ module.exports = function (RED) {
2626
const connectionConfig = RED.nodes.getNode(config.connection);
2727
this.status({});
2828
this.lastValue = undefined;
29+
this.organization = config.organization;
2930
if (connectionConfig && config.thing !== "" && config.thing !== "0" && config.property !== "" && config.property !== "0") {
3031
try {
31-
3232
this.thing = config.thing;
3333
this.propertyId = config.property;
3434
this.propertyName = config.propname;
@@ -78,6 +78,7 @@ module.exports = function (RED) {
7878
this.arduinoRestClient = await connectionManager.getClientHttp(connectionConfig);
7979
if (this.arduinoRestClient){
8080
this.arduinoRestClient.openConnections++;
81+
this.organization = config.organization;
8182
this.thing = config.thing;
8283
this.propertyId = config.property;
8384
this.propertyName = config.name;
@@ -149,6 +150,7 @@ module.exports = function (RED) {
149150
if (this.arduinoRestClient){
150151
this.arduinoRestClient.openConnections++;
151152
if (config.thing !== "" && config.property !== "") {
153+
this.organization = config.organization;
152154
this.thing = config.thing;
153155
this.propertyId = config.property;
154156
this.propertyName = config.name;
@@ -242,6 +244,7 @@ module.exports = function (RED) {
242244
if (this.arduinoRestClient){
243245
this.arduinoRestClient.openConnections++;
244246
if (config.thing !== "" && config.property !== "") {
247+
this.organization = config.organization;
245248
this.thing = config.thing;
246249
this.propertyId = config.property;
247250
this.propertyName = config.name;
@@ -326,6 +329,7 @@ module.exports = function (RED) {
326329
this.arduinoRestClient = await connectionManager.getClientHttp(connectionConfig);
327330
if (this.arduinoRestClient){
328331
this.arduinoRestClient.openConnections++;
332+
this.organization = config.organization;
329333
this.thing = config.thing;
330334
this.propertyId = config.property;
331335
this.propertyName = config.name;

0 commit comments

Comments
 (0)