Skip to content

Commit 7426483

Browse files
show apikey when a remote server is configured
1 parent 74eaaa4 commit 7426483

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

sync-module/sync_view.php

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@
2121

2222
<div class="input-prepend input-append">
2323
<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>
2833
</div>
2934

3035
<!--
@@ -189,7 +194,7 @@ function syncList()
189194
async: true,
190195
success(result){
191196
if (result.success!=undefined) {
192-
alert(result.message)
197+
$(".alert").html(result.message);
193198
return false;
194199
}
195200
out=jsonfeedsTohtml(result);
@@ -231,6 +236,14 @@ function remoteLoad()
231236
if (subaction=="dashboards") {
232237
$(".dashboard-view").show();
233238
}
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+
}
234247
}
235248
},
236249
error(xhr) {
@@ -289,6 +302,11 @@ function remoteLoad()
289302
});
290303
});
291304

305+
$("#remote-change").click(function() {
306+
$("#login_auth").show();
307+
$("#apikey_div").hide();
308+
});
309+
292310
// ----------------------------------------------------------
293311
// Download Feeds
294312
// ----------------------------------------------------------

0 commit comments

Comments
 (0)