0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-12-03 13:34:56 +01:00

Add dropdown menu to settings window for log level selection with appropriate warnings.

This commit is contained in:
Wouter R 2016-01-06 14:25:17 +01:00
parent 09fcdbea31
commit c2f5f890c7
4 changed files with 50 additions and 5 deletions

View File

@ -34,7 +34,8 @@ function SettingsWindow() {
var _networkPanel = new NetworkPanel();
var _networkAPI = new NetworkAPI();
var _restoreStateField
var _restoreStateField;
var _initialLogLevel;
var self = this;
@ -123,6 +124,7 @@ function SettingsWindow() {
_form.loadAllSettings(function(loadedSettings){
console.log("Settings:loaded settings: ",loadedSettings);
settings = loadedSettings;
_initialLogLevel = loadedSettings['system.log.level'];
_form.fillForm(settings);
$(document).trigger(SettingsWindow.SETTINGS_LOADED);
if(complete) complete();
@ -180,6 +182,23 @@ function SettingsWindow() {
this.openFileManager = function() {
location.href = "filemanager/"+location.search;
}
this.logLevelChanged = function(elem) {
var showHideAnimDuration = 100;
if (_initialLogLevel != elem.value) {
$('#logging-restart-warning').show(showHideAnimDuration);
} else {
$('#logging-restart-warning').hide(showHideAnimDuration);
}
switch (elem.value) {
case "info": case "verbose": case "bulk":
$('#logging-verbose-warning').show(showHideAnimDuration);
break;
default:
$('#logging-verbose-warning').hide(showHideAnimDuration);
}
}
}
/*************************

View File

@ -3,6 +3,16 @@
SETTINGS POPUP
*/
.warn-box {
color: #bb0;
border: 1px solid #bb0;
width: 99%;
border-radius: 5px;
margin: 7px 0;
padding: 2px;
display: none;
}
#popupSettings {
top: 0;
left: 0;

View File

@ -22,7 +22,7 @@
</li>
<li data-id="btnsPrevNext" data-button="Next" data-options="tipLocation:right;tipAdjustmentY:-25">
<h2>View saved doodles</h2>
<p>Use the buttons '<' and '>' to flip through all the saved doodles on your Wi-Fi box.</p>
<p>Use the buttons '&lt;' and '&gt;' to flip through all the saved doodles on your Wi-Fi box.</p>
</li>
<li data-id="btnOops" data-button="Next" data-options="tipLocation:right">
<h2>Oops</h2>

View File

@ -179,11 +179,27 @@
<input type="button" onclick="settingsWindow.downloadGcode()" name="downloadGcode" value="Download GCODE" class="button" id="downloadGcode"/>
<input type="button" onclick="settingsWindow.downloadSvg()" name="downloadSvg" value="Download SVG" class="button" id="downloadSvg"/>
</fieldset>
<fieldset id="debugPanel">
<legend>Debug</legend>
<input type="button" onclick="settingsWindow.downloadlogs()" name="downloadlogs" value="Download logs" class="button" id="downloadlogs"
/>
<label for="logLevel">Log level:</label>
<select id="logLevel" name="system.log.level" onchange="settingsWindow.logLevelChanged(this)">
<option value="" disabled="disabled" selected="selected">Please choose a log level</option>
<option value="quiet">Quiet</option>
<option value="error">Error</option>
<option value="warning">Warning</option>
<option value="info">Info</option>
<option value="verbose">Verbose</option>
<option value="bulk">Bulk</option>
</select><br/>
<div id="logging-restart-warning" class="warn-box">
Restart the wifibox for a new log level to take effect.
</div>
<div id="logging-verbose-warning" class="warn-box">
<em>Be careful</em>: when setting a log level higher than info, the Wifibox may quickly run out of memory, causing crashes and other unwanted behaviour.
</div>
<br/>
<input type="button" onclick="settingsWindow.downloadlogs()" name="downloadlogs" value="Download logs" class="button" id="downloadlogs"/>
</fieldset>
<fieldset id="restorePanel">