Now it is easier to add new servers to Web Interface. Updated README.

This commit is contained in:
Carlos
2019-08-15 16:10:20 +02:00
parent e869d3e581
commit 953877b0c2
3 changed files with 46 additions and 12 deletions

View File

@ -119,8 +119,16 @@
<input type="text" class="form-control" id="server-name">
</div>
<div class="form-group">
<label for="server-uri" class="col-form-label">Server URI:</label>
<input type="text" class="form-control" id="server-uri" placeholder="ws://localhost:8080">
<label for="server-ip" class="col-form-label">Server IP:</label>
<input type="text" class="form-control" id="server-ip" placeholder="ws://localhost:8080">
</div>
<div class="form-group">
<label for="server-port" class="col-form-label">Server port:</label>
<input type="text" class="form-control" id="server-port" placeholder="8080">
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="server-ssl">
<label class="form-check-label" for="server-ssl">Server is SSL enabled</label>
</div>
</form>
</div>
@ -187,7 +195,7 @@
<!-- Webpage footer -->
<footer class="footer mt-auto py-3">
<div class="container">
<span class="text-muted">WebConsole 1.1.0 - <a href="https://github.com/mesacarlos/WebConsole">GitHub</a></span>
<span class="text-muted">WebConsole v1.1 - <a href="https://github.com/mesacarlos/WebConsole">GitHub</a></span>
</div>
</footer>

View File

@ -18,12 +18,21 @@ $(document).ready(function() {
$("#saveAndConnectServerButton").click(function() {
//Save server
var name = $("#server-name").val();
var uri = $("#server-uri").val();
var wcIp = $("#server-ip").val();
var wcPort = $("#server-port").val();
var wcSsl = $("#server-ssl").prop('checked');
var uri;
if(wcSsl){
uri = "wss://" + wcIp + ":" + wcPort;
}else{
uri = "ws://" + wcIp + ":" + wcPort;
}
persistenceManager.saveServer(new WSServer(name, uri));
//Empty all modal values
$("#server-name").val("");
$("#server-uri").val("");
$("#server-ip").val("");
$("#server-port").val("");
//Update GUI serverlist
updateServerList();
@ -77,8 +86,24 @@ $('#passwordModal').on('hidden.bs.modal', function (e) {
* On send command button click
*/
$("#sendCommandButton").click(function() {
connectionManager.sendConsoleCmd($('#commandInput').val());
$('#commandInput').val('');
connectionManager.sendConsoleCmd($("#commandInput").val());
$("#commandInput").val('');
});
/**
* Enter key on command input
*/
$("#commandInput").on('keypress', function (e) {
if(e.which === 13){
//Disable textbox to prevent multiple submit
$(this).attr("disabled", "disabled");
//Send command
sendCommandButton.click();
//Enable the textbox again.
$(this).removeAttr("disabled");
}
});
/**
@ -95,4 +120,3 @@ $("#navbarHomeLink").click(function() {
backToHomepage();
});