mirror of
https://github.com/gotson/komga.git
synced 2026-05-07 12:01:40 +02:00
fix(webui): restore library alphabetical navigation from url
This commit is contained in:
parent
e476d78770
commit
1faaf12de4
2 changed files with 21 additions and 20 deletions
|
|
@ -13,10 +13,9 @@
|
||||||
icon
|
icon
|
||||||
@click="clicked(symbol)"
|
@click="clicked(symbol)"
|
||||||
:color="selected === symbol ? 'secondary' : undefined"
|
:color="selected === symbol ? 'secondary' : undefined"
|
||||||
:disabled="groupCount ? getCount(symbol) === 0 : false"
|
:disabled="groupCount && selected !== symbol ? getCount(symbol) === 0 : false"
|
||||||
v-on="on"
|
v-on="on"
|
||||||
>
|
>
|
||||||
<!-- <v-icon>mdi-alpha-{{ symbol.toLowerCase() }}</v-icon>-->
|
|
||||||
{{ symbol }}
|
{{ symbol }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,14 @@
|
||||||
</filter-drawer>
|
</filter-drawer>
|
||||||
|
|
||||||
<v-container fluid>
|
<v-container fluid>
|
||||||
|
<alphabetical-navigation
|
||||||
|
class="text-center"
|
||||||
|
:symbols="alphabeticalNavigation"
|
||||||
|
:selected="selectedSymbol"
|
||||||
|
:group-count="seriesGroups"
|
||||||
|
@clicked="filterByStarting"
|
||||||
|
/>
|
||||||
|
|
||||||
<empty-state
|
<empty-state
|
||||||
v-if="totalPages === 0 && sortOrFilterActive"
|
v-if="totalPages === 0 && sortOrFilterActive"
|
||||||
:title="$t('common.filter_no_matches')"
|
:title="$t('common.filter_no_matches')"
|
||||||
|
|
@ -87,14 +95,6 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<template v-if="totalPages > 0">
|
<template v-if="totalPages > 0">
|
||||||
<alphabetical-navigation
|
|
||||||
class="text-center"
|
|
||||||
:symbols="alphabeticalNavigation"
|
|
||||||
:selected="selectedSymbol"
|
|
||||||
:group-count="seriesGroups"
|
|
||||||
@clicked="filterByStarting"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<v-pagination
|
<v-pagination
|
||||||
v-if="totalPages > 1"
|
v-if="totalPages > 1"
|
||||||
v-model="page"
|
v-model="page"
|
||||||
|
|
@ -156,7 +156,7 @@ import {LibrarySseDto, ReadProgressSeriesSseDto, SeriesSseDto} from '@/types/kom
|
||||||
import {throttle} from 'lodash'
|
import {throttle} from 'lodash'
|
||||||
import AlphabeticalNavigation from '@/components/AlphabeticalNavigation.vue'
|
import AlphabeticalNavigation from '@/components/AlphabeticalNavigation.vue'
|
||||||
import {LibraryDto} from '@/types/komga-libraries'
|
import {LibraryDto} from '@/types/komga-libraries'
|
||||||
import { ItemContext } from '@/types/items'
|
import {ItemContext} from '@/types/items'
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'BrowseLibraries',
|
name: 'BrowseLibraries',
|
||||||
|
|
@ -180,7 +180,6 @@ export default Vue.extend({
|
||||||
series: [] as SeriesDto[],
|
series: [] as SeriesDto[],
|
||||||
seriesGroups: [] as GroupCountDto[],
|
seriesGroups: [] as GroupCountDto[],
|
||||||
alphabeticalNavigation: ['ALL', '#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
|
alphabeticalNavigation: ['ALL', '#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
|
||||||
searchRegex: undefined as any,
|
|
||||||
selectedSymbol: 'ALL',
|
selectedSymbol: 'ALL',
|
||||||
selectedSeries: [] as SeriesDto[],
|
selectedSeries: [] as SeriesDto[],
|
||||||
page: 1,
|
page: 1,
|
||||||
|
|
@ -237,6 +236,7 @@ export default Vue.extend({
|
||||||
await this.resetParams(this.$route, this.libraryId)
|
await this.resetParams(this.$route, this.libraryId)
|
||||||
if (this.$route.query.page) this.page = Number(this.$route.query.page)
|
if (this.$route.query.page) this.page = Number(this.$route.query.page)
|
||||||
if (this.$route.query.pageSize) this.pageSize = Number(this.$route.query.pageSize)
|
if (this.$route.query.pageSize) this.pageSize = Number(this.$route.query.pageSize)
|
||||||
|
if (this.$route.query.nav) this.selectedSymbol = this.$route.query.nav.toString()
|
||||||
|
|
||||||
this.loadLibrary(this.libraryId)
|
this.loadLibrary(this.libraryId)
|
||||||
|
|
||||||
|
|
@ -254,7 +254,6 @@ export default Vue.extend({
|
||||||
this.series = []
|
this.series = []
|
||||||
this.seriesGroups = []
|
this.seriesGroups = []
|
||||||
this.selectedSymbol = 'ALL'
|
this.selectedSymbol = 'ALL'
|
||||||
this.searchRegex = undefined
|
|
||||||
|
|
||||||
this.loadLibrary(to.params.libraryId)
|
this.loadLibrary(to.params.libraryId)
|
||||||
|
|
||||||
|
|
@ -264,10 +263,15 @@ export default Vue.extend({
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
searchRegex(): string | undefined {
|
||||||
|
if (this.selectedSymbol === 'ALL') return undefined
|
||||||
|
if (this.selectedSymbol === '#') return '^[^a-z],title_sort'
|
||||||
|
return `^${this.selectedSymbol},title_sort`
|
||||||
|
},
|
||||||
itemContext(): ItemContext[] {
|
itemContext(): ItemContext[] {
|
||||||
if(this.sortActive.key === 'booksMetadata.releaseDate') return [ItemContext.RELEASE_DATE]
|
if (this.sortActive.key === 'booksMetadata.releaseDate') return [ItemContext.RELEASE_DATE]
|
||||||
if(this.sortActive.key === 'createdDate') return [ItemContext.DATE_ADDED]
|
if (this.sortActive.key === 'createdDate') return [ItemContext.DATE_ADDED]
|
||||||
if(this.sortActive.key === 'lastModifiedDate') return [ItemContext.DATE_UPDATED]
|
if (this.sortActive.key === 'lastModifiedDate') return [ItemContext.DATE_UPDATED]
|
||||||
return []
|
return []
|
||||||
},
|
},
|
||||||
sortOptions(): SortOption[] {
|
sortOptions(): SortOption[] {
|
||||||
|
|
@ -345,12 +349,9 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
filterByStarting(symbol: string) {
|
filterByStarting(symbol: string) {
|
||||||
if (symbol === 'ALL') this.searchRegex = undefined
|
|
||||||
else if (symbol === '#') this.searchRegex = '^[^a-z],title_sort'
|
|
||||||
else this.searchRegex = `^${symbol},title_sort`
|
|
||||||
|
|
||||||
this.selectedSymbol = symbol
|
this.selectedSymbol = symbol
|
||||||
this.page = 1
|
this.page = 1
|
||||||
|
this.updateRoute()
|
||||||
this.loadPage(this.libraryId, 1, this.sortActive, this.searchRegex)
|
this.loadPage(this.libraryId, 1, this.sortActive, this.searchRegex)
|
||||||
},
|
},
|
||||||
resetSortAndFilters() {
|
resetSortAndFilters() {
|
||||||
|
|
@ -493,6 +494,7 @@ export default Vue.extend({
|
||||||
page: `${this.page}`,
|
page: `${this.page}`,
|
||||||
pageSize: `${this.pageSize}`,
|
pageSize: `${this.pageSize}`,
|
||||||
sort: `${this.sortActive.key},${this.sortActive.order}`,
|
sort: `${this.sortActive.key},${this.sortActive.order}`,
|
||||||
|
nav: this.selectedSymbol,
|
||||||
},
|
},
|
||||||
} as Location
|
} as Location
|
||||||
mergeFilterParams(this.filters, loc.query)
|
mergeFilterParams(this.filters, loc.query)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue