Updated Matched Metadat to have a library type filter, given that a user might want to do just Comics or Manga at a time.
This commit is contained in:
parent
5db4c80410
commit
ef77474e33
9 changed files with 48 additions and 16 deletions
|
|
@ -15,5 +15,9 @@ public enum MatchStateOption
|
||||||
public sealed record ManageMatchFilterDto
|
public sealed record ManageMatchFilterDto
|
||||||
{
|
{
|
||||||
public MatchStateOption MatchStateOption { get; set; } = MatchStateOption.All;
|
public MatchStateOption MatchStateOption { get; set; } = MatchStateOption.All;
|
||||||
|
/// <summary>
|
||||||
|
/// Library Type in int form. -1 indicates to ignore the field.
|
||||||
|
/// </summary>
|
||||||
|
public int LibraryType { get; set; } = -1;
|
||||||
public string SearchTerm { get; set; } = string.Empty;
|
public string SearchTerm { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -234,6 +234,7 @@ public class ExternalSeriesMetadataRepository : IExternalSeriesMetadataRepositor
|
||||||
.Include(s => s.ExternalSeriesMetadata)
|
.Include(s => s.ExternalSeriesMetadata)
|
||||||
.Where(s => !ExternalMetadataService.NonEligibleLibraryTypes.Contains(s.Library.Type))
|
.Where(s => !ExternalMetadataService.NonEligibleLibraryTypes.Contains(s.Library.Type))
|
||||||
.Where(s => s.Library.AllowMetadataMatching)
|
.Where(s => s.Library.AllowMetadataMatching)
|
||||||
|
.WhereIf(filter.LibraryType >= 0, s => s.Library.Type == (LibraryType) filter.LibraryType)
|
||||||
.FilterMatchState(filter.MatchStateOption)
|
.FilterMatchState(filter.MatchStateOption)
|
||||||
.OrderBy(s => s.NormalizedName)
|
.OrderBy(s => s.NormalizedName)
|
||||||
.ProjectTo<ManageMatchSeriesDto>(_mapper.ConfigurationProvider)
|
.ProjectTo<ManageMatchSeriesDto>(_mapper.ConfigurationProvider)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import {MatchStateOption} from "./match-state-option";
|
import {MatchStateOption} from "./match-state-option";
|
||||||
|
import {LibraryType} from "../library/library";
|
||||||
|
|
||||||
export interface ManageMatchFilter {
|
export interface ManageMatchFilter {
|
||||||
matchStateOption: MatchStateOption;
|
matchStateOption: MatchStateOption;
|
||||||
|
libraryType: LibraryType | -1;
|
||||||
searchTerm: string;
|
searchTerm: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ export enum LibraryType {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const allLibraryTypes = [LibraryType.Manga, LibraryType.ComicVine, LibraryType.Comic, LibraryType.Book, LibraryType.LightNovel, LibraryType.Images];
|
export const allLibraryTypes = [LibraryType.Manga, LibraryType.ComicVine, LibraryType.Comic, LibraryType.Book, LibraryType.LightNovel, LibraryType.Images];
|
||||||
|
export const allKavitaPlusMetadataApplicableTypes = [LibraryType.Manga, LibraryType.LightNovel, LibraryType.ComicVine, LibraryType.Comic];
|
||||||
|
export const allKavitaPlusEligibleTypes = [LibraryType.Manga, LibraryType.LightNovel];
|
||||||
|
|
||||||
export interface Library {
|
export interface Library {
|
||||||
id: number;
|
id: number;
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,17 @@
|
||||||
|
|
||||||
<form [formGroup]="filterGroup">
|
<form [formGroup]="filterGroup">
|
||||||
<div class="row g-0">
|
<div class="row g-0">
|
||||||
<div class="col-auto ms-auto">
|
<div class="col-auto ms-auto me-3">
|
||||||
<label for="match-filter">Match State</label>
|
<label for="libtype-filter">{{t('library-type')}}</label>
|
||||||
|
<select class="form-select" formControlName="libraryType" id="libtype-filter">
|
||||||
|
<option [value]="-1">{{t('all-status-label')}}</option>
|
||||||
|
@for(libType of allLibraryTypes; track libType) {
|
||||||
|
<option [value]="libType">{{libType | libraryType}}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<label for="match-filter">{{t('matched-state-label')}}</label>
|
||||||
<select class="form-select" formControlName="matchState" id="match-filter">
|
<select class="form-select" formControlName="matchState" id="match-filter">
|
||||||
@for(state of allMatchStates; track state) {
|
@for(state of allMatchStates; track state) {
|
||||||
<option [value]="state">{{state | matchStateOption}}</option>
|
<option [value]="state">{{state | matchStateOption}}</option>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ import {LibraryNamePipe} from "../../_pipes/library-name.pipe";
|
||||||
import {AsyncPipe} from "@angular/common";
|
import {AsyncPipe} from "@angular/common";
|
||||||
import {EVENTS, MessageHubService} from "../../_services/message-hub.service";
|
import {EVENTS, MessageHubService} from "../../_services/message-hub.service";
|
||||||
import {ScanSeriesEvent} from "../../_models/events/scan-series-event";
|
import {ScanSeriesEvent} from "../../_models/events/scan-series-event";
|
||||||
|
import {LibraryTypePipe} from "../../_pipes/library-type.pipe";
|
||||||
|
import {allKavitaPlusMetadataApplicableTypes} from "../../_models/library/library";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-manage-matched-metadata',
|
selector: 'app-manage-matched-metadata',
|
||||||
|
|
@ -35,6 +37,7 @@ import {ScanSeriesEvent} from "../../_models/events/scan-series-event";
|
||||||
NgxDatatableModule,
|
NgxDatatableModule,
|
||||||
LibraryNamePipe,
|
LibraryNamePipe,
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
|
LibraryTypePipe,
|
||||||
],
|
],
|
||||||
templateUrl: './manage-matched-metadata.component.html',
|
templateUrl: './manage-matched-metadata.component.html',
|
||||||
styleUrl: './manage-matched-metadata.component.scss',
|
styleUrl: './manage-matched-metadata.component.scss',
|
||||||
|
|
@ -44,6 +47,7 @@ export class ManageMatchedMetadataComponent implements OnInit {
|
||||||
protected readonly ColumnMode = ColumnMode;
|
protected readonly ColumnMode = ColumnMode;
|
||||||
protected readonly MatchStateOption = MatchStateOption;
|
protected readonly MatchStateOption = MatchStateOption;
|
||||||
protected readonly allMatchStates = allMatchStates.filter(m => m !== MatchStateOption.Matched); // Matched will have too many
|
protected readonly allMatchStates = allMatchStates.filter(m => m !== MatchStateOption.Matched); // Matched will have too many
|
||||||
|
protected readonly allLibraryTypes = allKavitaPlusMetadataApplicableTypes;
|
||||||
|
|
||||||
private readonly licenseService = inject(LicenseService);
|
private readonly licenseService = inject(LicenseService);
|
||||||
private readonly actionService = inject(ActionService);
|
private readonly actionService = inject(ActionService);
|
||||||
|
|
@ -58,6 +62,7 @@ export class ManageMatchedMetadataComponent implements OnInit {
|
||||||
data: Array<ManageMatchSeries> = [];
|
data: Array<ManageMatchSeries> = [];
|
||||||
filterGroup = new FormGroup({
|
filterGroup = new FormGroup({
|
||||||
'matchState': new FormControl(MatchStateOption.Error, []),
|
'matchState': new FormControl(MatchStateOption.Error, []),
|
||||||
|
'libraryType': new FormControl(-1, []), // Denotes all
|
||||||
});
|
});
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
@ -99,6 +104,7 @@ export class ManageMatchedMetadataComponent implements OnInit {
|
||||||
loadData() {
|
loadData() {
|
||||||
const filter: ManageMatchFilter = {
|
const filter: ManageMatchFilter = {
|
||||||
matchStateOption: parseInt(this.filterGroup.get('matchState')!.value + '', 10),
|
matchStateOption: parseInt(this.filterGroup.get('matchState')!.value + '', 10),
|
||||||
|
libraryType: parseInt(this.filterGroup.get('libraryType')!.value + '', 10),
|
||||||
searchTerm: ''
|
searchTerm: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,13 @@ import {
|
||||||
} from 'src/app/admin/_modals/directory-picker/directory-picker.component';
|
} from 'src/app/admin/_modals/directory-picker/directory-picker.component';
|
||||||
import {ConfirmService} from 'src/app/shared/confirm.service';
|
import {ConfirmService} from 'src/app/shared/confirm.service';
|
||||||
import {Breakpoint, UtilityService} from 'src/app/shared/_services/utility.service';
|
import {Breakpoint, UtilityService} from 'src/app/shared/_services/utility.service';
|
||||||
import {allLibraryTypes, Library, LibraryType} from 'src/app/_models/library/library';
|
import {
|
||||||
|
allKavitaPlusEligibleTypes,
|
||||||
|
allKavitaPlusMetadataApplicableTypes,
|
||||||
|
allLibraryTypes,
|
||||||
|
Library,
|
||||||
|
LibraryType
|
||||||
|
} from 'src/app/_models/library/library';
|
||||||
import {ImageService} from 'src/app/_services/image.service';
|
import {ImageService} from 'src/app/_services/image.service';
|
||||||
import {LibraryService} from 'src/app/_services/library.service';
|
import {LibraryService} from 'src/app/_services/library.service';
|
||||||
import {UploadService} from 'src/app/_services/upload.service';
|
import {UploadService} from 'src/app/_services/upload.service';
|
||||||
|
|
@ -125,13 +131,12 @@ export class LibrarySettingsModalComponent implements OnInit {
|
||||||
|
|
||||||
get IsKavitaPlusEligible() {
|
get IsKavitaPlusEligible() {
|
||||||
const libType = parseInt(this.libraryForm.get('type')?.value + '', 10) as LibraryType;
|
const libType = parseInt(this.libraryForm.get('type')?.value + '', 10) as LibraryType;
|
||||||
return libType === LibraryType.Manga || libType === LibraryType.LightNovel;
|
return allKavitaPlusEligibleTypes.includes(libType);
|
||||||
}
|
}
|
||||||
|
|
||||||
get IsMetadataDownloadEligible() {
|
get IsMetadataDownloadEligible() {
|
||||||
const libType = parseInt(this.libraryForm.get('type')?.value + '', 10) as LibraryType;
|
const libType = parseInt(this.libraryForm.get('type')?.value + '', 10) as LibraryType;
|
||||||
return libType === LibraryType.Manga || libType === LibraryType.LightNovel
|
return allKavitaPlusMetadataApplicableTypes.includes(libType);
|
||||||
|| libType === LibraryType.ComicVine || libType === LibraryType.Comic;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,7 @@ export class PreferenceNavComponent implements AfterViewInit {
|
||||||
} else {
|
} else {
|
||||||
return this.manageService.getAllKavitaPlusSeries({
|
return this.manageService.getAllKavitaPlusSeries({
|
||||||
matchStateOption: MatchStateOption.Error,
|
matchStateOption: MatchStateOption.Error,
|
||||||
|
libraryType: -1,
|
||||||
searchTerm: ''
|
searchTerm: ''
|
||||||
}).pipe(
|
}).pipe(
|
||||||
takeUntilDestroyed(this.destroyRef),
|
takeUntilDestroyed(this.destroyRef),
|
||||||
|
|
|
||||||
|
|
@ -773,6 +773,8 @@
|
||||||
"library-name-header": "Library",
|
"library-name-header": "Library",
|
||||||
"valid-until-header": "Next Refresh",
|
"valid-until-header": "Next Refresh",
|
||||||
"actions-header": "Actions",
|
"actions-header": "Actions",
|
||||||
|
"library-type": "Library Type",
|
||||||
|
"matched-state-label": "Match State",
|
||||||
"matched-status-label": "Matched",
|
"matched-status-label": "Matched",
|
||||||
"unmatched-status-label": "Not Matched",
|
"unmatched-status-label": "Not Matched",
|
||||||
"blacklist-status-label": "Needs Manual Match",
|
"blacklist-status-label": "Needs Manual Match",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue