From 4791da1447172b26ff3b06c71bb15e456e4a26b0 Mon Sep 17 00:00:00 2001 From: Joe Milazzo Date: Sat, 15 Apr 2023 10:42:22 -0500 Subject: [PATCH] Library Settings for Reading List Creation (#1930) * Added the code for Library Settings to allow turning off Reading List creation. * Fixed a typo --- API/Controllers/LibraryController.cs | 2 ++ API/DTOs/LibraryDto.cs | 4 ++++ API/DTOs/UpdateLibraryDto.cs | 1 + UI/Web/src/app/_models/library.ts | 1 + .../library-settings-modal.component.html | 18 ++++++++++++++++-- .../library-settings-modal.component.ts | 2 ++ openapi.json | 9 ++++++++- 7 files changed, 34 insertions(+), 3 deletions(-) diff --git a/API/Controllers/LibraryController.cs b/API/Controllers/LibraryController.cs index ffc3ef788..a4f93b723 100644 --- a/API/Controllers/LibraryController.cs +++ b/API/Controllers/LibraryController.cs @@ -338,6 +338,8 @@ public class LibraryController : BaseApiController library.IncludeInRecommended = dto.IncludeInRecommended; library.IncludeInSearch = dto.IncludeInSearch; library.ManageCollections = dto.ManageCollections; + library.ManageReadingLists = dto.ManageReadingLists; + _unitOfWork.LibraryRepository.Update(library); diff --git a/API/DTOs/LibraryDto.cs b/API/DTOs/LibraryDto.cs index 7696f6fbe..fc0eed135 100644 --- a/API/DTOs/LibraryDto.cs +++ b/API/DTOs/LibraryDto.cs @@ -34,6 +34,10 @@ public class LibraryDto /// public bool ManageCollections { get; set; } = true; /// + /// Should this library create and manage reading lists from Metadata + /// + public bool ManageReadingLists { get; set; } = true; + /// /// Include library series in Search /// public bool IncludeInSearch { get; set; } = true; diff --git a/API/DTOs/UpdateLibraryDto.cs b/API/DTOs/UpdateLibraryDto.cs index 0f3b2d642..79fbe786e 100644 --- a/API/DTOs/UpdateLibraryDto.cs +++ b/API/DTOs/UpdateLibraryDto.cs @@ -24,4 +24,5 @@ public class UpdateLibraryDto public bool IncludeInSearch { get; init; } [Required] public bool ManageCollections { get; init; } + public bool ManageReadingLists { get; init; } } diff --git a/UI/Web/src/app/_models/library.ts b/UI/Web/src/app/_models/library.ts index 4e4557c35..7a36812ef 100644 --- a/UI/Web/src/app/_models/library.ts +++ b/UI/Web/src/app/_models/library.ts @@ -16,5 +16,6 @@ export interface Library { includeInRecommended: boolean; includeInSearch: boolean; manageCollections: boolean; + manageReadingLists: boolean; collapseSeriesRelationships: boolean; } \ No newline at end of file diff --git a/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.html b/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.html index ea1a54734..ded5d9ea6 100644 --- a/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.html +++ b/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.html @@ -96,12 +96,26 @@
- +

- Should Kavita create and update Collections from SeriesGroup tags found within ComicInfo.xml files + Should Kavita create Collections from SeriesGroup tags found within ComicInfo.xml files +

+
+ + +
+
+
+
+ + +
+
+

+ Should Kavita create Reading Lists from StoryArc/StoryArcNumber and AlternativeSeries/AlternativeCount tags found within ComicInfo.xml files

diff --git a/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.ts b/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.ts index a700682ff..9cafc2118 100644 --- a/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.ts +++ b/UI/Web/src/app/sidenav/_modals/library-settings-modal/library-settings-modal.component.ts @@ -47,6 +47,7 @@ export class LibrarySettingsModalComponent implements OnInit, OnDestroy { includeInRecommended: new FormControl(true, { nonNullable: true, validators: [Validators.required] }), includeInSearch: new FormControl(true, { nonNullable: true, validators: [Validators.required] }), manageCollections: new FormControl(true, { nonNullable: true, validators: [Validators.required] }), + manageReadingLists: new FormControl(true, { nonNullable: true, validators: [Validators.required] }), collapseSeriesRelationships: new FormControl(false, { nonNullable: true, validators: [Validators.required] }), }); @@ -120,6 +121,7 @@ export class LibrarySettingsModalComponent implements OnInit, OnDestroy { this.libraryForm.get('includeInRecommended')?.setValue(this.library.includeInRecommended); this.libraryForm.get('includeInSearch')?.setValue(this.library.includeInSearch); this.libraryForm.get('manageCollections')?.setValue(this.library.manageCollections); + this.libraryForm.get('manageReadingLists')?.setValue(this.library.manageReadingLists); this.libraryForm.get('collapseSeriesRelationships')?.setValue(this.library.collapseSeriesRelationships); this.selectedFolders = this.library.folders; this.madeChanges = false; diff --git a/openapi.json b/openapi.json index a27a17980..35120074d 100644 --- a/openapi.json +++ b/openapi.json @@ -7,7 +7,7 @@ "name": "GPL-3.0", "url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE" }, - "version": "0.7.1.35" + "version": "0.7.1.36" }, "servers": [ { @@ -11928,6 +11928,10 @@ "type": "boolean", "description": "Should this library create and manage collections from Metadata" }, + "manageReadingLists": { + "type": "boolean", + "description": "Should this library create and manage reading lists from Metadata" + }, "includeInSearch": { "type": "boolean", "description": "Include library series in Search" @@ -14569,6 +14573,9 @@ }, "manageCollections": { "type": "boolean" + }, + "manageReadingLists": { + "type": "boolean" } }, "additionalProperties": false