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

View File

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

View File

@ -210,7 +210,7 @@ export const mutations = {
} }
if (audiobook.book.genres && audiobook.book.genres.length) { if (audiobook.book.genres && audiobook.book.genres.length) {
audiobook.book.genres.forEach((genre) => { 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/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/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.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 // TEMP: Support old syntax for mobile app
this.router.get('/library/:id/audiobooks', LibraryController.middleware.bind(this), LibraryController.getBooksForLibrary.bind(this)) this.router.get('/library/:id/audiobooks', LibraryController.middleware.bind(this), LibraryController.getBooksForLibrary.bind(this))