#13 added radio buttons to pick media. added section fetch on server select

This commit is contained in:
CPSO 2020-05-29 03:32:19 +02:00
parent d8588d60f0
commit d7609fe08b
4 changed files with 61 additions and 7 deletions

View file

@ -28,7 +28,7 @@
<div class="select is-dark">
<b-select v-bind:placeholder="$t('Common.SelServer')"
@input="assignTag">
@input="selected">
<option
v-for="option in pserver"
:value="option"
@ -56,9 +56,11 @@ export default {
console.log("fetching servers")
this.$store.dispatch('fetchPlexServers', store.getters.getAuthToken);
},
assignTag: function (selected) {
selected: function (selected) {
this.selected = selected;
this.$store.commit("UPDATE_SELECTED_SERVER", selected);
this.$store.dispatch('fetchSections');
},
onChange(event) {
console.log(event.target.selected);

View file

@ -3,7 +3,46 @@
<h1 class="title is-3">{{ $t("Modules.ET.Name") }}</h1>
<h2 class="subtitle">{{ $t("Modules.ET.Description") }}</h2>
<br>
<h1 class="title is-3">0. Select Media Type</h1>
<div class="block">
<b-radio v-model="radio" type="is-dark"
name="name"
native-value="movies">
Movies
</b-radio>
<b-radio v-model="radio"
name="name"
native-value="tvseries"
disabled>
TV Series
</b-radio>
<b-radio v-model="radio"
name="name"
native-value="music"
disabled>
Music
</b-radio>
<b-radio v-model="radio"
name="name"
native-value="photos"
disabled>
Photos
</b-radio>
<b-radio v-model="radio"
name="name"
native-value="othervideos"
disabled>
Other Videos
</b-radio>
</div>
<p class="content">
<b>Selection:</b>
{{ radio }}
</p>
<hr>
<h1 class="title is-3">1. Select lib</h1>
<div class="select is-dark">
<b-select v-bind:placeholder="$t('Modules.ET.SelectSelection')"
@ -34,12 +73,16 @@
<script>
export default {
name: 'export',
created(){
data() {
return {
radio: 'movies'
}
},
created(){
console.log("ET Created")
this.$store.dispatch('fetchSections');
}, computed: {
pmsSections: function(){
return this.$store.getters.getPmsSections
}
}, methods: {
@ -49,7 +92,7 @@ export default {
},
getMedia(){
console.log("getMedia Called")
this.$store.dispatch('getMedia');
this.$store.dispatch('getMediaMovies');
}
}

View file

@ -46,20 +46,26 @@ const actions = {
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
console.log(error.request);
console.log("Unable to fetch sections")
} else {
// Something happened in setting up the request that triggered an Error
console.log('Error', error.message);
console.log("fetchSection is error 2")
}
}
)
},
getMedia({ getters }) {
getMediaMovies({ getters }) {
var key = getters.getSelectedSection
var baseURL = getters.getSlectedServerAddress
axios({
method: 'get',
url: `http://127.0.0.1:32400/library/sections/${key}/all`,
baseURL: `http://${baseURL}`,
url: `/library/sections/${key}/all`,
responseType: 'json',
headers: {
'Accept': "application/json",

View file

@ -55,6 +55,9 @@ const actions = {
console.log(result)
commit('UPDATE_PLEX_SERVERS', result)
this.$store.dispatch('fetchSections')
})
.catch(function (error) {
if (error.response) {