emit/handle loggingEnded

This commit is contained in:
Tamius Han 2020-03-15 19:16:27 +01:00
parent e9795f4a00
commit c83f8530f8
2 changed files with 16 additions and 2 deletions

View File

@ -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: {

View File

@ -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);
}
}
}