mirror of
https://github.com/WebTools-NG/WebTools-NG
synced 2024-11-22 19:13:19 +00:00
Fixed #216
This commit is contained in:
parent
e7859185ea
commit
8c392c3fdf
3 changed files with 42 additions and 46 deletions
|
@ -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",
|
||||
|
|
|
@ -5,16 +5,22 @@
|
|||
<p>{{ $t("Modules.PMS.Settings.Description") }}</p>
|
||||
<p>{{ $t("Modules.PMS.Settings.Notice") }}</p>
|
||||
</div>
|
||||
<div>
|
||||
<b-form-group id="b-form-group">
|
||||
<b-form-checkbox-group
|
||||
stacked
|
||||
:options="cbOptions"
|
||||
v-model="cbSelected"
|
||||
@change.native="changedOptions">
|
||||
</b-form-checkbox-group>
|
||||
</b-form-group>
|
||||
|
||||
<div> <!-- Settings to show -->
|
||||
<b-form-group id="FilterSettingsGroup" v-bind:label="$t('Modules.PMS.Settings.SettingsFilter')" label-size="lg" label-class="font-weight-bold pt-0">
|
||||
<b-tooltip target="FilterSettingsGroup" triggers="hover">
|
||||
{{ $t('Modules.PMS.Settings.TTSettingsFilter') }}
|
||||
</b-tooltip>
|
||||
<b-form-radio-group
|
||||
id="FilterSettings"
|
||||
v-model="selFilterSetting"
|
||||
@change.native="changeFilterSetting()"
|
||||
:options="FilterSettingsOptions"
|
||||
name="FilterSettings"
|
||||
></b-form-radio-group>
|
||||
</b-form-group>
|
||||
</div>
|
||||
|
||||
<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-tooltip target="etLibraryGroup" triggers="hover">
|
||||
|
@ -29,7 +35,7 @@
|
|||
</b-form-select>
|
||||
</b-form-group>
|
||||
</div>
|
||||
<div>
|
||||
<div> <!-- Modal popup -->
|
||||
<b-modal ref="edtSetting" hide-footer v-bind:title=this.newSettingTitle >
|
||||
<div class="d-block text-center">
|
||||
<b-alert variant="danger" show>{{ $t('Modules.PMS.Settings.varning') }}</b-alert>
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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 = {};
|
||||
|
|
Loading…
Reference in a new issue