mirror of
https://github.com/gotson/komga.git
synced 2026-05-07 12:01:40 +02:00
perf(webui): load background data in parallel when possible
This commit is contained in:
parent
b41499d775
commit
c0d7be9627
5 changed files with 36 additions and 26 deletions
|
|
@ -128,8 +128,10 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
async loadCounts(libraryId: string) {
|
async loadCounts(libraryId: string) {
|
||||||
const lib = libraryId !== LIBRARIES_ALL ? [libraryId] : undefined
|
const lib = libraryId !== LIBRARIES_ALL ? [libraryId] : undefined
|
||||||
this.collectionsCount = (await this.$komgaCollections.getCollections(lib, {size: 1})).totalElements
|
this.$komgaCollections.getCollections(lib, {size: 0})
|
||||||
this.readListsCount = (await this.$komgaReadLists.getReadLists(lib, {size: 1})).totalElements
|
.then(v => this.collectionsCount = v.totalElements)
|
||||||
|
await this.$komgaReadLists.getReadLists(lib, {size: 0})
|
||||||
|
.then(v => this.readListsCount = v.totalElements)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -454,39 +454,43 @@ export default Vue.extend({
|
||||||
id: this.$route.query.contextId as string,
|
id: this.$route.query.contextId as string,
|
||||||
}
|
}
|
||||||
this.book.context = this.context
|
this.book.context = this.context
|
||||||
this.contextName = (await (this.$komgaReadLists.getOneReadList(this.context.id))).name
|
this.$komgaReadLists.getOneReadList(this.context.id)
|
||||||
|
.then(v => this.contextName = v.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get siblings depending on origin
|
// Get siblings depending on origin
|
||||||
if (this?.context.origin === ContextOrigin.READLIST) {
|
if (this?.context.origin === ContextOrigin.READLIST) {
|
||||||
this.siblings = (await this.$komgaReadLists.getBooks(this.context.id, {unpaged: true} as PageRequest)).content
|
this.$komgaReadLists.getBooks(this.context.id, {unpaged: true} as PageRequest)
|
||||||
|
.then(v => this.siblings = v.content)
|
||||||
} else {
|
} else {
|
||||||
this.siblings = (await this.$komgaSeries.getBooks(this.book.seriesId, {unpaged: true} as PageRequest)).content
|
this.$komgaSeries.getBooks(this.book.seriesId, {unpaged: true} as PageRequest)
|
||||||
|
.then(v => this.siblings = v.content)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.readLists = await this.$komgaBooks.getReadLists(this.bookId)
|
this.$komgaBooks.getReadLists(this.bookId)
|
||||||
|
.then(v => this.readLists = v)
|
||||||
|
|
||||||
if (this.$_.has(this.book, 'metadata.title')) {
|
if (this.$_.has(this.book, 'metadata.title')) {
|
||||||
document.title = `Komga - ${getBookTitleCompact(this.book.metadata.title, this.series.metadata.title)}`
|
document.title = `Komga - ${getBookTitleCompact(this.book.metadata.title, this.series.metadata.title)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (this?.context.origin === ContextOrigin.READLIST) {
|
||||||
if (this?.context.origin === ContextOrigin.READLIST) {
|
this.$komgaReadLists.getBookSiblingNext(this.context.id, bookId)
|
||||||
this.siblingNext = await this.$komgaReadLists.getBookSiblingNext(this.context.id, bookId)
|
.then(v => this.siblingNext = v)
|
||||||
} else {
|
.catch(e => this.siblingNext = {} as BookDto)
|
||||||
this.siblingNext = await this.$komgaBooks.getBookSiblingNext(bookId)
|
} else {
|
||||||
}
|
this.$komgaBooks.getBookSiblingNext(bookId)
|
||||||
} catch (e) {
|
.then(v => this.siblingNext = v)
|
||||||
this.siblingNext = {} as BookDto
|
.catch(e => this.siblingNext = {} as BookDto)
|
||||||
}
|
}
|
||||||
try {
|
if (this?.context.origin === ContextOrigin.READLIST) {
|
||||||
if (this?.context.origin === ContextOrigin.READLIST) {
|
this.$komgaReadLists.getBookSiblingPrevious(this.context.id, bookId)
|
||||||
this.siblingPrevious = await this.$komgaReadLists.getBookSiblingPrevious(this.context.id, bookId)
|
.then(v => this.siblingPrevious = v)
|
||||||
} else {
|
.catch(e => this.siblingPrevious = {} as BookDto)
|
||||||
this.siblingPrevious = await this.$komgaBooks.getBookSiblingPrevious(bookId)
|
} else {
|
||||||
}
|
this.$komgaBooks.getBookSiblingPrevious(bookId)
|
||||||
} catch (e) {
|
.then(v => this.siblingPrevious = v)
|
||||||
this.siblingPrevious = {} as BookDto
|
.catch(e => this.siblingPrevious = {} as BookDto)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
analyze() {
|
analyze() {
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,8 @@ export default Vue.extend({
|
||||||
this.selectedSeries = []
|
this.selectedSeries = []
|
||||||
},
|
},
|
||||||
async loadCollection(collectionId: string) {
|
async loadCollection(collectionId: string) {
|
||||||
this.collection = await this.$komgaCollections.getOneCollection(collectionId)
|
this.$komgaCollections.getOneCollection(collectionId)
|
||||||
|
.then(v => this.collection = v)
|
||||||
|
|
||||||
await this.loadSeries(collectionId)
|
await this.loadSeries(collectionId)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,8 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async loadReadList (readListId: string) {
|
async loadReadList (readListId: string) {
|
||||||
this.readList = await this.$komgaReadLists.getOneReadList(readListId)
|
this.$komgaReadLists.getOneReadList(readListId)
|
||||||
|
.then(v => this.readList = v)
|
||||||
this.books = (await this.$komgaReadLists.getBooks(readListId, { unpaged: true } as PageRequest)).content
|
this.books = (await this.$komgaReadLists.getBooks(readListId, { unpaged: true } as PageRequest)).content
|
||||||
this.books.forEach((x: BookDto) => x.context = { origin: ContextOrigin.READLIST, id: readListId })
|
this.books.forEach((x: BookDto) => x.context = { origin: ContextOrigin.READLIST, id: readListId })
|
||||||
this.booksCopy = [...this.books]
|
this.booksCopy = [...this.books]
|
||||||
|
|
|
||||||
|
|
@ -646,8 +646,10 @@ export default Vue.extend({
|
||||||
if (event.seriesId === this.seriesId) this.loadSeries(this.seriesId)
|
if (event.seriesId === this.seriesId) this.loadSeries(this.seriesId)
|
||||||
},
|
},
|
||||||
async loadSeries(seriesId: string) {
|
async loadSeries(seriesId: string) {
|
||||||
this.series = await this.$komgaSeries.getOneSeries(seriesId)
|
this.$komgaSeries.getOneSeries(seriesId)
|
||||||
this.collections = await this.$komgaSeries.getCollections(seriesId)
|
.then(v => this.series = v)
|
||||||
|
this.$komgaSeries.getCollections(seriesId)
|
||||||
|
.then(v => this.collections = v)
|
||||||
|
|
||||||
await this.loadPage(seriesId, this.page, this.sortActive)
|
await this.loadPage(seriesId, this.page, this.sortActive)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue