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