From 1cfd4b6614a4a05c511fdc96ec91296647c73c75 Mon Sep 17 00:00:00 2001 From: Marius David Wieschollek Date: Sun, 20 Dec 2020 16:09:56 +0100 Subject: Add option to disable localisation Signed-off-by: Marius David Wieschollek --- src/vue/Components/Options/Debug.vue | 83 +++++++++++++++++++++++++++++------- 1 file changed, 67 insertions(+), 16 deletions(-) (limited to 'src/vue/Components') diff --git a/src/vue/Components/Options/Debug.vue b/src/vue/Components/Options/Debug.vue index 3dccd6a..a4be99b 100644 --- a/src/vue/Components/Options/Debug.vue +++ b/src/vue/Components/Options/Debug.vue @@ -18,6 +18,12 @@ {{ hidden.id }} + +
+ + +
+
@@ -37,38 +43,75 @@ import ToastService from "@js/Services/ToastService"; import ErrorManager from "@js/Manager/ErrorManager"; import LocalisationService from "@js/Services/LocalisationService"; + import SliderField from "@vue/Components/Form/SliderField"; + import SettingsService from "@js/Services/SettingsService"; export default { - components: {Icon, Translate}, + components: {SliderField, Icon, Translate}, data() { return { - hidden: { + hidden : { id: '' }, - errors: [], - app: { - version: process.env.APP_VERSION, - platform: process.env.APP_PLATFORM, + errors : [], + app : { + version : process.env.APP_VERSION, + platform : process.env.APP_PLATFORM, environment: process.env.NODE_ENV - } + }, + settings: { + localize: false + }, + interval: null }; }, mounted() { - MessageService.send('options.debug.data').then((reply) => { - let data = reply.getPayload(); + this.loadData(); + if(!this.interval) { + this.interval = setInterval(() => { + this.loadData(); + }, 5000); + } + }, - if(data.hasOwnProperty('hidden')) { - this.hidden = data.hidden; - } + beforeDestroy() { + clearInterval(this.interval); + this.interval = null; + }, - if(data.hasOwnProperty('errors')) { - this.errors = data.errors; - } - }); + activated() { + this.loadData(); + if(!this.interval) { + this.interval = setInterval(() => { + this.loadData(); + }, 5000); + } + }, + + deactivated() { + clearInterval(this.interval); + this.interval = null; }, methods: { + loadData() { + MessageService.send('options.debug.data').then((reply) => { + let data = reply.getPayload(); + + if(data.hasOwnProperty('hidden')) { + this.hidden = data.hidden; + } + + if(data.hasOwnProperty('errors')) { + this.errors = data.errors; + } + + if(data.hasOwnProperty('settings')) { + this.settings = data.settings; + } + }); + }, getTitle(error) { if(error.details) { let label = ''; @@ -103,6 +146,14 @@ .success('DebugErrorDataCopied') .catch(ErrorManager.catchEvt); } + }, + + watch: { + 'settings.localize': (value) => { + SettingsService + .set('debug.localisation.enabled', !value) + .catch(ErrorManager.catchEvt); + } } }; -- cgit v1.2.3