This commit is contained in:
UKDTOM 2021-01-17 13:38:37 +01:00
parent e7859185ea
commit 8c392c3fdf
3 changed files with 42 additions and 46 deletions

View file

@ -148,8 +148,11 @@
"Notice": "Note: When changing a server setting you might need to restart the server afterwards", "Notice": "Note: When changing a server setting you might need to restart the server afterwards",
"SelectSettingsSelection": "Select Settings Group", "SelectSettingsSelection": "Select Settings Group",
"TTSelectSettingsSelection": "Here you select the group the setting you want to alter is in", "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", "OnlyHidden": "Show only hidden settings",
"OnlyAdvanced": "Show only advanced settings", "OnlyAdvanced": "Show only advanced settings",
"AllSettings": "Show all settings",
"Undefined": "undefined", "Undefined": "undefined",
"tblCaption": "Settings - click row to change", "tblCaption": "Settings - click row to change",
"tblName": "Name", "tblName": "Name",

View file

@ -5,16 +5,22 @@
<p>{{ $t("Modules.PMS.Settings.Description") }}</p> <p>{{ $t("Modules.PMS.Settings.Description") }}</p>
<p>{{ $t("Modules.PMS.Settings.Notice") }}</p> <p>{{ $t("Modules.PMS.Settings.Notice") }}</p>
</div> </div>
<div>
<b-form-group id="b-form-group"> <div> <!-- Settings to show -->
<b-form-checkbox-group <b-form-group id="FilterSettingsGroup" v-bind:label="$t('Modules.PMS.Settings.SettingsFilter')" label-size="lg" label-class="font-weight-bold pt-0">
stacked <b-tooltip target="FilterSettingsGroup" triggers="hover">
:options="cbOptions" {{ $t('Modules.PMS.Settings.TTSettingsFilter') }}
v-model="cbSelected" </b-tooltip>
@change.native="changedOptions"> <b-form-radio-group
</b-form-checkbox-group> id="FilterSettings"
</b-form-group> v-model="selFilterSetting"
@change.native="changeFilterSetting()"
:options="FilterSettingsOptions"
name="FilterSettings"
></b-form-radio-group>
</b-form-group>
</div> </div>
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<b-form-group id="etLibraryGroup" v-bind:label="$t('Modules.PMS.Settings.SelectSettingsSelection')" label-size="lg" label-class="font-weight-bold pt-0"> <b-form-group id="etLibraryGroup" v-bind:label="$t('Modules.PMS.Settings.SelectSettingsSelection')" label-size="lg" label-class="font-weight-bold pt-0">
<b-tooltip target="etLibraryGroup" triggers="hover"> <b-tooltip target="etLibraryGroup" triggers="hover">
@ -29,7 +35,7 @@
</b-form-select> </b-form-select>
</b-form-group> </b-form-group>
</div> </div>
<div> <div> <!-- Modal popup -->
<b-modal ref="edtSetting" hide-footer v-bind:title=this.newSettingTitle > <b-modal ref="edtSetting" hide-footer v-bind:title=this.newSettingTitle >
<div class="d-block text-center"> <div class="d-block text-center">
<b-alert variant="danger" show>{{ $t('Modules.PMS.Settings.varning') }}</b-alert> <b-alert variant="danger" show>{{ $t('Modules.PMS.Settings.varning') }}</b-alert>
@ -96,9 +102,7 @@
const {JSONPath} = require('jsonpath-plus'); const {JSONPath} = require('jsonpath-plus');
import {wtconfig} from '../../General/wtutils'; import {wtconfig} from '../../General/wtutils';
import i18n from '../../../../i18n'; import i18n from '../../../../i18n';
import store from '../../../../store'; import store from '../../../../store';
export default { export default {
data() { data() {
return { return {
@ -110,11 +114,12 @@
newSettingValue: "", newSettingValue: "",
edtSettingKey: "", edtSettingKey: "",
selSectionOptions: [], selSectionOptions: [],
selSection : "", selSection : "",
cbSelected: [], selFilterSetting: "",
cbOptions: [ FilterSettingsOptions: [
{ text: i18n.t('Modules.PMS.Settings.OnlyHidden'), value: 'OnlyHidden' }, { 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: [ settingsFields: [
{name: { label: this.$i18n.t('Modules.PMS.Settings.tblName') }}, {name: { label: this.$i18n.t('Modules.PMS.Settings.tblName') }},
@ -130,6 +135,7 @@
created() { created() {
log.info("PMS Settings Created"); log.info("PMS Settings Created");
this.serverSelected(); this.serverSelected();
this.getFilterSettings();
this.getServerSettings(); this.getServerSettings();
this.getcbDefaults(); this.getcbDefaults();
}, },
@ -235,25 +241,16 @@
Address: this.$store.getters.getSelectedServerAddress}); Address: this.$store.getters.getSelectedServerAddress});
log.debug('Options are: ' + JSON.stringify(Object.keys(this.$store.getters.getPMSSettings))) log.debug('Options are: ' + JSON.stringify(Object.keys(this.$store.getters.getPMSSettings)))
this.selSectionOptions = Object.keys(this.$store.getters.getPMSSettings).sort(); this.selSectionOptions = Object.keys(this.$store.getters.getPMSSettings).sort();
}, },
async changedOptions() { async changeFilterSetting() {
log.debug('Updating OnlyHidden Setting'); log.debug('Changed FilterSetting');
//this.$nextTick(()=>{console.log(this.cbSelected);}) wtconfig.set('PMS.FilterSetting', this.selFilterSetting);
for( var cbItem of ["OnlyHidden", "OnlyAdvanced"]){
wtconfig.set("PMS." + cbItem, (this.cbSelected.includes(cbItem)))
}
await this.getServerSettings(); await this.getServerSettings();
this.updateTbl(this.selSection); this.updateTbl(this.selSection);
}, },
getcbDefaults() { getFilterSettings() {
log.debug('Get OnlyHidden Setting'); console.log('Ged get filter settings')
const cbItems = ["OnlyHidden", "OnlyAdvanced"]; this.selFilterSetting = wtconfig.get('PMS.FilterSetting', 'AllSettings');
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)
} }
} }
}; };

View file

@ -62,21 +62,17 @@ const actions = {
.then((response) => { .then((response) => {
log.debug('Response from fetchPlexServers recieved') log.debug('Response from fetchPlexServers recieved')
var filteredResult = {} var filteredResult = {}
// filteredResult based on hidden or not // Filtered result based on hidden, adv or all
if (wtconfig.get('PMS.OnlyHidden', true) == true){ var curFilter = wtconfig.get('PMS.FilterSetting', 'AllSettings');
log.debug('Show only Hidden settings') log.verbose(`Filter set to ${curFilter}`);
filteredResult = JSONPath({path: '$..Setting[?(@.hidden==true)]', json: response.data}); if (curFilter == 'AllSettings'){
}
else {
log.debug('Show non-hidden settings as well')
filteredResult = JSONPath({path: '$..Setting', json: response.data})[0]; 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 { else if (curFilter == 'OnlyHidden'){
log.debug('Show all settings'); filteredResult = JSONPath({path: '$..Setting[?(@.hidden==true)]', json: response.data});
}
else {
filteredResult = JSONPath({path: '$..Setting[?(@.advanced==true)]', json: response.data});
} }
// Reset PMSSettings // Reset PMSSettings
var PMSSettings = {}; var PMSSettings = {};