Display logger conf with json components

This commit is contained in:
Tamius Han 2020-03-11 23:12:29 +01:00
parent b353e6f34d
commit 77f3ce0e39

View File

@ -50,6 +50,10 @@
</div> </div>
</div> </div>
<div class="settings-panel flex flex-noshrink flex-column">
<JsonObject :value="currentSettings" key="logger-settings"></JsonObject>
</div>
<!-- LOGGER OUTPUT/START LOGGING --> <!-- LOGGER OUTPUT/START LOGGING -->
<div class="results-panel flex flex-shrink flex-column overflow-hidden"> <div class="results-panel flex flex-shrink flex-column overflow-hidden">
<div class="panel-top flex-nogrow"> <div class="panel-top flex-nogrow">
@ -130,8 +134,12 @@ import { mapState } from 'vuex';
import Logger from '../ext/lib/Logger'; import Logger from '../ext/lib/Logger';
import Comms from '../ext/lib/comms/Comms'; import Comms from '../ext/lib/comms/Comms';
import IO from '../common/js/IO'; import IO from '../common/js/IO';
import JsonObject from '../common/components/JsonEditor/JsonObject';
export default { export default {
components: {
JsonObject,
},
data() { data() {
return { return {
showLoggerUi: false, showLoggerUi: false,
@ -141,6 +149,7 @@ export default {
}, },
parsedSettings: '', parsedSettings: '',
lastSettings: {}, lastSettings: {},
currentSettings: {},
confHasError: false, confHasError: false,
logStringified: '', logStringified: '',
} }
@ -187,11 +196,13 @@ export default {
async getLoggerSettings() { async getLoggerSettings() {
this.lastSettings = await Logger.getConfig() || {}; this.lastSettings = await Logger.getConfig() || {};
this.parsedSettings = JSON.stringify(this.lastSettings, null, 2) || ''; this.parsedSettings = JSON.stringify(this.lastSettings, null, 2) || '';
this.currentSettings = JSON.parse(JSON.stringify(this.lastSettings));
}, },
updateSettings(val) { updateSettings(val) {
try { try {
this.parsedSettings = JSON.stringify(JSON.parse(val.target.textContent.trim()), null, 2); this.parsedSettings = JSON.stringify(JSON.parse(val.target.textContent.trim()), null, 2);
this.lastSettings = JSON.parse(val.target.textContent.trim()); this.lastSettings = JSON.parse(val.target.textContent.trim());
this.currentSettings = JSON.parse(JSON.stringify(this.lastSettings));
this.confHasError = false; this.confHasError = false;
} catch (e) { } catch (e) {
this.confHasError = true; this.confHasError = true;
@ -368,4 +379,11 @@ pre {
background-color: #884420; background-color: #884420;
} }
.json-level-indent {
padding-left: 2em !important;
}
.item-key {
color: #fa6;
}
</style> </style>