From e7859185ea3212b1222249776da27ef64226391c Mon Sep 17 00:00:00 2001 From: UKDTOM Date: Sun, 17 Jan 2021 10:58:23 +0100 Subject: [PATCH 1/2] #216 Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c250984..0f52fa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ **Note**: This version is an Alpha version, that is not made public * [#213 AutoUpdate Notification Ignore](https://github.com/WebTools-NG/WebTools-NG/issues/213) +* [#216 PMS Module and check boxes](https://github.com/WebTools-NG/WebTools-NG/issues/216) ## V0.1.11 From 8c392c3fdfaffa636adb51ee380a433fa3db7418 Mon Sep 17 00:00:00 2001 From: UKDTOM Date: Sun, 17 Jan 2021 13:38:37 +0100 Subject: [PATCH 2/2] Fixed #216 --- public/locales/en.json | 3 + .../modules/PMS/Settings/settings.vue | 63 +++++++++---------- src/store/modules/pms.js | 22 +++---- 3 files changed, 42 insertions(+), 46 deletions(-) diff --git a/public/locales/en.json b/public/locales/en.json index 7bc6c1c..38a355c 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -148,8 +148,11 @@ "Notice": "Note: When changing a server setting you might need to restart the server afterwards", "SelectSettingsSelection": "Select Settings Group", "TTSelectSettingsSelection": "Here you select the group the setting you want to alter is in", + "SettingsFilter": "Filter settings", + "TTSettingsFilter": "Here you apply a filter for the settings", "OnlyHidden": "Show only hidden settings", "OnlyAdvanced": "Show only advanced settings", + "AllSettings": "Show all settings", "Undefined": "undefined", "tblCaption": "Settings - click row to change", "tblName": "Name", diff --git a/src/components/modules/PMS/Settings/settings.vue b/src/components/modules/PMS/Settings/settings.vue index 2fb559f..3039c8b 100644 --- a/src/components/modules/PMS/Settings/settings.vue +++ b/src/components/modules/PMS/Settings/settings.vue @@ -5,16 +5,22 @@

{{ $t("Modules.PMS.Settings.Description") }}

{{ $t("Modules.PMS.Settings.Notice") }}

-
- - - - + +
+ + + {{ $t('Modules.PMS.Settings.TTSettingsFilter') }} + + +
+
@@ -29,7 +35,7 @@
-
+
{{ $t('Modules.PMS.Settings.varning') }} @@ -96,9 +102,7 @@ const {JSONPath} = require('jsonpath-plus'); import {wtconfig} from '../../General/wtutils'; import i18n from '../../../../i18n'; - import store from '../../../../store'; - - + import store from '../../../../store'; export default { data() { return { @@ -110,11 +114,12 @@ newSettingValue: "", edtSettingKey: "", selSectionOptions: [], - selSection : "", - cbSelected: [], - cbOptions: [ + selSection : "", + selFilterSetting: "", + FilterSettingsOptions: [ { text: i18n.t('Modules.PMS.Settings.OnlyHidden'), value: 'OnlyHidden' }, - { text: i18n.t('Modules.PMS.Settings.OnlyAdvanced'), value: 'OnlyAdvanced' } + { text: i18n.t('Modules.PMS.Settings.OnlyAdvanced'), value: 'OnlyAdvanced' }, + { text: i18n.t('Modules.PMS.Settings.AllSettings'), value: 'AllSettings' } ], settingsFields: [ {name: { label: this.$i18n.t('Modules.PMS.Settings.tblName') }}, @@ -130,6 +135,7 @@ created() { log.info("PMS Settings Created"); this.serverSelected(); + this.getFilterSettings(); this.getServerSettings(); this.getcbDefaults(); }, @@ -235,25 +241,16 @@ Address: this.$store.getters.getSelectedServerAddress}); log.debug('Options are: ' + JSON.stringify(Object.keys(this.$store.getters.getPMSSettings))) this.selSectionOptions = Object.keys(this.$store.getters.getPMSSettings).sort(); - }, - async changedOptions() { - log.debug('Updating OnlyHidden Setting'); - //this.$nextTick(()=>{console.log(this.cbSelected);}) - for( var cbItem of ["OnlyHidden", "OnlyAdvanced"]){ - wtconfig.set("PMS." + cbItem, (this.cbSelected.includes(cbItem))) - } + }, + async changeFilterSetting() { + log.debug('Changed FilterSetting'); + wtconfig.set('PMS.FilterSetting', this.selFilterSetting); await this.getServerSettings(); this.updateTbl(this.selSection); }, - getcbDefaults() { - log.debug('Get OnlyHidden Setting'); - const cbItems = ["OnlyHidden", "OnlyAdvanced"]; - for(let i = 0; i < cbItems.length; i++){ - if (wtconfig.get("PMS." + cbItems[i], false)){ - this.cbSelected.push(cbItems[i]) - } - } - log.debug('CBOptions: ' + this.cbSelected) + getFilterSettings() { + console.log('Ged get filter settings') + this.selFilterSetting = wtconfig.get('PMS.FilterSetting', 'AllSettings'); } } }; diff --git a/src/store/modules/pms.js b/src/store/modules/pms.js index a3e8dc0..becf45d 100644 --- a/src/store/modules/pms.js +++ b/src/store/modules/pms.js @@ -62,21 +62,17 @@ const actions = { .then((response) => { log.debug('Response from fetchPlexServers recieved') var filteredResult = {} - // filteredResult based on hidden or not - if (wtconfig.get('PMS.OnlyHidden', true) == true){ - log.debug('Show only Hidden settings') - filteredResult = JSONPath({path: '$..Setting[?(@.hidden==true)]', json: response.data}); - } - else { - log.debug('Show non-hidden settings as well') + // Filtered result based on hidden, adv or all + var curFilter = wtconfig.get('PMS.FilterSetting', 'AllSettings'); + log.verbose(`Filter set to ${curFilter}`); + if (curFilter == 'AllSettings'){ filteredResult = JSONPath({path: '$..Setting', json: response.data})[0]; - } - if (wtconfig.get('PMS.OnlyAdvanced', true) == true){ - log.debug('Show only OnlyAdvanced settings') - filteredResult = JSONPath({path: '$.[?(@.advanced==true)]', json: filteredResult}); } - else { - log.debug('Show all settings'); + else if (curFilter == 'OnlyHidden'){ + filteredResult = JSONPath({path: '$..Setting[?(@.hidden==true)]', json: response.data}); + } + else { + filteredResult = JSONPath({path: '$..Setting[?(@.advanced==true)]', json: response.data}); } // Reset PMSSettings var PMSSettings = {};