Added a setting to toggle the emulator debug mode
* Added a setting to toggle the emulator debug mode
This commit is contained in:
@@ -106,7 +106,8 @@ namespace gaseous_server.Controllers
|
||||
}) + ";" + Environment.NewLine +
|
||||
"var AgeRatingGroups = " + JsonSerializer.Serialize(AgeGroups.AgeGroupingsFlat, new JsonSerializerOptions{
|
||||
WriteIndented = true
|
||||
}) + ";";
|
||||
}) + ";" + Environment.NewLine +
|
||||
"var emulatorDebugMode = " + Config.ReadSetting<string>("emulatorDebugMode", false.ToString()).ToLower() + ";";
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(ver);
|
||||
return File(bytes, "text/javascript");
|
||||
}
|
||||
@@ -251,7 +252,8 @@ namespace gaseous_server.Controllers
|
||||
{
|
||||
SystemSettingsModel systemSettingsModel = new SystemSettingsModel{
|
||||
AlwaysLogToDisk = Config.LoggingConfiguration.AlwaysLogToDisk,
|
||||
MinimumLogRetentionPeriod = Config.LoggingConfiguration.LogRetention
|
||||
MinimumLogRetentionPeriod = Config.LoggingConfiguration.LogRetention,
|
||||
EmulatorDebugMode = Boolean.Parse(Config.ReadSetting<string>("emulatorDebugMode", false.ToString()))
|
||||
};
|
||||
|
||||
return Ok(systemSettingsModel);
|
||||
@@ -269,6 +271,7 @@ namespace gaseous_server.Controllers
|
||||
{
|
||||
Config.LoggingConfiguration.AlwaysLogToDisk = model.AlwaysLogToDisk;
|
||||
Config.LoggingConfiguration.LogRetention = model.MinimumLogRetentionPeriod;
|
||||
Config.SetSetting<string>("emulatorDebugMode", model.EmulatorDebugMode.ToString());
|
||||
Config.UpdateConfig();
|
||||
}
|
||||
|
||||
@@ -705,5 +708,6 @@ namespace gaseous_server.Controllers
|
||||
{
|
||||
public bool AlwaysLogToDisk { get; set; }
|
||||
public int MinimumLogRetentionPeriod { get; set; }
|
||||
public bool EmulatorDebugMode { get; set; }
|
||||
}
|
||||
}
|
@@ -28,7 +28,7 @@
|
||||
// Path to the data directory
|
||||
EJS_pathtodata = '/emulators/EmulatorJS/data/';
|
||||
|
||||
EJS_DEBUG_XX = false;
|
||||
EJS_DEBUG_XX = emulatorDebugMode;
|
||||
console.log("Debug enabled: " + EJS_DEBUG_XX);
|
||||
|
||||
EJS_backgroundImage = emuBackground;
|
||||
|
@@ -16,8 +16,11 @@
|
||||
</table>
|
||||
<div style="text-align: right;"><button id="settings_tasktimers_default" onclick="defaultTaskTimers();">Reset to Default</button><button id="settings_tasktimers_new" onclick="saveTaskTimers();">Save</button></div>
|
||||
|
||||
<h3>Logging</h3>
|
||||
<h3>System Settings</h3>
|
||||
<table cellspacing="0" style="width: 100%;">
|
||||
<tr>
|
||||
<th colspan="2">Logging</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Write logs
|
||||
@@ -43,9 +46,16 @@
|
||||
<input type="number" min="1" id="settings_logs_retention" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Emulator</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Enable debug mode</th>
|
||||
<td><input type="checkbox" name="settings_emulator" id="settings_emulator_debug" checked="checked" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: right;">
|
||||
<button id="settings_tasktimers_new" onclick="setLoggingSettings();">Save</button>
|
||||
<button id="settings_tasktimers_new" onclick="setSystemSettings();">Save</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -379,7 +389,7 @@
|
||||
saveTaskTimers();
|
||||
}
|
||||
|
||||
function getLoggingSettings() {
|
||||
function getSystemSettings() {
|
||||
ajaxCall(
|
||||
'/api/v1/System/Settings/System',
|
||||
'GET',
|
||||
@@ -391,11 +401,13 @@
|
||||
document.getElementById(optionToSelect).checked = true;
|
||||
|
||||
document.getElementById('settings_logs_retention').value = result.minimumLogRetentionPeriod;
|
||||
|
||||
document.getElementById('settings_emulator_debug').checked = result.emulatorDebugMode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function setLoggingSettings() {
|
||||
function setSystemSettings() {
|
||||
var alwaysLogToDisk = false;
|
||||
if ($("input[type='radio'][name='settings_logs_write']:checked").val() == "true") {
|
||||
alwaysLogToDisk = true;
|
||||
@@ -411,17 +423,18 @@
|
||||
|
||||
var model = {
|
||||
"alwaysLogToDisk": alwaysLogToDisk,
|
||||
"minimumLogRetentionPeriod": retentionValue
|
||||
"minimumLogRetentionPeriod": retentionValue,
|
||||
"emulatorDebugMode": document.getElementById('settings_emulator_debug').checked
|
||||
};
|
||||
|
||||
ajaxCall(
|
||||
'/api/v1/System/Settings/System',
|
||||
'POST',
|
||||
function(result) {
|
||||
getLoggingSettings();
|
||||
getSystemSettings();
|
||||
},
|
||||
function(error) {
|
||||
getLoggingSettings();
|
||||
getSystemSettings();
|
||||
},
|
||||
JSON.stringify(model)
|
||||
);
|
||||
@@ -429,5 +442,5 @@
|
||||
|
||||
drawLibrary();
|
||||
getBackgroundTaskTimers();
|
||||
getLoggingSettings();
|
||||
getSystemSettings();
|
||||
</script>
|
Reference in New Issue
Block a user