#16 more clean up and log setup

This commit is contained in:
CPSO 2020-06-17 13:37:04 +02:00
parent cc5090417d
commit 6847a3acb5

View file

@ -1,201 +1,185 @@
<template> <template>
<section class="section"> <section class="section">
<h1 class="title is-3">{{ $t("Modules.ET.Name") }}</h1>
<h1 class="title is-3">{{ $t("Modules.ET.Name") }}</h1>
<h2 class="subtitle">{{ $t("Modules.ET.Description") }}</h2> <h2 class="subtitle">{{ $t("Modules.ET.Description") }}</h2>
<br> <br />
<h1 class="title is-3">{{ $t("Modules.ET.HSelectMedia") }}</h1> <h1 class="title is-3">{{ $t("Modules.ET.HSelectMedia") }}</h1>
<div class="block"> <div class="block">
<b-radio v-model="radio" type="is-dark" <b-radio
name="movie" v-model="radio"
native-value="movie"> type="is-dark"
{{ $t("Modules.ET.RadioMovies") }} name="movie"
</b-radio> native-value="movie"
<b-radio v-model="radio" type="is-dark" >{{ $t("Modules.ET.RadioMovies") }}</b-radio>
name="tvseries" <b-radio
native-value="tvseries" v-model="radio"
disabled> type="is-dark"
{{ $t("Modules.ET.RadioTVSeries") }} name="tvseries"
</b-radio> native-value="tvseries"
<b-radio v-model="radio" type="is-dark" disabled
name="artist" >{{ $t("Modules.ET.RadioTVSeries") }}</b-radio>
native-value="artist" <b-radio
disabled> v-model="radio"
{{ $t("Modules.ET.RadioMusic") }} type="is-dark"
</b-radio> name="artist"
<b-radio v-model="radio" type="is-dark" native-value="artist"
name="photo" disabled
native-value="photo" >{{ $t("Modules.ET.RadioMusic") }}</b-radio>
disabled> <b-radio
{{ $t("Modules.ET.RadioPhotos") }} v-model="radio"
</b-radio> type="is-dark"
<b-radio v-model="radio" type="is-dark" name="photo"
name="othervideos" native-value="photo"
native-value="othervideos" disabled
disabled> >{{ $t("Modules.ET.RadioPhotos") }}</b-radio>
{{ $t("Modules.ET.RadioOtherVideos") }} <b-radio
</b-radio> v-model="radio"
type="is-dark"
name="othervideos"
native-value="othervideos"
disabled
>{{ $t("Modules.ET.RadioOtherVideos") }}</b-radio>
</div> </div>
<hr> <hr />
<h1 class="title is-3">{{ $t("Modules.ET.HSelectSelection") }}</h1> <h1 class="title is-3">{{ $t("Modules.ET.HSelectSelection") }}</h1>
<div class="select is-dark"> <div class="select is-dark">
<b-select v-bind:placeholder="$t('Modules.ET.SelectSelection')" <b-select v-bind:placeholder="$t('Modules.ET.SelectSelection')" @input="selectSelection">
@input="selectSelection"> <option
<option v-for="option in pmsSections"
v-for="option in pmsSections" :value="option.key"
:value="option.key" :key="option.key"
:key="option.key" v-on:change="onchange()"
v-on:change="onchange()"> >{{ option.title }}</option>
{{ option.title }} </b-select>
</option> </div>
</b-select> <b-button
</div> id="sync-button"
<b-button @click="fetchSelection"
id="sync-button" type="is-warning"
@click="fetchSelection" type="is-warning" icon-left="fas fa-sync"
icon-left="fas fa-sync" icon-pack="fas" > icon-pack="fas"
</b-button> ></b-button>
<hr> <hr />
<h1 class="title is-3">Export Level</h1> <h1 class="title is-3">Export Level</h1>
<b-tabs v-model="activeTab" type="is-boxed" :animated="false">
<b-tab-item label="Export Level">
<div class="columns">
<div class="column is-3">
<b-field type="is-dark">
<b-select
placeholder="Default"
expanded
@input="selectExportLevel">
<option
v-for="(value, name) in exportLevels"
:value="value"
:key="name">
{{ name }}
</option>
</b-select>
</b-field>
</div>
<div class="column is-3">
</div>
<div class="column is-6">
<b-message icon-pack="fas" has-icon icon="fas fa-info-circle">
Export level determents what data is going to be exportet.
</b-message>
</div>
</div>
</b-tab-item>
<b-tab-item label="Custom Export Level">
</b-tab-item>
</b-tabs>
<hr>
<b-tabs v-model="activeTab" type="is-boxed" :animated="false">
<b-tab-item label="Export Level">
<div class="columns">
<div class="column is-3">
<b-field type="is-dark">
<b-select placeholder="Default" expanded @input="selectExportLevel">
<option v-for="(value, name) in exportLevels" :value="value" :key="name">{{ name }}</option>
</b-select>
</b-field>
</div>
<div class="column is-3"></div>
<div class="column is-6">
<b-message
icon-pack="fas"
has-icon
icon="fas fa-info-circle"
>Export level determents what data is going to be exportet.</b-message>
</div>
</div>
</b-tab-item>
<b-tab-item label="Custom Export Level"></b-tab-item>
</b-tabs>
<hr />
<h1 class="title is-3">{{ $t("Modules.ET.HExportMedia") }}</h1> <h1 class="title is-3">{{ $t("Modules.ET.HExportMedia") }}</h1>
<div class="buttons"> <div class="buttons">
<b-button <b-button
type="is-primary" type="is-primary"
@click="getMedia" @click="getMedia"
icon-left="fas fa-file-download" icon-left="fas fa-file-download"
icon-pack="fas"> icon-pack="fas"
{{ $t("Modules.ET.HExportMedia") }} >{{ $t("Modules.ET.HExportMedia") }}</b-button>
</b-button>
</div> </div>
</section> </section>
</template> </template>
<script> <script>
import {et} from './et' import { et } from "./et";
//import {levels, level1, level2} from '../ExportTools/movieLevels' const log = require("electron-log");
const log = require('electron-log');
export default { export default {
name: 'export', name: "export",
data() { data() {
return { return {
radio: 'movie', radio: "movie",
activeTab: 0, activeTab: 0
// activeTab: 0, };
// levels: levels, },
// level1: level1, created() {
// level2: level2 log.info("ET Created");
this.fetchSelection();
},
computed: {
pmsSections: function() {
let sections = this.$store.getters.getPmsSections;
let result = [];
if (Array.isArray(sections) && sections.length) {
log.debug("doing a forEach");
sections.forEach(req => {
if (req.type == this.radio) {
log.debug("pushing data to results");
result.push(req);
}
});
} else {
log.info("No data found");
result.push["No Section found"];
}
return result;
},
exportLevels: function() {
let levels = "";
log.info("exportLevels: found levels: " + JSON.stringify(et.getLevels(this.radio)));
levels = et.getLevels(this.radio);
const libType = "movie";
log.info("exportLevels: Possible levels key/val are: " + JSON.stringify(et.getLevels(libType)));
return levels;
} }
}, },
created(){ methods: {
log.info('ET Created') selectSelection: function(selected) {
this.fetchSelection() log.debug(selected);
}, computed: { this.$store.commit("UPDATE_SELECTEDSECTION", selected);
pmsSections: function(){ },
let sections = this.$store.getters.getPmsSections selectExportLevel: function(selected) {
let result=[]; log.info('selectExportLevel: Selected Level: ' + selected);
if(Array.isArray(sections) && sections.length){ this.$store.commit("UPDATE_EXPORTLEVEL", selected);
log.debug("doing a forEach") },
sections.forEach((req) => { getMedia() {
if (req.type == this.radio) { log.info("getMedia Called");
log.debug("pushing data to results") this.$store.dispatch("getMediaMovies");
result.push(req); },
} fetchSelection() {
}) log.debug("fetchSelection");
} else { let serverCheck = this.$store.getters.getSelectedServer;
log.info("No data found") if (serverCheck !== "none") {
result.push["No Section found"] log.debug("serverCheck is not null, running fetchSections ");
} this.$store.dispatch("fetchSections");
return result } else {
}, log.debug("serverCheck is none");
exportLevels: function(){ this.$buefy.toast.open({
duration: 3000,
let levels='' message: this.$t("Modules.ET.ErrorNoServerSelected"),
console.log('Nugga levels: ' + JSON.stringify(et.getLevels(this.radio))) type: "is-danger"
levels = et.getLevels(this.radio) });
const libType = 'movie'
console.log('Possible levels key/val are: ' + JSON.stringify(et.getLevels(libType)))
return levels
} }
}, methods: { }
selectSelection: function (selected) {
log.debug(selected)
this.$store.commit("UPDATE_SELECTEDSECTION", selected);
},
selectExportLevel: function(selected){
console.log(selected)
this.$store.commit("UPDATE_EXPORTLEVEL", selected);
},
getMedia(){
console.log("getMedia Called")
this.$store.dispatch('getMediaMovies');
},
fetchSelection(){
log.debug("fetchSelection")
let serverCheck = this.$store.getters.getSelectedServer
if(serverCheck !== "none"){
log.debug("serverCheck is not null, running fetchSections ")
this.$store.dispatch('fetchSections')
} else {
log.debug("serverCheck is none")
this.$buefy.toast.open({
duration: 3000,
message: this.$t('Modules.ET.ErrorNoServerSelected'),
type: 'is-danger'
})
}
}
} }
};
}
</script> </script>
<!-- Add "scoped" attribute to limit CSS to this component only --> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped> <style scoped>
#sync-button {
#sync-button{
margin-left: 1em; margin-left: 1em;
} }
</style> </style>