Fix logger UI
This commit is contained in:
parent
dbc0c8c741
commit
f05f37841a
@ -486,10 +486,14 @@ class Logger {
|
||||
|
||||
saveViaBgScript() {
|
||||
console.info('[info] will attempt to save. Issuing "show-logger"');
|
||||
if (!this.conf?.fileOptions?.enabled || this.isBackgroundScript) {
|
||||
console.info('[info] Logging to file is either disabled or we\'re not on the content script. Not saving.');
|
||||
if (this.isBackgroundScript) {
|
||||
console.info('[info] Background script cannot display logger UI.');
|
||||
return;
|
||||
}
|
||||
// if (!this.conf?.fileOptions?.enabled) {
|
||||
// console.info('[info] Logging to file is disabled. Logger won\'t get shown.');
|
||||
// return;
|
||||
// }
|
||||
|
||||
Comms.sendMessage({cmd: 'show-logger', forwardToSameFramePort: true, port: 'content-ui-port'});
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// vue dependency imports
|
||||
import {createApp} from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
import { createApp } from 'vue';
|
||||
import { createStore } from 'vuex';
|
||||
import VuexWebExtensions from 'vuex-webextensions';
|
||||
import LoggerUi from '../csui/LoggerUi';
|
||||
|
||||
@ -124,18 +124,19 @@ class UwUi {
|
||||
}
|
||||
|
||||
try {
|
||||
Vue.prototype.$browser = global.browser;
|
||||
Vue.use(Vuex);
|
||||
|
||||
// Vue.prototype.$browser = global.browser;
|
||||
// Vue.use(Vuex);
|
||||
|
||||
this.vuexStore = new Vuex.Store({
|
||||
plugins: [VuexWebExtensions({
|
||||
persistentStates: [
|
||||
'uwLog',
|
||||
'showLogger',
|
||||
'loggingEnded',
|
||||
],
|
||||
})],
|
||||
this.vuexStore = createStore({
|
||||
plugins: [
|
||||
VuexWebExtensions({
|
||||
persistentStates: [
|
||||
'uwLog',
|
||||
'showLogger',
|
||||
'loggingEnded',
|
||||
],
|
||||
}),
|
||||
],
|
||||
state: {
|
||||
uwLog: '',
|
||||
showLogger: false,
|
||||
@ -186,18 +187,17 @@ class UwUi {
|
||||
const uwid = `uw-ui-root-${random}`;
|
||||
|
||||
const rootDiv = document.createElement('div');
|
||||
rootDiv.setAttribute("style", "position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 999999; background-color: #ff0000;");
|
||||
rootDiv.setAttribute("style", "position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 999999;");
|
||||
rootDiv.setAttribute("id", uwid);
|
||||
|
||||
document.body.appendChild(rootDiv);
|
||||
|
||||
try {
|
||||
createApp('logger-ui')
|
||||
createApp(LoggerUi)
|
||||
.component('LoggerUi', LoggerUi)
|
||||
.use(this.vuexStore)
|
||||
.mount(`#${uwid}`);
|
||||
|
||||
|
||||
// new Vue({
|
||||
// el: `#${uwid}`,
|
||||
// components: {
|
||||
@ -216,12 +216,14 @@ class UwUi {
|
||||
}
|
||||
|
||||
async showLogger() {
|
||||
console.log("show logger?")
|
||||
if (!this.loggerUiInitiated) {
|
||||
await this.initLoggerUi();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
console.log("will show logger")
|
||||
this.vuexStore.dispatch('uw-show-logger');
|
||||
} catch (e) {
|
||||
console.error('Failed to dispatch vuex store', e)
|
||||
|
Loading…
Reference in New Issue
Block a user