Release Testing Day 1 (#1491)

* Fixed a bug where typeahead wouldn't automatically show results on relationship screen without an additional click.

* Tweaked the code which checks if a modification occured to check on seconds rather than minutes

* Clear cache will now clear temp/ directory as well.

* Fixed an issue where Chrome was caching api responses when it shouldn't had.

* Added a cleanup temp code

* Ensure genres get removed during series scan when removed from metadata.

* Fixed a bug where all epubs with a volume would show as Volume 0 in reading list

* When a scan is in progress, don't let the user delete the library.
This commit is contained in:
Joseph Milazzo 2022-08-29 18:07:39 -05:00 committed by GitHub
parent fb86ce4542
commit d7f2661655
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 112 additions and 32 deletions

View file

@ -12,7 +12,7 @@
<form>
<div class="row g-0 mb-3" *ngFor="let relation of relations; let idx = index; let isLast = last;">
<div class="col-sm-12 col-md-7">
<app-typeahead (selectedData)="updateSeries($event, relation)" [settings]="relation.typeaheadSettings" id="relation--{{idx}}">
<app-typeahead (selectedData)="updateSeries($event, relation)" [settings]="relation.typeaheadSettings" id="relation--{{idx}}" [focus]="focusTypeahead">
<ng-template #badgeItem let-item let-position="idx">
{{item.name}} ({{libraryNames[item.libraryId]}})
</ng-template>

View file

@ -1,5 +1,5 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { UntypedFormControl } from '@angular/forms';
import { FormControl } from '@angular/forms';
import { map, Subject, Observable, of, firstValueFrom, takeUntil, ReplaySubject } from 'rxjs';
import { UtilityService } from 'src/app/shared/_services/utility.service';
import { TypeaheadSettings } from 'src/app/typeahead/typeahead-settings';
@ -13,7 +13,7 @@ import { SeriesService } from 'src/app/_services/series.service';
interface RelationControl {
series: {id: number, name: string} | undefined; // Will add type as well
typeaheadSettings: TypeaheadSettings<SearchResult>;
formControl: UntypedFormControl;
formControl: FormControl;
}
@Component({
@ -37,6 +37,8 @@ export class EditSeriesRelationComponent implements OnInit, OnDestroy {
seriesSettings: TypeaheadSettings<SearchResult> = new TypeaheadSettings();
libraryNames: {[key:number]: string} = {};
focusTypeahead = new EventEmitter();
get RelationKind() {
return RelationKind;
}
@ -79,9 +81,9 @@ export class EditSeriesRelationComponent implements OnInit, OnDestroy {
}
setupRelationRows(relations: Array<Series>, kind: RelationKind) {
relations.map(async item => {
const settings = await firstValueFrom(this.createSeriesTypeahead(item, kind));
const form = new UntypedFormControl(kind, []);
relations.map(async (item, indx) => {
const settings = await firstValueFrom(this.createSeriesTypeahead(item, kind, indx));
const form = new FormControl(kind, []);
if (kind === RelationKind.Parent) {
form.disable();
}
@ -93,15 +95,13 @@ export class EditSeriesRelationComponent implements OnInit, OnDestroy {
}
async addNewRelation() {
this.relations.push({series: undefined, formControl: new UntypedFormControl(RelationKind.Adaptation, []), typeaheadSettings: await firstValueFrom(this.createSeriesTypeahead(undefined, RelationKind.Adaptation))});
this.relations.push({series: undefined, formControl: new FormControl(RelationKind.Adaptation, []), typeaheadSettings: await firstValueFrom(this.createSeriesTypeahead(undefined, RelationKind.Adaptation, this.relations.length))});
this.cdRef.markForCheck();
// Focus on the new typeahead
setTimeout(() => {
const typeahead = document.querySelector(`#relation--${this.relations.length - 1} .typeahead-input input`) as HTMLInputElement;
if (typeahead) typeahead.focus();
this.focusTypeahead.emit(`relation--${this.relations.length - 1}`);
}, 10);
}
removeRelation(index: number) {
@ -120,11 +120,11 @@ export class EditSeriesRelationComponent implements OnInit, OnDestroy {
this.cdRef.markForCheck();
}
createSeriesTypeahead(series: Series | undefined, relationship: RelationKind): Observable<TypeaheadSettings<SearchResult>> {
createSeriesTypeahead(series: Series | undefined, relationship: RelationKind, index: number): Observable<TypeaheadSettings<SearchResult>> {
const seriesSettings = new TypeaheadSettings<SearchResult>();
seriesSettings.minCharacters = 0;
seriesSettings.multiple = false;
seriesSettings.id = 'format';
seriesSettings.id = 'relation--' + index;
seriesSettings.unique = true;
seriesSettings.addIfNonExisting = false;
seriesSettings.fetchFn = (searchFilter: string) => this.libraryService.search(searchFilter).pipe(
@ -165,7 +165,7 @@ export class EditSeriesRelationComponent implements OnInit, OnDestroy {
const alternativeVersions = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.AlternativeVersion && item.series !== undefined).map(item => item.series!.id);
const doujinshis = this.relations.filter(item => (parseInt(item.formControl.value, 10) as RelationKind) === RelationKind.Doujinshi && item.series !== undefined).map(item => item.series!.id);
// TODO: We can actually emit this onto an observable and in main parent, use mergeMap into the forkJoin
// NOTE: We can actually emit this onto an observable and in main parent, use mergeMap into the forkJoin
this.seriesService.updateRelationships(this.series.id, adaptations, characters, contains, others, prequels, sequels, sideStories, spinOffs, alternativeSettings, alternativeVersions, doujinshis).subscribe(() => {});
}

View file

@ -42,7 +42,12 @@ export class ReadingListItemComponent implements OnInit {
}
if (item.seriesFormat === MangaFormat.EPUB) {
this.title = 'Volume ' + this.utilityService.cleanSpecialTitle(item.chapterNumber);
const specialTitle = this.utilityService.cleanSpecialTitle(item.chapterNumber);
if (specialTitle === '0') {
this.title = 'Volume ' + this.utilityService.cleanSpecialTitle(item.volumeNumber);
} else {
this.title = 'Volume ' + specialTitle;
}
}
let chapterNum = item.chapterNumber;

View file

@ -504,6 +504,9 @@ export class SeriesDetailComponent implements OnInit, OnDestroy, AfterContentChe
if (this.relations.length > 0) {
this.hasRelations = true;
this.changeDetectionRef.markForCheck();
} else {
this.hasRelations = false;
this.changeDetectionRef.markForCheck();
}
});

View file

@ -168,6 +168,10 @@ export class TypeaheadComponent implements OnInit, OnDestroy {
* If disabled, a user will not be able to interact with the typeahead
*/
@Input() disabled: boolean = false;
/**
* When triggered, will focus the input if the passed string matches the id
*/
@Input() focus: EventEmitter<string> | undefined;
@Output() selectedData = new EventEmitter<any[] | any>();
@Output() newItemAdded = new EventEmitter<any[] | any>();
@Output() onUnlock = new EventEmitter<void>();
@ -203,6 +207,13 @@ export class TypeaheadComponent implements OnInit, OnDestroy {
this.init();
});
if (this.focus) {
this.focus.pipe(takeUntil(this.onDestroy)).subscribe((id: string) => {
if (this.settings.id !== id) return;
this.onInputFocus();
});
}
this.init();
}