|
27 | 27 | ret['timeWindowCount'] = { value: 1, validate: validateTime };
|
28 | 28 | ret['timeWindowUnit'] = { value: '3600', required: true };
|
29 | 29 | }
|
| 30 | + |
| 31 | + if (nodeName === "property in"){ |
| 32 | + ret['variableName'] = {value: ""}; |
| 33 | + } |
| 34 | + |
30 | 35 | return ret;
|
31 | 36 | }
|
32 | 37 |
|
|
47 | 52 | },
|
48 | 53 | paletteLabel: labelName,
|
49 | 54 | oneditprepare: function () {
|
50 |
| - debugger; |
| 55 | + |
51 | 56 | if (this.connection && this.connection !== "_ADD_") {
|
52 | 57 | initThings(this.connection, this.thing);
|
53 | 58 | initProperties(this.connection, this.thing, this.property, outs);
|
54 | 59 | }
|
55 | 60 | $("select#node-input-connection").change((e) => {
|
56 |
| - debugger; |
| 61 | + |
57 | 62 | const connection = $("#node-input-connection").val();
|
58 | 63 | const thing_id = $("#node-input-thing").val();
|
59 | 64 | if (connection === "_ADD_") {
|
|
76 | 81 | const property_id = $("#node-input-property").val();
|
77 | 82 | const connection = $("#node-input-connection").val();
|
78 | 83 | const thing_text = $("#node-input-thing").find('option:selected').text()
|
79 |
| - debugger; |
| 84 | + |
80 | 85 | if (connection === "_ADD_") {
|
81 | 86 | $("select#node-input-property").empty();
|
82 | 87 | $("<option value='" + "" + "'> " + "No connection selected" + "</option>").appendTo("#node-input-property");
|
|
90 | 95 | $("select#node-input-property").empty();
|
91 | 96 | initProperties(connection, thing_id, undefined, outs);
|
92 | 97 | }
|
93 |
| - } |
| 98 | + } |
94 | 99 | });
|
95 | 100 | $("#node-input-property").change(() => {
|
96 | 101 | const property_name = $("#node-input-property").find('option:selected').text();
|
97 | 102 | const property_value = $("#node-input-property").find('option:selected').val();
|
98 |
| - debugger; |
99 |
| - if (property_name !== " " && property_name !== "" && property_value !== "" && property_value !== undefined && this.defaultname) { |
| 103 | + var variablename_property; |
| 104 | + if(nodeName === 'property in'){ |
| 105 | + variablename_property = $("#node-input-property").find('option:selected').attr("variablename"); |
| 106 | + } |
| 107 | + |
| 108 | + if (property_name !== " " && property_name !== "" && property_value !== "" && property_value !== undefined ) { |
100 | 109 | this.propname = property_name;
|
101 |
| - $("#node-input-name").val(property_name); |
| 110 | + if(nodeName === 'property in'){ |
| 111 | + this.variableName = variablename_property; |
| 112 | + } |
| 113 | + if(this.defaultname){ |
| 114 | + $("#node-input-name").val(property_name); |
| 115 | + } |
102 | 116 | }
|
103 | 117 | $("#node-input-name").trigger("change");
|
104 | 118 | });
|
|
138 | 152 | }
|
139 | 153 | }
|
140 | 154 | function initThings(connection, thing_id) {
|
141 |
| - debugger; |
142 | 155 | const queryString = prepareQueryString(connection);
|
143 | 156 | if (!queryString || queryString === "")
|
144 | 157 | return;
|
145 | 158 |
|
146 | 159 | $("select#node-input-thing").empty();
|
147 |
| - $("<option value='" + "updating" + "'> " + "" + "</option>").appendTo("#node-input-thing"); |
| 160 | + $("<option value='" + "updating" + "'> " + "" + "</option>").appendTo("#node-input-thing"); |
148 | 161 | $("select#node-input-thing").val("updating");
|
149 | 162 |
|
150 | 163 | $.getJSON(`things?${queryString}`, things => {
|
|
172 | 185 | });
|
173 | 186 | }
|
174 | 187 | function initProperties(connection, thing_id, property_id, outs) {
|
175 |
| - debugger; |
176 | 188 | let queryString = prepareQueryString(connection);
|
177 | 189 | if (!queryString || queryString === "")
|
178 | 190 | return;
|
|
181 | 193 | queryString = `${queryString}&thing_id=${thing_id}`;
|
182 | 194 |
|
183 | 195 | $("select#node-input-property").empty();
|
184 |
| - $("<option value='" + "updating" + "'> " + "" + "</option>").appendTo("#node-input-property"); |
| 196 | + $("<option value='" + "updating" + "'> " + "" + "</option>").appendTo("#node-input-property"); |
185 | 197 | $("select#node-input-property").val("updating");
|
186 | 198 |
|
187 | 199 | $.getJSON(`properties?${queryString}`, properties => {
|
|
195 | 207 | $("<option value='" + "" + "'> " + "Select a property" + "</option>").appendTo("#node-input-property");
|
196 | 208 | for (const p of properties) {
|
197 | 209 | if (outs > 0 || p.permission === "READ_WRITE")
|
198 |
| - $("<option value='" + p.id + "'>" + p.name + "</option>").appendTo("#node-input-property"); |
| 210 | + $("<option value='" + p.id + "' variablename='"+p.variable_name+"'>" + p.name + "</option>").appendTo("#node-input-property"); |
199 | 211 | }
|
200 | 212 | if (property_id !== undefined) {
|
201 | 213 | $("#node-input-property").val(property_id);
|
|
0 commit comments