From c83f8530f8df28cc570340adaa4edf68a2e02446 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Sun, 15 Mar 2020 19:16:27 +0100 Subject: [PATCH] emit/handle loggingEnded --- src/csui/LoggerUi.vue | 9 ++++++++- src/ext/uw-ui.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/csui/LoggerUi.vue b/src/csui/LoggerUi.vue index 738687e..8461e2d 100644 --- a/src/csui/LoggerUi.vue +++ b/src/csui/LoggerUi.vue @@ -203,7 +203,8 @@ export default { computed: { ...mapState([ 'uwLog', - 'showLogger' + 'showLogger', + 'loggingEnded', ]), }, watch: { @@ -220,6 +221,12 @@ export default { if (newValue) { this.getLoggerSettings(); } + }, + loggingEnded(newValue) { + console.log("is loggign ended?", newValue) + if (newValue) { + this.stopLogging(); + } } }, methods: { diff --git a/src/ext/uw-ui.js b/src/ext/uw-ui.js index 5ea85ab..c4bf579 100644 --- a/src/ext/uw-ui.js +++ b/src/ext/uw-ui.js @@ -22,7 +22,7 @@ class UwUi { this.commsHandlers = { 'show-logger': [() => this.showLogger()], 'hide-logger': [() => this.hideLogger()], - 'emit-logs' : [(message) => {console.log("emit logs received in uwui!", message); this.addLogs(message)}] + 'emit-logs' : [(message) => this.addLogs(message)] } } @@ -227,6 +227,13 @@ class UwUi { addLogs(message) { this.logger.appendLog(JSON.parse(message.payload)); + + // since this gets called _after_ logging has been finished, + // we also inform logger UI to save current settings + if (this.vueInitiated && this.vuexStore !== undefined) { + console.log("got add logs. payload:", message.payload); + this.vuexStore.dispatch('uw-logging-ended', true); + } } }