added select all option for library items

This commit is contained in:
zipben 2025-06-05 01:08:08 +00:00
parent 140544ba77
commit 9baca4f16c
7 changed files with 169 additions and 10 deletions

View file

@ -1,7 +1,7 @@
<template>
<div class="page" :class="streamLibraryItem ? 'streaming' : ''">
<app-book-shelf-toolbar :page="id || ''" />
<app-lazy-bookshelf :page="id || ''" />
<app-book-shelf-toolbar :page="id || ''" @select-all-items="selectAllItems" />
<app-lazy-bookshelf ref="lazyBookshelf" :page="id || ''" />
</div>
</template>
@ -44,6 +44,13 @@ export default {
return this.$store.state.streamLibraryItem
}
},
methods: {}
methods: {
selectAllItems() {
if (this.$refs.lazyBookshelf) {
this.$refs.lazyBookshelf.selectAllItems()
} else {
}
}
}
}
</script>

View file

@ -1,7 +1,7 @@
<template>
<div class="page" :class="streamLibraryItem ? 'streaming' : ''">
<app-book-shelf-toolbar is-home />
<app-book-shelf-categorized />
<app-book-shelf-toolbar is-home @select-all-items="selectAllItems" />
<app-book-shelf-categorized ref="bookShelfCategorized" />
</div>
</template>
@ -25,7 +25,14 @@ export default {
return this.$store.state.streamLibraryItem
}
},
methods: {},
methods: {
selectAllItems() {
if (this.$refs.bookShelfCategorized) {
this.$refs.bookShelfCategorized.selectAllItems()
} else {
}
}
},
mounted() {},
beforeDestroy() {}
}

View file

@ -1,6 +1,6 @@
<template>
<div class="page" :class="streamLibraryItem ? 'streaming' : ''">
<app-book-shelf-toolbar is-home page="search" :search-query="query" />
<app-book-shelf-toolbar is-home page="search" :search-query="query" @select-all-items="selectAllItems" />
<app-book-shelf-categorized v-if="hasResults" ref="bookshelf" search :results="results" />
<div v-else class="w-full py-16">
<p class="text-xl text-center">{{ $getString('MessageNoSearchResultsFor', [query]) }}</p>
@ -11,10 +11,13 @@
<script>
export default {
async asyncData({ store, params, redirect, query, app }) {
if (!query.q) {
return redirect(`/library/${params.library}`)
}
const libraryId = params.library
const library = await store.dispatch('libraries/fetch', libraryId)
if (!library) {
return redirect('/oops?message=Library not found')
return redirect(`/oops?message=Library "${libraryId}" not found`)
}
let results = await app.$axios.$get(`/api/libraries/${libraryId}/search?q=${encodeURIComponent(query.q)}`).catch((error) => {
console.error('Failed to search library', error)
@ -74,6 +77,12 @@ export default {
this.$refs.bookshelf.setShelvesFromSearch()
}
})
},
selectAllItems() {
if (this.$refs.bookshelf) {
this.$refs.bookshelf.selectAllItems()
} else {
}
}
},
mounted() {},