Fix:Reorder libraries route and draggable table,Fix:Update filter daata

This commit is contained in:
advplyr 2021-12-05 09:52:23 -06:00
parent b68c181631
commit 040548c6db
4 changed files with 13 additions and 13 deletions

View File

@ -59,9 +59,6 @@ export default {
}
},
methods: {
itemClicked() {
// this.$emit('click', this.library)
},
editClick() {
this.$emit('edit', this.library)
},
@ -69,7 +66,7 @@ export default {
this.$root.socket.emit('scan', this.library.id)
},
forceScan() {
this.$root.socket.emit('scan', this.library.id, {forceRescan: true})
this.$root.socket.emit('scan', this.library.id, { forceRescan: true })
},
deleteClick() {
if (this.isMain) return

View File

@ -6,12 +6,12 @@
<span class="material-icons" style="font-size: 1.4rem">add</span>
</div>
</div>
<draggable v-model="libraryCopies" v-bind="dragOptions" class="list-group" draggable=".item" tag="div" @start="startDrag" @end="endDrag">
<!-- <transition-group type="transition" :name="!drag ? 'flip-list' : null"> -->
<draggable :list="libraryCopies" v-bind="dragOptions" class="list-group" draggable=".item" tag="div" @start="startDrag" @end="endDrag">
<template v-for="library in libraryCopies">
<modals-libraries-library-item :key="library.id" :library="library" :selected="currentLibraryId === library.id" :show-edit="true" :dragging="drag" @edit="editLibrary" @click="setLibrary" class="item" />
<div :key="library.id" class="item">
<modals-libraries-library-item :library="library" :selected="currentLibraryId === library.id" :show-edit="true" :dragging="drag" @edit="editLibrary" @sort="draggableSort" @click="setLibrary" />
</div>
</template>
<!-- </transition-group> -->
</draggable>
<modals-edit-library-modal v-model="showLibraryModal" :library="selectedLibrary" />
</div>
@ -48,6 +48,9 @@ export default {
},
libraries() {
return this.$store.getters['libraries/getSortedLibraries']()
},
libraryScans() {
return this.$store.state.scanners.libraryScans
}
},
methods: {
@ -55,10 +58,9 @@ export default {
this.drag = true
clearTimeout(this.orderTimeout)
},
endDrag() {
endDrag(e) {
this.drag = false
this.checkOrder()
console.log('DRAG END')
},
checkOrder() {
clearTimeout(this.orderTimeout)
@ -78,7 +80,7 @@ export default {
})
var newOrder = libraryOrderData.map((lib) => lib.id).join(',')
if (currOrder !== newOrder) {
this.$axios.$patch('/api/libraries/order', libraryOrderData).then((libraries) => {
this.$axios.$post('/api/libraries/order', libraryOrderData).then((libraries) => {
if (libraries && libraries.length) {
this.$toast.success('Library order saved', { timeout: 1500 })
this.$store.commit('libraries/set', libraries)

View File

@ -210,7 +210,7 @@ export const mutations = {
}
if (audiobook.book.genres && audiobook.book.genres.length) {
audiobook.book.genres.forEach((genre) => {
if (tag && !state.filterData.genres.includes(genre)) state.filterData.genres.push(genre)
if (genre && !state.filterData.genres.includes(genre)) state.filterData.genres.push(genre)
})
}
}

View File

@ -63,7 +63,8 @@ class ApiController {
this.router.get('/libraries/:id/search', LibraryController.middleware.bind(this), LibraryController.search.bind(this))
this.router.get('/libraries/:id/stats', LibraryController.middleware.bind(this), LibraryController.stats.bind(this))
this.router.get('/libraries/:id/authors', LibraryController.middleware.bind(this), LibraryController.getAuthors.bind(this))
this.router.patch('/libraries/order', LibraryController.reorder.bind(this))
this.router.post('/libraries/order', LibraryController.reorder.bind(this))
// TEMP: Support old syntax for mobile app
this.router.get('/library/:id/audiobooks', LibraryController.middleware.bind(this), LibraryController.getBooksForLibrary.bind(this))