|
116 | 116 |
|
117 | 117 | <script type="text/javascript">
|
118 | 118 | function initThings(connection, thing_id) {
|
119 |
| - var clientid; |
120 |
| - var clientsecret; |
121 |
| - RED.nodes.eachConfig((c) => { |
122 |
| - if (c.type === "arduino-connection" && c.id === connection) { |
123 |
| - clientid = c.clientid; |
124 |
| - clientsecret = c.clientsecret; |
125 |
| - $.getJSON(`things?clientid=${clientid}&clientsecret=${clientsecret}` , things => { |
126 |
| - $("<option value='" + 0 + "'> " + "Select a thing" + "</option>").appendTo("#node-input-thing"); |
127 |
| - for (const t of things) { |
128 |
| - $("<option value='" + t.id + "'>" + t.name + "</option>").appendTo("#node-input-thing"); |
129 |
| - } |
130 |
| - if (thing_id) { |
131 |
| - $("#node-input-thing").val(thing_id); |
132 |
| - } |
133 |
| - }); |
| 119 | + $.getJSON(`things?connectionid=${connection}` , things => { |
| 120 | + $("<option value='" + 0 + "'> " + "Select a thing" + "</option>").appendTo("#node-input-thing"); |
| 121 | + for (const t of things) { |
| 122 | + $("<option value='" + t.id + "'>" + t.name + "</option>").appendTo("#node-input-thing"); |
| 123 | + } |
| 124 | + if (thing_id) { |
| 125 | + $("#node-input-thing").val(thing_id); |
134 | 126 | }
|
135 | 127 | });
|
136 | 128 | }
|
137 | 129 | function initProperties(connection, thing_id, property_id, outs) {
|
138 | 130 | if (thing_id === "" || thing_id === "0")
|
139 | 131 | return;
|
140 |
| - |
141 | 132 | $("#node-input-property").html("");
|
142 |
| - var clientid = ""; |
143 |
| - var clientsecret = ""; |
144 |
| - RED.nodes.eachConfig((c) => { |
145 |
| - if (c.type === "arduino-connection" && c.id === connection) { |
146 |
| - clientid = c.clientid; |
147 |
| - clientsecret = c.clientsecret; |
148 |
| - } |
149 |
| - }); |
150 |
| - $.getJSON(`properties?clientid=${clientid}&clientsecret=${clientsecret}&thing_id=${thing_id}` , properties => { |
| 133 | + $.getJSON(`properties?connectionid=${connection}&thing_id=${thing_id}` , properties => { |
151 | 134 | $("<option value='" + 0 + "'> " + "Select a property" + "</option>").appendTo("#node-input-property");
|
152 | 135 | for (const p of properties) {
|
153 | 136 | if (outs > 0 || p.permission === "READ_WRITE")
|
|
165 | 148 | category: 'config',
|
166 | 149 | defaults: {
|
167 | 150 | applicationname: {value:"",required:true},
|
168 |
| - clientid: {value:"",required:true}, |
169 |
| - clientsecret: {value:"",required:true} |
| 151 | + }, |
| 152 | + credentials: { |
| 153 | + clientid: {type: "password"}, |
| 154 | + clientsecret: {type: "password"} |
170 | 155 | },
|
171 | 156 | label: function() {
|
172 | 157 | return this.applicationname || "";
|
|
176 | 161 | },
|
177 | 162 | oneditsave: function() {
|
178 | 163 | console.log("Application Name: " + this.applicationname);
|
179 |
| - console.log("Client ID: " + this.clientid); |
180 |
| - console.log("Client Secret: " + this.clientsecret); |
181 | 164 | }
|
182 | 165 | });
|
183 | 166 | </script>
|
|
188 | 171 | </div>
|
189 | 172 | <div class="form-row">
|
190 | 173 | <label for="node-config-input-clientid"><i class="icon-tag"></i> Client ID</label>
|
191 |
| - <input type="text" id="node-config-input-clientid" placeholder="Client ID"> |
| 174 | + <input type="password" id="node-config-input-clientid" placeholder="Client ID"> |
192 | 175 | </div>
|
193 | 176 | <div class="form-row">
|
194 | 177 | <label for="node-config-input-clientsecret"><i class="icon-tag"></i> Client secret</label>
|
195 |
| - <input type="text" id="node-config-input-clientsecret" placeholder="Client secret"> |
| 178 | + <input type="password" id="node-config-input-clientsecret" placeholder="Client secret"> |
196 | 179 | </div>
|
197 | 180 | </script>
|
198 | 181 | <script type="text/x-red" data-help-name="arduino-connection">
|
|
0 commit comments