Implemented READLOGFILE client-side

This commit is contained in:
Carlos 2020-02-22 18:06:26 +01:00
parent 8ebac6a33d
commit b7e1478991
7 changed files with 42 additions and 35 deletions

View File

@ -230,6 +230,10 @@
<input type="checkbox" class="custom-control-input" id="showDateSettingsSwitch">
<label class="custom-control-label" for="showDateSettingsSwitch" id="showDateSettingsSwitchLabel">Show date and time on each console line</label>
</div>
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="readLogFileSwitch">
<label class="custom-control-label" for="readLogFileSwitch" id="readLogFileSwitchLabel">Retrieve full log file from server after login</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="settingsModalCloseButton">Done</button>
@ -241,7 +245,7 @@
<!-- Webpage footer -->
<footer class="footer mt-auto py-3">
<div class="container">
<span class="text-muted">WebConsole v1.4 (rev. 6) - <a href="https://github.com/mesacarlos/WebConsole">GitHub</a></span>
<span class="text-muted">WebConsole v1.5 - <a href="https://github.com/mesacarlos/WebConsole">GitHub</a></span>
</div>
</footer>
@ -251,11 +255,11 @@
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- WebConsole JS Scripts -->
<script src="scripts/WebConsoleLanguage.js?v=1.4.6"></script>
<script src="scripts/WebConsoleConnector.js?v=1.4.6"></script>
<script src="scripts/WebConsoleManager.js?v=1.4.6"></script>
<script src="scripts/WebConsolePersistenceManager.js?v=1.4.6"></script>
<script src="scripts/WebConsole.js?v=1.4.6"></script>
<script src="scripts/WebConsoleJqueryHandler.js?v=1.4.6"></script>
<script src="scripts/WebConsoleLanguage.js?v=1.5.0"></script>
<script src="scripts/WebConsoleConnector.js?v=1.5.0"></script>
<script src="scripts/WebConsoleManager.js?v=1.5.0"></script>
<script src="scripts/WebConsolePersistenceManager.js?v=1.5.0"></script>
<script src="scripts/WebConsole.js?v=1.5.0"></script>
<script src="scripts/WebConsoleJqueryHandler.js?v=1.5.0"></script>
</body>
</html>

View File

