diff --git a/src/csui/LoggerUi.vue b/src/csui/LoggerUi.vue index 7cb51ca..c1a40ae 100644 --- a/src/csui/LoggerUi.vue +++ b/src/csui/LoggerUi.vue @@ -24,29 +24,41 @@
Paste logger configuration in this box
{{logStringified}}@@ -146,8 +158,7 @@ export default { this.header = headerRotation[Math.floor(+Date.now() / (3600000*24)) % headerRotation.length] || this.header; - this.lastSettings = await Logger.getConfig() || {}; - this.parsedSettings = JSON.stringify(this.lastSettings, null, 2) || ''; + this.getLoggerSettings(); }, computed: { ...mapState([ @@ -165,21 +176,30 @@ export default { async showLogger(newValue) { this.showLoggerUi = newValue; - // update logger settings + // update logger settings (they could have changed while the popup was closed) if (newValue) { - this.lastSettings = await Logger.getConfig() || {}; + this.getLoggerSettings(); } } }, methods: { + async getLoggerSettings() { + this.lastSettings = await Logger.getConfig() || {}; + this.parsedSettings = JSON.stringify(this.lastSettings, null, 2) || ''; + }, updateSettings(val) { try { - // this.settings.active = JSON.parse(val.target.textContent); + this.parsedSettings = JSON.stringify(JSON.parse(val.target.textContent.trim()), null, 2); + // this.lastSettings = JSON.parse(val.target.textContent.trim()); this.confHasError = false; } catch (e) { this.confHasError = true; } }, + restoreLoggerSettings() { + this.parsedSettings = JSON.stringify(this.lastSettings, null, 2); + this.confHasError = false; + }, async startLogging(){ this.logStringified = undefined; await Logger.saveConfig({...this.lastSettings, allowLogging: true}); @@ -200,6 +220,7 @@ export default { }, stopLogging() { Logger.saveConfig({...this.lastSettings, allowLogging: false}); + this.lastSettings.allowLogging = false; }, exportLog() { IO.csStringToFile(this.logStringified); @@ -337,4 +358,11 @@ pre { padding-right: 1em; } +.jsonbg { + background-color: #131313; +} +.jsonbg-error { + background-color: #884420; +} +