[web] Reorder methods and properties

This commit is contained in:
Alain Nussbaumer 2023-12-14 10:48:44 +01:00
parent ba3f656b3a
commit 5b26bc47fa
2 changed files with 20 additions and 26 deletions

View File

@ -51,7 +51,6 @@ export default {
const resolved = this.$router.resolve(this.to) const resolved = this.$router.resolve(this.to)
return resolved.href return resolved.href
}, },
open_link() { open_link() {
if (this.show_burger_menu) { if (this.show_burger_menu) {
this.$store.commit(types.SHOW_BURGER_MENU, false) this.$store.commit(types.SHOW_BURGER_MENU, false)

View File

@ -116,11 +116,11 @@ export default {
name: 'PageQueue', name: 'PageQueue',
components: { components: {
ContentWithHeading, ContentWithHeading,
ListItemQueueItem,
draggable, draggable,
ModalDialogQueueItem, ListItemQueueItem,
ModalDialogAddUrlStream, ModalDialogAddUrlStream,
ModalDialogPlaylistSave ModalDialogPlaylistSave,
ModalDialogQueueItem
}, },
data() { data() {
@ -135,8 +135,11 @@ export default {
}, },
computed: { computed: {
state() { current_position() {
return this.$store.state.player const nowPlaying = this.$store.getters.now_playing
return nowPlaying === undefined || nowPlaying.position === undefined
? -1
: this.$store.getters.now_playing.position
}, },
is_queue_save_allowed() { is_queue_save_allowed() {
return ( return (
@ -155,30 +158,15 @@ export default {
/* Do nothing? Send move request in @end event */ /* Do nothing? Send move request in @end event */
} }
}, },
current_position() {
const nowPlaying = this.$store.getters.now_playing
return nowPlaying === undefined || nowPlaying.position === undefined
? -1
: this.$store.getters.now_playing.position
},
show_only_next_items() { show_only_next_items() {
return this.$store.state.show_only_next_items return this.$store.state.show_only_next_items
},
state() {
return this.$store.state.player
} }
}, },
methods: { methods: {
queue_clear() {
webapi.queue_clear()
},
update_show_next_items(e) {
this.$store.commit(types.SHOW_ONLY_NEXT_ITEMS, !this.show_only_next_items)
},
remove(item) {
webapi.queue_remove(item.id)
},
move_item(e) { move_item(e) {
const oldPosition = !this.show_only_next_items const oldPosition = !this.show_only_next_items
? e.oldIndex ? e.oldIndex
@ -189,7 +177,6 @@ export default {
webapi.queue_move(item.id, newPosition) webapi.queue_move(item.id, newPosition)
} }
}, },
open_dialog(item) { open_dialog(item) {
this.selected_item = item this.selected_item = item
this.show_details_modal = true this.show_details_modal = true
@ -198,7 +185,15 @@ export default {
open_add_stream_dialog() { open_add_stream_dialog() {
this.show_url_modal = true this.show_url_modal = true
}, },
queue_clear() {
webapi.queue_clear()
},
remove(item) {
webapi.queue_remove(item.id)
},
update_show_next_items(e) {
this.$store.commit(types.SHOW_ONLY_NEXT_ITEMS, !this.show_only_next_items)
},
save_dialog() { save_dialog() {
if (this.queue_items.length > 0) { if (this.queue_items.length > 0) {
this.show_pls_save_modal = true this.show_pls_save_modal = true