mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-16 09:08:04 -04:00
[web] Move grouping options to computed properties
This commit is contained in:
parent
368bb18aa8
commit
966d563418
@ -95,8 +95,22 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
albums_list: new GroupedList(),
|
albums_list: new GroupedList()
|
||||||
groupings: [
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
albums() {
|
||||||
|
const { options } = this.groupings.find(
|
||||||
|
(grouping) => grouping.id === this.uiStore.albums_sort
|
||||||
|
)
|
||||||
|
options.filters = [
|
||||||
|
(album) => !this.uiStore.hide_singles || album.track_count > 2,
|
||||||
|
(album) => !this.uiStore.hide_spotify || album.data_kind !== 'spotify'
|
||||||
|
]
|
||||||
|
return this.albums_list.group(options)
|
||||||
|
},
|
||||||
|
groupings() {
|
||||||
|
return [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: this.$t('page.albums.sort.name'),
|
name: this.$t('page.albums.sort.name'),
|
||||||
@ -141,18 +155,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
albums() {
|
|
||||||
const { options } = this.groupings.find(
|
|
||||||
(grouping) => grouping.id === this.uiStore.albums_sort
|
|
||||||
)
|
|
||||||
options.filters = [
|
|
||||||
(album) => !this.uiStore.hide_singles || album.track_count > 2,
|
|
||||||
(album) => !this.uiStore.hide_spotify || album.data_kind !== 'spotify'
|
|
||||||
]
|
|
||||||
return this.albums_list.group(options)
|
|
||||||
},
|
},
|
||||||
heading() {
|
heading() {
|
||||||
return {
|
return {
|
||||||
|
@ -104,18 +104,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
albums_list: new GroupedList(),
|
albums_list: new GroupedList(),
|
||||||
artist: {},
|
artist: {},
|
||||||
groupings: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: this.$t('page.artist.sort.name'),
|
|
||||||
options: { criteria: [{ field: 'name_sort', type: String }] }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: this.$t('page.artist.sort.release-date'),
|
|
||||||
options: { criteria: [{ field: 'date_released', type: Date }] }
|
|
||||||
}
|
|
||||||
],
|
|
||||||
show_details_modal: false
|
show_details_modal: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -129,6 +117,20 @@ export default {
|
|||||||
]
|
]
|
||||||
return this.albums_list.group(options)
|
return this.albums_list.group(options)
|
||||||
},
|
},
|
||||||
|
groupings() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: this.$t('page.artist.sort.name'),
|
||||||
|
options: { criteria: [{ field: 'name_sort', type: String }] }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: this.$t('page.artist.sort.release-date'),
|
||||||
|
options: { criteria: [{ field: 'date_released', type: Date }] }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
heading() {
|
heading() {
|
||||||
return {
|
return {
|
||||||
title: this.artist.name,
|
title: this.artist.name,
|
||||||
|
@ -106,7 +106,20 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
artist: {},
|
artist: {},
|
||||||
groupings: [
|
show_details_modal: false,
|
||||||
|
tracks_list: new GroupedList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
album_count() {
|
||||||
|
return new Set(
|
||||||
|
[...this.tracks]
|
||||||
|
.filter((track) => track.isItem)
|
||||||
|
.map((track) => track.item.album_id)
|
||||||
|
).size
|
||||||
|
},
|
||||||
|
groupings() {
|
||||||
|
return [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: this.$t('page.artist.sort.name'),
|
name: this.$t('page.artist.sort.name'),
|
||||||
@ -120,18 +133,7 @@ export default {
|
|||||||
index: { field: 'rating', type: 'Digits' }
|
index: { field: 'rating', type: 'Digits' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
show_details_modal: false,
|
|
||||||
tracks_list: new GroupedList()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
album_count() {
|
|
||||||
return new Set(
|
|
||||||
[...this.tracks]
|
|
||||||
.filter((track) => track.isItem)
|
|
||||||
.map((track) => track.item.album_id)
|
|
||||||
).size
|
|
||||||
},
|
},
|
||||||
heading() {
|
heading() {
|
||||||
return {
|
return {
|
||||||
|
@ -68,7 +68,6 @@ const dataObject = {
|
|||||||
load(to) {
|
load(to) {
|
||||||
return webapi.library_artists('music')
|
return webapi.library_artists('music')
|
||||||
},
|
},
|
||||||
|
|
||||||
set(vm, response) {
|
set(vm, response) {
|
||||||
vm.artists_list = new GroupedList(response.data)
|
vm.artists_list = new GroupedList(response.data)
|
||||||
}
|
}
|
||||||
@ -95,22 +94,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
artists_list: new GroupedList(),
|
artists_list: new GroupedList()
|
||||||
groupings: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: this.$t('page.artists.sort.name'),
|
|
||||||
options: { index: { field: 'name_sort', type: String } }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: this.$t('page.artists.sort.recently-added'),
|
|
||||||
options: {
|
|
||||||
criteria: [{ field: 'time_added', order: -1, type: Date }],
|
|
||||||
index: { field: 'time_added', type: Date }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -126,6 +110,23 @@ export default {
|
|||||||
]
|
]
|
||||||
return this.artists_list.group(options)
|
return this.artists_list.group(options)
|
||||||
},
|
},
|
||||||
|
groupings() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: this.$t('page.artists.sort.name'),
|
||||||
|
options: { index: { field: 'name_sort', type: String } }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: this.$t('page.artists.sort.recently-added'),
|
||||||
|
options: {
|
||||||
|
criteria: [{ field: 'time_added', order: -1, type: Date }],
|
||||||
|
index: { field: 'time_added', type: Date }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
heading() {
|
heading() {
|
||||||
return {
|
return {
|
||||||
title: this.$t('page.artists.title'),
|
title: this.$t('page.artists.title'),
|
||||||
|
@ -58,7 +58,6 @@ const dataObject = {
|
|||||||
webapi.library_composer_tracks(to.params.name)
|
webapi.library_composer_tracks(to.params.name)
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
|
||||||
set(vm, response) {
|
set(vm, response) {
|
||||||
vm.composer = response[0].data
|
vm.composer = response[0].data
|
||||||
vm.tracks_list = new GroupedList(response[1].data.tracks)
|
vm.tracks_list = new GroupedList(response[1].data.tracks)
|
||||||
@ -87,21 +86,6 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
composer: {},
|
composer: {},
|
||||||
groupings: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: this.$t('page.composer.sort.name'),
|
|
||||||
options: { index: { field: 'title_sort', type: String } }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: this.$t('page.composer.sort.rating'),
|
|
||||||
options: {
|
|
||||||
criteria: [{ field: 'rating', order: -1, type: Number }],
|
|
||||||
index: { field: 'rating', type: 'Digits' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
show_details_modal: false,
|
show_details_modal: false,
|
||||||
tracks_list: new GroupedList()
|
tracks_list: new GroupedList()
|
||||||
}
|
}
|
||||||
@ -134,6 +118,23 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
groupings() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: this.$t('page.composer.sort.name'),
|
||||||
|
options: { index: { field: 'title_sort', type: String } }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: this.$t('page.composer.sort.rating'),
|
||||||
|
options: {
|
||||||
|
criteria: [{ field: 'rating', order: -1, type: Number }],
|
||||||
|
index: { field: 'rating', type: 'Digits' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
open_albums() {
|
open_albums() {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'music-composer-albums',
|
name: 'music-composer-albums',
|
||||||
|
@ -87,7 +87,17 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
genre: {},
|
genre: {},
|
||||||
groupings: [
|
media_kind: this.$route.query.media_kind,
|
||||||
|
show_details_modal: false,
|
||||||
|
tracks_list: new GroupedList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
expression() {
|
||||||
|
return `genre is "${this.genre.name}" and media_kind is ${this.media_kind}`
|
||||||
|
},
|
||||||
|
groupings() {
|
||||||
|
return [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: this.$t('page.genre.sort.name'),
|
name: this.$t('page.genre.sort.name'),
|
||||||
@ -101,15 +111,7 @@ export default {
|
|||||||
index: { field: 'rating', type: 'Digits' }
|
index: { field: 'rating', type: 'Digits' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
media_kind: this.$route.query.media_kind,
|
|
||||||
show_details_modal: false,
|
|
||||||
tracks_list: new GroupedList()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
expression() {
|
|
||||||
return `genre is "${this.genre.name}" and media_kind is ${this.media_kind}`
|
|
||||||
},
|
},
|
||||||
heading() {
|
heading() {
|
||||||
if (this.genre.name) {
|
if (this.genre.name) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user