mirror of
https://github.com/gotson/komga.git
synced 2025-01-09 04:08:00 +08:00
parent
7a21fe073e
commit
737bf1b120
@ -697,6 +697,7 @@
|
||||
"publisher": "publisher",
|
||||
"read": "Read",
|
||||
"release_date": "release date",
|
||||
"sharing_label": "Sharing Label",
|
||||
"status": "status",
|
||||
"tag": "tag",
|
||||
"unread": "Unread"
|
||||
|
@ -16,7 +16,7 @@ export default class KomgaSeriesService {
|
||||
async getSeries(libraryId?: string, pageRequest?: PageRequest, search?: string, status?: string[],
|
||||
readStatus?: string[], genre?: string[], tag?: string[], language?: string[],
|
||||
publisher?: string[], ageRating?: string[], releaseDate?: string[], authors?: AuthorDto[],
|
||||
searchRegex?: string, complete?: boolean): Promise<Page<SeriesDto>> {
|
||||
searchRegex?: string, complete?: boolean, sharingLabel?: string[]): Promise<Page<SeriesDto>> {
|
||||
try {
|
||||
const params = {...pageRequest} as any
|
||||
if (libraryId) params.library_id = libraryId
|
||||
@ -32,6 +32,7 @@ export default class KomgaSeriesService {
|
||||
if (releaseDate) params.release_year = releaseDate
|
||||
if (authors) params.author = authors.map(a => `${a.name},${a.role}`)
|
||||
if (complete !== undefined) params.complete = complete
|
||||
if (sharingLabel) params.sharing_label = sharingLabel
|
||||
|
||||
return (await this.http.get(API_SERIES, {
|
||||
params: params,
|
||||
@ -48,7 +49,8 @@ export default class KomgaSeriesService {
|
||||
|
||||
async getAlphabeticalGroups(libraryId?: string, search?: string, status?: string[],
|
||||
readStatus?: string[], genre?: string[], tag?: string[], language?: string[],
|
||||
publisher?: string[], ageRating?: string[], releaseDate?: string[], authors?: AuthorDto[], complete?: boolean): Promise<GroupCountDto[]> {
|
||||
publisher?: string[], ageRating?: string[], releaseDate?: string[], authors?: AuthorDto[],
|
||||
complete?: boolean, sharingLabel?: string[]): Promise<GroupCountDto[]> {
|
||||
try {
|
||||
const params = {} as any
|
||||
if (libraryId) params.library_id = libraryId
|
||||
@ -63,6 +65,7 @@ export default class KomgaSeriesService {
|
||||
if (releaseDate) params.release_year = releaseDate
|
||||
if (authors) params.author = authors.map(a => `${a.name},${a.role}`)
|
||||
if (complete !== undefined) params.complete = complete
|
||||
if (sharingLabel) params.sharing_label = sharingLabel
|
||||
|
||||
return (await this.http.get(`${API_SERIES}/alphabetical-groups`, {
|
||||
params: params,
|
||||
|
@ -201,6 +201,7 @@ export default Vue.extend({
|
||||
language: [] as NameValue[],
|
||||
ageRating: [] as NameValue[],
|
||||
releaseDate: [] as NameValue[],
|
||||
sharingLabel: [] as NameValue[],
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -325,6 +326,7 @@ export default Vue.extend({
|
||||
},
|
||||
}
|
||||
})
|
||||
r['sharingLabel'] = {name: this.$t('filter.sharing_label').toString(), values: this.filterOptions.sharingLabel}
|
||||
return r
|
||||
},
|
||||
isAdmin(): boolean {
|
||||
@ -372,13 +374,14 @@ export default Vue.extend({
|
||||
const requestLibraryId = libraryId !== LIBRARIES_ALL ? libraryId : undefined
|
||||
|
||||
// load dynamic filters
|
||||
const [genres, tags, publishers, languages, ageRatings, releaseDates] = await Promise.all([
|
||||
const [genres, tags, publishers, languages, ageRatings, releaseDates, sharingLabels] = await Promise.all([
|
||||
this.$komgaReferential.getGenres(requestLibraryId),
|
||||
this.$komgaReferential.getSeriesAndBookTags(requestLibraryId),
|
||||
this.$komgaReferential.getPublishers(requestLibraryId),
|
||||
this.$komgaReferential.getLanguages(requestLibraryId),
|
||||
this.$komgaReferential.getAgeRatings(requestLibraryId),
|
||||
this.$komgaReferential.getSeriesReleaseDates(requestLibraryId),
|
||||
this.$komgaReferential.getSharingLabels(requestLibraryId),
|
||||
])
|
||||
this.$set(this.filterOptions, 'genre', toNameValue(genres))
|
||||
this.$set(this.filterOptions, 'tag', toNameValue(tags))
|
||||
@ -386,10 +389,11 @@ export default Vue.extend({
|
||||
this.$set(this.filterOptions, 'language', (languages))
|
||||
this.$set(this.filterOptions, 'ageRating', toNameValue(ageRatings))
|
||||
this.$set(this.filterOptions, 'releaseDate', toNameValue(releaseDates))
|
||||
this.$set(this.filterOptions, 'sharingLabel', toNameValue(sharingLabels))
|
||||
|
||||
// get filter from query params or local storage and validate with available filter values
|
||||
let activeFilters: any
|
||||
if (route.query.status || route.query.readStatus || route.query.genre || route.query.tag || route.query.language || route.query.ageRating || route.query.publisher || authorRoles.some(role => role in route.query) || route.query.complete) {
|
||||
if (route.query.status || route.query.readStatus || route.query.genre || route.query.tag || route.query.language || route.query.ageRating || route.query.publisher || authorRoles.some(role => role in route.query) || route.query.complete || route.query.sharingLabel) {
|
||||
activeFilters = {
|
||||
status: route.query.status || [],
|
||||
readStatus: route.query.readStatus || [],
|
||||
@ -400,6 +404,7 @@ export default Vue.extend({
|
||||
ageRating: route.query.ageRating || [],
|
||||
releaseDate: route.query.releaseDate || [],
|
||||
complete: route.query.complete || [],
|
||||
sharingLabel: route.query.sharingLabel || [],
|
||||
}
|
||||
authorRoles.forEach((role: string) => {
|
||||
activeFilters[role] = route.query[role] || []
|
||||
@ -420,6 +425,7 @@ export default Vue.extend({
|
||||
ageRating: filters.ageRating?.filter(x => this.filterOptions.ageRating.map(n => n.value).includes(x)) || [],
|
||||
releaseDate: filters.releaseDate?.filter(x => this.filterOptions.releaseDate.map(n => n.value).includes(x)) || [],
|
||||
complete: filters.complete?.filter(x => x === 'true' || x === 'false') || [],
|
||||
sharingLabel: filters.sharingLabel?.filter(x => this.filterOptions.sharingLabel.map(n => n.value).includes(x)) || [],
|
||||
} as any
|
||||
authorRoles.forEach((role: string) => {
|
||||
validFilter[role] = filters[role] || []
|
||||
@ -526,13 +532,13 @@ export default Vue.extend({
|
||||
|
||||
const requestLibraryId = libraryId !== LIBRARIES_ALL ? libraryId : undefined
|
||||
const complete = parseBooleanFilter(this.filters.complete)
|
||||
const seriesPage = await this.$komgaSeries.getSeries(requestLibraryId, pageRequest, undefined, this.filters.status, replaceCompositeReadStatus(this.filters.readStatus), this.filters.genre, this.filters.tag, this.filters.language, this.filters.publisher, this.filters.ageRating, this.filters.releaseDate, authorsFilter, searchRegex, complete)
|
||||
const seriesPage = await this.$komgaSeries.getSeries(requestLibraryId, pageRequest, undefined, this.filters.status, replaceCompositeReadStatus(this.filters.readStatus), this.filters.genre, this.filters.tag, this.filters.language, this.filters.publisher, this.filters.ageRating, this.filters.releaseDate, authorsFilter, searchRegex, complete, this.filters.sharingLabel)
|
||||
|
||||
this.totalPages = seriesPage.totalPages
|
||||
this.totalElements = seriesPage.totalElements
|
||||
this.series = seriesPage.content
|
||||
|
||||
const seriesGroups = await this.$komgaSeries.getAlphabeticalGroups(requestLibraryId, undefined, this.filters.status, replaceCompositeReadStatus(this.filters.readStatus), this.filters.genre, this.filters.tag, this.filters.language, this.filters.publisher, this.filters.ageRating, this.filters.releaseDate, authorsFilter, complete)
|
||||
const seriesGroups = await this.$komgaSeries.getAlphabeticalGroups(requestLibraryId, undefined, this.filters.status, replaceCompositeReadStatus(this.filters.readStatus), this.filters.genre, this.filters.tag, this.filters.language, this.filters.publisher, this.filters.ageRating, this.filters.releaseDate, authorsFilter, complete, this.filters.sharingLabel)
|
||||
const nonAlpha = seriesGroups
|
||||
.filter((g) => !(/[a-zA-Z]/).test(g.group))
|
||||
.reduce((a, b) => a + b.count, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user