Merge pull request #218 from WebTools-NG/#216-PMS-Module-and-check-boxes

#216 pms module and check boxes
This commit is contained in:
Tommy Mikkelsen 2021-01-17 13:41:28 +01:00 committed by GitHub
commit 8023003a78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 46 deletions

View file

@ -5,6 +5,7 @@
**Note**: This version is an Alpha version, that is not made public **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) * [#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 ## V0.1.11

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"
v-model="selFilterSetting"
@change.native="changeFilterSetting()"
:options="FilterSettingsOptions"
name="FilterSettings"
></b-form-radio-group>
</b-form-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>
@ -97,8 +103,6 @@
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 {
@ -111,10 +115,11 @@
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();
}, },
@ -236,24 +242,15 @@
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}`);
if (curFilter == 'AllSettings'){
filteredResult = JSONPath({path: '$..Setting', json: response.data})[0];
}
else if (curFilter == 'OnlyHidden'){
filteredResult = JSONPath({path: '$..Setting[?(@.hidden==true)]', json: response.data}); filteredResult = JSONPath({path: '$..Setting[?(@.hidden==true)]', json: response.data});
} }
else { else {
log.debug('Show non-hidden settings as well') filteredResult = JSONPath({path: '$..Setting[?(@.advanced==true)]', json: response.data});
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');
} }
// Reset PMSSettings // Reset PMSSettings
var PMSSettings = {}; var PMSSettings = {};