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
* [#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

View file

@ -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",

View file

@ -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>
<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>
@ -97,8 +103,6 @@
import {wtconfig} from '../../General/wtutils';
import i18n from '../../../../i18n';
import store from '../../../../store';
export default {
data() {
return {
@ -111,10 +115,11 @@
edtSettingKey: "",
selSectionOptions: [],
selSection : "",
cbSelected: [],
cbOptions: [
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();
},
@ -236,24 +242,15 @@
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');
}
}
};

View file

@ -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')
// 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];
}
else if (curFilter == 'OnlyHidden'){
filteredResult = JSONPath({path: '$..Setting[?(@.hidden==true)]', json: response.data});
}
else {
log.debug('Show non-hidden settings as well')
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');
filteredResult = JSONPath({path: '$..Setting[?(@.advanced==true)]', json: response.data});
}
// Reset PMSSettings
var PMSSettings = {};