[web] Show stream playlists (rss, radio) only if config option "radio_playlists" is set to true

This commit is contained in:
chme 2022-04-16 20:21:26 +02:00
parent 7fff11ef30
commit 45b192255a
3 changed files with 32 additions and 9 deletions

View File

@ -1,23 +1,23 @@
<template> <template>
<div <div
v-for="playlist in playlists" v-for="playlist in playlists"
:key="playlist.id" :key="playlist.itemId"
class="media" class="media"
:playlist="playlist" :playlist="playlist"
@click="open_playlist(playlist)" @click="open_playlist(playlist.item)"
> >
<figure class="media-left fd-has-action"> <figure class="media-left fd-has-action">
<span class="icon"> <span class="icon">
<mdicon :name="icon_name(playlist)" size="16" /> <mdicon :name="icon_name(playlist.item)" size="16" />
</span> </span>
</figure> </figure>
<div class="media-content fd-has-action is-clipped"> <div class="media-content fd-has-action is-clipped">
<h1 class="title is-6"> <h1 class="title is-6">
{{ playlist.name }} {{ playlist.item.name }}
</h1> </h1>
</div> </div>
<div class="media-right"> <div class="media-right">
<a @click.prevent.stop="open_dialog(playlist)"> <a @click.prevent.stop="open_dialog(playlist.item)">
<span class="icon has-text-dark" <span class="icon has-text-dark"
><mdicon name="dots-vertical" size="16" ><mdicon name="dots-vertical" size="16"
/></span> /></span>

View File

@ -20,6 +20,10 @@
<span class="heading">Type</span> <span class="heading">Type</span>
<span class="title is-6">{{ playlist.type }}</span> <span class="title is-6">{{ playlist.type }}</span>
</p> </p>
<p v-if="!playlist.folder">
<span class="heading">Track count</span>
<span class="title is-6">{{ playlist.item_count }}</span>
</p>
</div> </div>
</div> </div>
<footer v-if="!playlist.folder" class="card-footer"> <footer v-if="!playlist.folder" class="card-footer">

View File

@ -4,10 +4,10 @@
<p class="title is-4"> <p class="title is-4">
{{ playlist.name }} {{ playlist.name }}
</p> </p>
<p class="heading">{{ playlists.total }} playlists</p> <p class="heading">{{ playlists.count }} playlists</p>
</template> </template>
<template #content> <template #content>
<list-playlists :playlists="playlists.items" /> <list-playlists :playlists="playlists" />
</template> </template>
</content-with-heading> </content-with-heading>
</template> </template>
@ -16,6 +16,7 @@
import ContentWithHeading from '@/templates/ContentWithHeading.vue' import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ListPlaylists from '@/components/ListPlaylists.vue' import ListPlaylists from '@/components/ListPlaylists.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import { GroupByList, noop } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load: function (to) {
@ -27,7 +28,7 @@ const dataObject = {
set: function (vm, response) { set: function (vm, response) {
vm.playlist = response[0].data vm.playlist = response[0].data
vm.playlists = response[1].data vm.playlists_list = new GroupByList(response[1].data)
} }
} }
@ -51,7 +52,25 @@ export default {
data() { data() {
return { return {
playlist: {}, playlist: {},
playlists: {} playlists_list: new GroupByList()
}
},
computed: {
radio_playlists() {
return this.$store.state.config.radio_playlists
},
playlists() {
this.playlists_list.group(noop(), [
(playlist) =>
playlist.folder ||
this.radio_playlists ||
playlist.stream_count === 0 ||
playlist.item_count > playlist.stream_count
])
return this.playlists_list
} }
} }
} }