[web] Return the list itself when group operation is done

This commit is contained in:
Alain Nussbaumer 2024-04-26 21:06:51 +02:00
parent d246c42a99
commit 8a303f340b
8 changed files with 18 additions and 28 deletions

View File

@ -101,6 +101,7 @@ export class GroupedList {
}, new Map()) }, new Map())
// Create index list // Create index list
this.indices = Array.from(this.itemsGrouped.keys()) this.indices = Array.from(this.itemsGrouped.keys())
return this
} }
*generate() { *generate() {

View File

@ -151,16 +151,14 @@ export default {
computed: { computed: {
albums() { albums() {
const grouping = this.groupings.find( const { options } = this.groupings.find(
(grouping) => grouping.id === this.selected_grouping_id (grouping) => grouping.id === this.selected_grouping_id
) )
grouping.options.filters = [ options.filters = [
(album) => !this.hide_singles || album.track_count > 2, (album) => !this.hide_singles || album.track_count > 2,
(album) => !this.hide_spotify || album.data_kind !== 'spotify' (album) => !this.hide_spotify || album.data_kind !== 'spotify'
] ]
this.albums_list.group(grouping.options) return this.albums_list.group(options)
return this.albums_list
}, },
hide_singles: { hide_singles: {
get() { get() {

View File

@ -130,14 +130,13 @@ export default {
computed: { computed: {
albums() { albums() {
const grouping = this.groupings.find( const { options } = this.groupings.find(
(grouping) => grouping.id === this.selected_grouping_id (grouping) => grouping.id === this.selected_grouping_id
) )
grouping.options.filters = [ options.filters = [
(album) => !this.hide_spotify || album.data_kind !== 'spotify' (album) => !this.hide_spotify || album.data_kind !== 'spotify'
] ]
this.albums_list.group(grouping.options) return this.albums_list.group(options)
return this.albums_list
}, },
hide_spotify: { hide_spotify: {
get() { get() {

View File

@ -165,14 +165,13 @@ export default {
return this.tracks_list.items.map((item) => item.uri).join() return this.tracks_list.items.map((item) => item.uri).join()
}, },
tracks() { tracks() {
const grouping = this.groupings.find( const { options } = this.groupings.find(
(grouping) => grouping.id === this.selected_grouping_id (grouping) => grouping.id === this.selected_grouping_id
) )
grouping.options.filters = [ options.filters = [
(track) => !this.hide_spotify || track.data_kind !== 'spotify' (track) => !this.hide_spotify || track.data_kind !== 'spotify'
] ]
this.tracks_list.group(grouping.options) return this.tracks_list.group(options)
return this.tracks_list
} }
}, },

View File

@ -122,19 +122,15 @@ export default {
computed: { computed: {
// Wraps GroupedList and updates it if filter or sort changes // Wraps GroupedList and updates it if filter or sort changes
artists() { artists() {
if (!this.artists_list) { const { options } = this.groupings.find(
return []
}
const grouping = this.groupings.find(
(grouping) => grouping.id === this.selected_grouping_id (grouping) => grouping.id === this.selected_grouping_id
) )
grouping.options.filters = [ options.filters = [
(artist) => (artist) =>
!this.hide_singles || artist.track_count > artist.album_count * 2, !this.hide_singles || artist.track_count > artist.album_count * 2,
(artist) => !this.hide_spotify || artist.data_kind !== 'spotify' (artist) => !this.hide_spotify || artist.data_kind !== 'spotify'
] ]
this.artists_list.group(grouping.options) return this.artists_list.group(options)
return this.artists_list
}, },
hide_singles: { hide_singles: {
get() { get() {

View File

@ -135,11 +135,10 @@ export default {
} }
}, },
tracks() { tracks() {
const grouping = this.groupings.find( const { options } = this.groupings.find(
(grouping) => grouping.id === this.selected_grouping_id (grouping) => grouping.id === this.selected_grouping_id
) )
this.tracks_list.group(grouping.options) return this.tracks_list.group(options)
return this.tracks_list
} }
}, },

View File

@ -131,11 +131,10 @@ export default {
} }
}, },
tracks() { tracks() {
const grouping = this.groupings.find( const { options } = this.groupings.find(
(grouping) => grouping.id === this.selected_grouping_id (grouping) => grouping.id === this.selected_grouping_id
) )
this.tracks_list.group(grouping.options) return this.tracks_list.group(options)
return this.tracks_list
} }
}, },

View File

@ -66,7 +66,7 @@ export default {
computed: { computed: {
playlists() { playlists() {
this.playlists_list.group({ return this.playlists_list.group({
filters: [ filters: [
(playlist) => (playlist) =>
playlist.folder || playlist.folder ||
@ -75,7 +75,6 @@ export default {
playlist.item_count > playlist.stream_count playlist.item_count > playlist.stream_count
] ]
}) })
return this.playlists_list
}, },
radio_playlists() { radio_playlists() {
return this.$store.state.config.radio_playlists return this.$store.state.config.radio_playlists