|
21 | 21 |
|
22 | 22 | <div class="input-prepend input-append"> |
23 | 23 | <span class="add-on">Host</span><input id="remote-host" type="text" value="https://emoncms.org"> |
24 | | - <span class="add-on">Username</span><input id="remote-username" type="text" style="width:150px" > |
25 | | - <span class="add-on">Password</span><input id="remote-password" type="password" style="width:150px" > |
26 | | - <span class="add-on">Apikey</span><input id="remote-apikey" type="text" style="width:250px" disabled > |
27 | | - <button id="remote-save" class="btn">Connect</button> |
| 24 | + <span id="login_auth"> |
| 25 | + <span class="add-on">Username</span><input id="remote-username" type="text" style="width:150px" > |
| 26 | + <span class="add-on">Password</span><input id="remote-password" type="password" style="width:150px" > |
| 27 | + <button id="remote-save" class="btn">Connect</button> |
| 28 | + </span> |
| 29 | + <span id="apikey_div" style="display:none"> |
| 30 | + <span class="add-on">Apikey</span><input id="remote-apikey" type="text" style="width:250px" disabled > |
| 31 | + <button id="remote-change" class="btn">Change</button> |
| 32 | + </span> |
28 | 33 | </div> |
29 | 34 |
|
30 | 35 | <!-- |
@@ -189,7 +194,7 @@ function syncList() |
189 | 194 | async: true, |
190 | 195 | success(result){ |
191 | 196 | if (result.success!=undefined) { |
192 | | - alert(result.message) |
| 197 | + $(".alert").html(result.message); |
193 | 198 | return false; |
194 | 199 | } |
195 | 200 | out=jsonfeedsTohtml(result); |
@@ -231,6 +236,14 @@ function remoteLoad() |
231 | 236 | if (subaction=="dashboards") { |
232 | 237 | $(".dashboard-view").show(); |
233 | 238 | } |
| 239 | + |
| 240 | + if (result.username==undefined && result.apikey_write!="") { |
| 241 | + $("#login_auth").hide(); |
| 242 | + $("#apikey_div").show(); |
| 243 | + } else { |
| 244 | + $("#login_auth").show(); |
| 245 | + $("#apikey_div").hide(); |
| 246 | + } |
234 | 247 | } |
235 | 248 | }, |
236 | 249 | error(xhr) { |
@@ -289,6 +302,11 @@ function remoteLoad() |
289 | 302 | }); |
290 | 303 | }); |
291 | 304 |
|
| 305 | +$("#remote-change").click(function() { |
| 306 | + $("#login_auth").show(); |
| 307 | + $("#apikey_div").hide(); |
| 308 | +}); |
| 309 | + |
292 | 310 | // ---------------------------------------------------------- |
293 | 311 | // Download Feeds |
294 | 312 | // ---------------------------------------------------------- |
|
0 commit comments