From 1d3f4e42472cae446e53ceacbbe181f48e88a54b Mon Sep 17 00:00:00 2001 From: Ben Kuskopf Date: Tue, 24 Aug 2021 13:30:12 +1000 Subject: [PATCH] feat(webui): display library name in book/series screen, empty all trash adds a button in 'Server Settings > Server' to empty trash for all libraries display the library name next to Series name on Book and Series details screen Co-authored-by: Gauthier Roebroeck --- komga-webui/src/locales/en.json | 2 ++ komga-webui/src/views/BrowseBook.vue | 33 ++++++++++++++++++------ komga-webui/src/views/BrowseSeries.vue | 13 ++++++++-- komga-webui/src/views/SettingsServer.vue | 28 +++++++++++++++++++- 4 files changed, 65 insertions(+), 11 deletions(-) diff --git a/komga-webui/src/locales/en.json b/komga-webui/src/locales/en.json index 0690f8320..b8baa5a77 100644 --- a/komga-webui/src/locales/en.json +++ b/komga-webui/src/locales/en.json @@ -172,6 +172,7 @@ "title": "{name} collection" }, "common": { + "library": "Library", "all_libraries": "All Libraries", "books": "Books", "books_n": "No book | 1 book | {count} books", @@ -628,6 +629,7 @@ }, "server": { "server_management": { + "button_empty_trash": "Empty trash for all libraries", "button_shutdown": "Shut down", "section_title": "Server Management" }, diff --git a/komga-webui/src/views/BrowseBook.vue b/komga-webui/src/views/BrowseBook.vue index 9eeddd318..0c0e1949f 100644 --- a/komga-webui/src/views/BrowseBook.vue +++ b/komga-webui/src/views/BrowseBook.vue @@ -101,8 +101,18 @@ - - {{ series.metadata.title }} + {{ series.metadata.title }} + + {{ $t('searchbox.in_library', {library: getLibraryName(book)}) }} @@ -127,13 +137,17 @@ }} - + {{ $t('browse_book.outdated_tooltip') }} + + {{ $t('browse_book.outdated_tooltip') }} + @@ -480,13 +494,16 @@ export default Vue.extend({ }, }, methods: { + getLibraryName(item: BookDto): string { + return this.$store.getters.getLibraryById(item.libraryId).name + }, libraryDeleted(event: LibrarySseDto) { if (event.libraryId === this.book.libraryId) { this.$router.push({name: 'home'}) } }, readListChanged(event: ReadListSseDto) { - if(event.bookIds.includes(this.bookId) || this.readLists.map(x => x.id).includes(event.readListId)){ + if (event.bookIds.includes(this.bookId) || this.readLists.map(x => x.id).includes(event.readListId)) { this.$komgaBooks.getReadLists(this.bookId) .then(v => this.readLists = v) } @@ -495,11 +512,11 @@ export default Vue.extend({ if (event.bookId === this.bookId) this.loadBook(this.bookId) }, bookDeleted(event: BookSseDto) { - if (event.bookId === this.bookId){ - this.$router.push({name:'browse-series', params: {seriesId: this.series.id }}) + if (event.bookId === this.bookId) { + this.$router.push({name: 'browse-series', params: {seriesId: this.series.id}}) } }, - readProgressChanged(event: ReadProgressSseDto){ + readProgressChanged(event: ReadProgressSseDto) { if (event.bookId === this.bookId) this.loadBook(this.bookId) }, async loadBook(bookId: string) { diff --git a/komga-webui/src/views/BrowseSeries.vue b/komga-webui/src/views/BrowseSeries.vue index 059bb5868..593408fba 100644 --- a/komga-webui/src/views/BrowseSeries.vue +++ b/komga-webui/src/views/BrowseSeries.vue @@ -17,7 +17,6 @@ - {{ series.metadata.title }} @@ -96,7 +95,14 @@ -
{{ series.metadata.title }}
+ {{ series.metadata.title }} + {{ $t('searchbox.in_library', {library: getLibraryName(series)}) }} +
@@ -648,6 +654,9 @@ export default Vue.extend({ next() }, methods: { + getLibraryName(item: SeriesDto): string { + return this.$store.getters.getLibraryById(item.libraryId).name + }, resetSortAndFilters() { this.drawer = false for (const prop in this.filters) { diff --git a/komga-webui/src/views/SettingsServer.vue b/komga-webui/src/views/SettingsServer.vue index 66bca66b6..340cea6ef 100644 --- a/komga-webui/src/views/SettingsServer.vue +++ b/komga-webui/src/views/SettingsServer.vue @@ -5,12 +5,26 @@ + {{ $t('server.server_management.button_empty_trash') }} + {{ $t('server.server_management.button_shutdown') }} + >{{ $t('server.server_management.button_shutdown') }} + + + ({ modalStopServer: false, + confirmEmptyTrash: false, }), + computed: { + libraries(): LibraryDto[] { + return this.$store.state.komgaLibraries.libraries + }, + }, methods: { + emptyTrash() { + this.libraries.forEach(library => { + this.$komgaLibraries.emptyTrash(library) + }) + }, async stopServer() { try { await this.$actuator.shutdown()