Only show warning about verbose logging when level is set to verbose or bulk.

Small improvements to when log level warnings are shown.
This commit is contained in:
Wouter R 2016-01-06 16:38:59 +01:00
parent 25c51c3e5c
commit 46bcd54a1a
2 changed files with 21 additions and 8 deletions

View File

@ -35,7 +35,7 @@ function SettingsWindow() {
var _networkAPI = new NetworkAPI();
var _restoreStateField;
var _initialLogLevel;
var _initialLogLevel = undefined;
var self = this;
@ -124,7 +124,12 @@ function SettingsWindow() {
_form.loadAllSettings(function(loadedSettings){
console.log("Settings:loaded settings: ",loadedSettings);
settings = loadedSettings;
_initialLogLevel = loadedSettings['system.log.level'];
//only set the initial level once, to make behaviour of restart warning as correctly as possible
if (_initialLogLevel == undefined)
_initialLogLevel = loadedSettings['system.log.level'];
updateLogLevelWarningsVisibility();
_form.fillForm(settings);
$(document).trigger(SettingsWindow.SETTINGS_LOADED);
if(complete) complete();
@ -183,16 +188,24 @@ function SettingsWindow() {
location.href = "filemanager/"+location.search;
}
this.logLevelChanged = function(elem) {
this.logLevelChanged = function() {
updateLogLevelWarningsVisibility();
}
/***** LOCAL FUNCTIONS *****/
function updateLogLevelWarningsVisibility() {
var showHideAnimDuration = 100;
if (_initialLogLevel != elem.value) {
newLevel = $('#logLevel').val();
if (_initialLogLevel != newLevel) {
$('#logging-restart-warning').show(showHideAnimDuration);
} else {
$('#logging-restart-warning').hide(showHideAnimDuration);
}
switch (elem.value) {
case "info": case "verbose": case "bulk":
switch (newLevel) {
case "verbose": case "bulk":
$('#logging-verbose-warning').show(showHideAnimDuration);
break;
default:

View File

@ -183,7 +183,7 @@
<fieldset id="debugPanel">
<legend>Debug</legend>
<label for="logLevel">Log level:</label>
<select id="logLevel" name="system.log.level" onchange="settingsWindow.logLevelChanged(this)">
<select id="logLevel" name="system.log.level" onchange="settingsWindow.logLevelChanged()">
<option value="" disabled="disabled" selected="selected">Please choose a log level</option>
<option value="quiet">Quiet</option>
<option value="error">Error</option>
@ -193,7 +193,7 @@
<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.
Restart the wifibox for the 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.