@ -57,6 +57,10 @@ function onWebSocketsMessage(message){
case 200:
//Processed
writeToWebConsole(message.message);
if(connectionManager.activeConnection.isLogged === false){
connectionManager.activeConnection.isLogged = true;
connectionManager.askForLogs();
}
break;
case 400:
//Unknown Command

View File

@ -13,6 +13,7 @@ class WebConsoleConnector {
this.messages = []; //All messages retrieved since connection start
this.commands = []; //EXEC Commands sent by user to this server
this.players = []; //Connected users.
this.isLogged = false; //Is logged in with valid pasword or not
}
/**

View File

@ -195,6 +195,7 @@ $("#disconnectionModalWelcomeScreenButton").click(function() {
$("#settingsLink").click(function() {
//Update modal switches and boxes with saved settings
$("#showDateSettingsSwitch").prop("checked", persistenceManager.getSetting("dateTimePrefix"));
$("#readLogFileSwitch").prop("checked", persistenceManager.getSetting("retrieveLogFile"));
});
/**
@ -203,4 +204,12 @@ $("#settingsLink").click(function() {
$("#showDateSettingsSwitch").click(function() {
//Update modal switches and boxes with saved settings
persistenceManager.setSetting("dateTimePrefix", $("#showDateSettingsSwitch").is(":checked"));
});
/**
* On readLogFileSwitch switched
*/
$("#readLogFileSwitch").click(function() {
//Update modal switches and boxes with saved settings
persistenceManager.setSetting("retrieveLogFile", $("#readLogFileSwitch").is(":checked"));
});

View File

@ -38,6 +38,7 @@ function setLanguage(locale){
"settingsLink": "Settings",
"settingsModalLongTitle": "WebConsole Settings",
"showDateSettingsSwitchLabel": "Show date and time on each console line",
"readLogFileSwitchLabel": "Retrieve full log file from server after login",
"settingsModalCloseButton": "Done",
"players_online": "Players Online",
"cpu_title": "CPU",
@ -75,6 +76,7 @@ function setLanguage(locale){
"settingsLink": "Configuración",
"settingsModalLongTitle": "Configuración de WebConsole",
"showDateSettingsSwitchLabel": "Mostrar fecha y hora en cada linea de consola",
"readLogFileSwitchLabel": "Leer log completo al iniciar sesión",
"settingsModalCloseButton": "Hecho",
"players_online": "Jugadores en línea",
"cpu_title": "CPU",
@ -112,6 +114,7 @@ function setLanguage(locale){
"settingsLink": "настройки",
"settingsModalLongTitle": "настройки WebConsole",
"showDateSettingsSwitchLabel": "Показать дату и время в каждой строке консоли",
"readLogFileSwitchLabel": "Получить полный файл журнала с сервера после входа в систему",
"settingsModalCloseButton": "Выполнено",
"players_online": "Игроки",
"cpu_title": "CPU",
@ -149,6 +152,7 @@ function setLanguage(locale){
"settingsLink": "Configurações",
"settingsModalLongTitle": "Configurações do WebConsole",
"showDateSettingsSwitchLabel": "Mostrar data e hora em cada linha do console",
"readLogFileSwitchLabel": "Recuperar arquivo de log completo do servidor após o login",
"settingsModalCloseButton": "Feito",
"players_online": "Jogadores online",
"cpu_title": "Consumo de CPU",
@ -186,6 +190,7 @@ function setLanguage(locale){
"settingsLink": "设定值",
"settingsModalLongTitle": "WebConsole 设定值",
"showDateSettingsSwitchLabel": "在每个控制台行上显示日期和时间",
"readLogFileSwitchLabel": "登录后从服务器检索完整的日志文件",
"settingsModalCloseButton": "完成",
"players_online": "在线人数",
"cpu_title": "CPU",
@ -223,6 +228,7 @@ function setLanguage(locale){
"settingsLink": "Réglages",
"settingsModalLongTitle": "Réglages de WebConsole",
"showDateSettingsSwitchLabel": "Afficher la date et l'heure sur chaque ligne de console",
"readLogFileSwitchLabel": "Récupérer le fichier journal complet du serveur après la connexion",
"settingsModalCloseButton": "Terminé",
"players_online": "Joueurs en ligne",
"cpu_title": "Utilisation de la CPU",
@ -260,6 +266,7 @@ function setLanguage(locale){
"settingsLink": "Nastavení",
"settingsModalLongTitle": "Nastavení WebConsole",
"showDateSettingsSwitchLabel": "Zobrazit datum a čas na každé řádce konzoly",
"readLogFileSwitchLabel": "Po přihlášení načtěte úplný soubor protokolu ze serveru",
"settingsModalCloseButton": "Hotovo",
"players_online": "Počet hráčů online",
"cpu_title": "CPU",
@ -281,31 +288,4 @@ function setLanguage(locale){
}
});
// document.getElementById("navbarHomeLink").textContent = lang.navbarHomeLink;
// document.getElementById("home_header").textContent = lang.home_header;
// document.getElementById("home_description").textContent = lang.home_description;
// document.getElementById("serversDropdown").textContent = lang.serversDropdown;
// document.getElementById("add_server").textContent = lang.add_server;
// document.getElementById("lang_dropdown").textContent = lang.lang_dropdown;
// document.getElementById("addServerModalLongTitle").textContent = lang.addServerModalLongTitle;
// document.getElementById("addServerModalSvName").textContent = lang.addServerModalSvName;
// document.getElementById("addServerModalSvIp").textContent = lang.addServerModalSvIp;
// document.getElementById("addServerModalSvPort").textContent = lang.addServerModalSvPort;
// document.getElementById("addServerModalSvSsl").textContent = lang.addServerModalSvSsl;
// document.getElementById("addServerModalSslAdvice").textContent = lang.addServerModalSslAdvice;
// document.getElementById("addServerModalClose").textContent = lang.addServerModalClose;
// document.getElementById("saveAndConnectServerButton").textContent = lang.saveAndConnectServerButton;
// document.getElementById("passwordModalLongTitle").textContent = lang.passwordModalLongTitle;
// document.getElementById("passwordModalLabel").textContent = lang.passwordModalLabel;
// document.getElementById("passwordModalRememberLabel").textContent = lang.passwordModalRememberLabel;
// document.getElementById("passwordModalCloseButton").textContent = lang.passwordModalCloseButton;
// document.getElementById("passwordSendButton").textContent = lang.passwordSendButton;
// document.getElementById("disconnectionModalLongTitle").textContent = lang.disconnectionModalLongTitle;
// document.getElementById("disconnectionModalDescription").textContent = lang.disconnectionModalDescription;
// document.getElementById("disconnectionModalCloseButton").textContent = lang.disconnectionModalCloseButton;
// document.getElementById("players_online").textContent = lang.players_online;
// document.getElementById("cpu_title").textContent = lang.cpu_title;
// document.getElementById("ram_title").textContent = lang.ram_title;
// document.getElementById("deleteServerButton").textContent = lang.deleteServerButton;
// document.getElementById("sendCommandButton").textContent = lang.sendCommandButton;
}

View File

@ -79,5 +79,12 @@ class WebConsoleManager {
this.activeConnection.sendToServer("CPUUSAGE");
this.activeConnection.sendToServer("RAMUSAGE");
}
/**
* Asks server for full latest.log
*/
askForLogs(){
this.activeConnection.sendToServer("READLOGFILE");
}
}

View File

@ -135,8 +135,10 @@ class WebConsolePersistenceManager{
currentSettings = new Object();
}
//Setting array initialization. If you need to add more settings, add them here. Any object is valid as a value (not only bool)
var settings = {
dateTimePrefix : new Setting("dateTimePrefix", true)
dateTimePrefix : new Setting("dateTimePrefix", true),
retrieveLogFile : new Setting("retrieveLogFile", true)
}
//Set settings