Skip to content

Commit

Permalink
show apikey when a remote server is configured
Browse files Browse the repository at this point in the history
  • Loading branch information
TrystanLea committed Nov 4, 2023
1 parent 74eaaa4 commit 7426483
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions sync-module/sync_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@

<div class="input-prepend input-append">
<span class="add-on">Host</span><input id="remote-host" type="text" value="https://emoncms.org">
<span class="add-on">Username</span><input id="remote-username" type="text" style="width:150px" >
<span class="add-on">Password</span><input id="remote-password" type="password" style="width:150px" >
<span class="add-on">Apikey</span><input id="remote-apikey" type="text" style="width:250px" disabled >
<button id="remote-save" class="btn">Connect</button>
<span id="login_auth">
<span class="add-on">Username</span><input id="remote-username" type="text" style="width:150px" >
<span class="add-on">Password</span><input id="remote-password" type="password" style="width:150px" >
<button id="remote-save" class="btn">Connect</button>
</span>
<span id="apikey_div" style="display:none">
<span class="add-on">Apikey</span><input id="remote-apikey" type="text" style="width:250px" disabled >
<button id="remote-change" class="btn">Change</button>
</span>
</div>

<!--
Expand Down Expand Up @@ -189,7 +194,7 @@ function syncList()
async: true,
success(result){
if (result.success!=undefined) {
alert(result.message)
$(".alert").html(result.message);
return false;
}
out=jsonfeedsTohtml(result);
Expand Down Expand Up @@ -231,6 +236,14 @@ function remoteLoad()
if (subaction=="dashboards") {
$(".dashboard-view").show();
}

if (result.username==undefined && result.apikey_write!="") {
$("#login_auth").hide();
$("#apikey_div").show();
} else {
$("#login_auth").show();
$("#apikey_div").hide();
}
}
},
error(xhr) {
Expand Down Expand Up @@ -289,6 +302,11 @@ function remoteLoad()
});
});

$("#remote-change").click(function() {
$("#login_auth").show();
$("#apikey_div").hide();
});

// ----------------------------------------------------------
// Download Feeds
// ----------------------------------------------------------
Expand Down

0 comments on commit 7426483

Please sign in to comment.