Add show/hide popup buttons to 'report a problem' popup tab. Removed everything else re: logging from there.
This commit is contained in:
parent
bd2fa787e1
commit
22bcd02afc
@ -13,42 +13,29 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<span class="label">Swatter mode (logging)</span><br/>
|
<span class="label">Swatter mode (logging)</span><br/>
|
||||||
<span class="info">
|
|
||||||
<small>
|
|
||||||
This requires 'download' permission. You will be prompted when saving file. Logger configuration may
|
|
||||||
attempt to automatically download the log after collecting relevant data. Logging will reload the tab
|
|
||||||
you're currently using. <b>Performance may be severely reduced while logging is active. Turn it on when
|
|
||||||
asked and then turn it off when you're done.</b>
|
|
||||||
</small>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<b>Logger configuration:</b> <span v-if="loggerEnabled">ACTIVE!</span><br/>
|
|
||||||
<small v-if="loggerSettingsError"><b>Parsing settings failed — there is a problem with settings!</b></small>
|
|
||||||
<input type="textarea" v-model="loggerSettings"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
<ShortcutButton class="flex flex-grow button"
|
<ShortcutButton class="flex flex-grow button"
|
||||||
label="Save settings & start logging"
|
label="Show logger"
|
||||||
:active="loggingEnabled"
|
:active="loggingEnabled"
|
||||||
@click.native="startLogging()"
|
@click.native="showLogger()"
|
||||||
></ShortcutButton>
|
></ShortcutButton>
|
||||||
<ShortcutButton class="flex flex-grow button"
|
<ShortcutButton class="flex flex-grow button"
|
||||||
label="Make a mark"
|
label="Make a mark"
|
||||||
@click.native="sendMark()"
|
@click.native="sendMark()"
|
||||||
></ShortcutButton>
|
></ShortcutButton>
|
||||||
<ShortcutButton class="flex flex-grow button"
|
<ShortcutButton class="flex flex-grow button"
|
||||||
label="Stop logging"
|
label="Hide logger"
|
||||||
@click.native="stopLogging()"
|
@click.native="hideLogger()"
|
||||||
></ShortcutButton>
|
></ShortcutButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Comms from '../../ext/lib/comms/Comms';
|
||||||
import ShortcutButton from '../../common/components/ShortcutButton';
|
import ShortcutButton from '../../common/components/ShortcutButton';
|
||||||
import BrowserDetect from '../../ext/conf/BrowserDetect';
|
import BrowserDetect from '../../ext/conf/BrowserDetect';
|
||||||
import Logger from '../../ext/lib/Logger';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -89,54 +76,31 @@ Browser-related stuff (please ensure this section is correct):
|
|||||||
);
|
);
|
||||||
this.mailtoLink = `mailto:tamius.han@gmail.com?subject=%5BUltrawidify%5D%20ENTER%20SUMMARY%20OF%20YOUR%20ISSUE%20HERE&body=${messageTemplate}`;
|
this.mailtoLink = `mailto:tamius.han@gmail.com?subject=%5BUltrawidify%5D%20ENTER%20SUMMARY%20OF%20YOUR%20ISSUE%20HERE&body=${messageTemplate}`;
|
||||||
this.redditLink = `https://www.reddit.com/message/compose?to=xternal7&subject=[Ultrawidify]%20ENTER%20SUMMARY%20OF%20YOUR%20PROBLEM%20HERE&message=${messageTemplate}`;
|
this.redditLink = `https://www.reddit.com/message/compose?to=xternal7&subject=[Ultrawidify]%20ENTER%20SUMMARY%20OF%20YOUR%20PROBLEM%20HERE&message=${messageTemplate}`;
|
||||||
|
|
||||||
const loggerSettingsAll = await Logger.getConfig();
|
|
||||||
|
|
||||||
this.loadLoggerSettings(loggerSettingsAll);
|
|
||||||
|
|
||||||
// ensure that logger conf gets updated (in case of timed logger)
|
|
||||||
Logger.syncConfig(x => this.loadLoggerSettings(x));
|
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadLoggerSettings(conf) {
|
|
||||||
this.loggingEnabled = conf.allowLogging;
|
|
||||||
this.lastLoadedLoggerSettings = {
|
|
||||||
fileOptions: conf.fileOptions,
|
|
||||||
consoleOptions: conf.consoleOptions
|
|
||||||
};
|
|
||||||
this.loggerSettings = JSON.stringify(lastLoadedLoggerSettings, null, 2);
|
|
||||||
},
|
|
||||||
async updateLoggerSettings(allowLogging) {
|
async updateLoggerSettings(allowLogging) {
|
||||||
this.loggingEnabled = allowLogging;
|
// this.loggingEnabled = allowLogging;
|
||||||
if (allowLogging) {
|
// if (allowLogging) {
|
||||||
const parsedSettings = JSON.parse(this.loggerSettings);
|
// const parsedSettings = JSON.parse(this.loggerSettings);
|
||||||
Logger.saveConfig({
|
// Logger.saveConfig({
|
||||||
allowLogging: allowLogging,
|
// allowLogging: allowLogging,
|
||||||
timeout: parsedSettings.timeout || undefined,
|
// timeout: parsedSettings.timeout || undefined,
|
||||||
fileOptions: parsedSettings.fileOptions || {},
|
// fileOptions: parsedSettings.fileOptions || {},
|
||||||
consoleOptions: parsedSettings.consoleOptions || {},
|
// consoleOptions: parsedSettings.consoleOptions || {},
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
// we need to save logger settings because logging is triggered by allow logging
|
// // we need to save logger settings because logging is triggered by allow logging
|
||||||
Logger.saveConfig({allowLogging: allowLogging, ...lastLoadedLoggerSettings});
|
// Logger.saveConfig({allowLogging: allowLogging, ...lastLoadedLoggerSettings});
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
startLogging() {
|
showLogger() {
|
||||||
try {
|
Comms.sendMessage({cmd: 'show-logger', forwardToActive: true});
|
||||||
JSON.parse(this.loggerSettings);
|
|
||||||
this.loggerSettingsError = false;
|
|
||||||
this.updateLoggerSettings(true);
|
|
||||||
} catch (e) {
|
|
||||||
console.error("Cannot parse logger config json!");
|
|
||||||
this.loggerSettingsError = true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
sendMark() {
|
sendMark() {
|
||||||
|
|
||||||
},
|
},
|
||||||
endLogging() {
|
hideLogger() {
|
||||||
updateLoggerSettings(false);
|
Comms.sendMessage({cmd: 'hide-logger', forwardToActive: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user