Fix issue where metadata updates to file caused books to be removed from booklore
This commit is contained in:
committed by
Aditya Chandel
parent
47e24e2241
commit
63dc2bcbc7
-7
@@ -605,12 +605,5 @@ export class MetadataEditorComponent implements OnInit {
|
||||
position: 'absolute'
|
||||
},
|
||||
});
|
||||
|
||||
ref.onClose.subscribe(result => {
|
||||
if (result) {
|
||||
this.metadataForm.get('thumbnailUrl')?.setValue(result);
|
||||
this.onSave();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,3 +97,4 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import {Component, inject, Input, OnInit} from '@angular/core';
|
||||
import {Toast} from 'primeng/toast';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators} from '@angular/forms';
|
||||
import {BookCoverService, CoverFetchRequest, CoverImage} from '../../shared/services/book-cover.service';
|
||||
import {finalize} from 'rxjs/operators';
|
||||
@@ -28,14 +30,13 @@ export class CoverSearchComponent implements OnInit {
|
||||
coverImages: CoverImage[] = [];
|
||||
loading = false;
|
||||
hasSearched = false;
|
||||
showPreview = false;
|
||||
previewImageUrl = '';
|
||||
|
||||
private fb = inject(FormBuilder);
|
||||
private bookCoverService = inject(BookCoverService);
|
||||
private dynamicDialogConfig = inject(DynamicDialogConfig);
|
||||
protected dynamicDialogRef = inject(DynamicDialogRef);
|
||||
protected bookService = inject(BookService);
|
||||
private messageService = inject(MessageService);
|
||||
|
||||
constructor() {
|
||||
this.searchForm = this.fb.group({
|
||||
@@ -87,26 +88,24 @@ export class CoverSearchComponent implements OnInit {
|
||||
}
|
||||
|
||||
selectAndSave(image: CoverImage) {
|
||||
this.dynamicDialogRef.close(image.url);
|
||||
}
|
||||
|
||||
previewImage(imageUrl: string) {
|
||||
this.previewImageUrl = imageUrl;
|
||||
this.showPreview = true;
|
||||
document.body.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
closePreview() {
|
||||
this.showPreview = false;
|
||||
this.previewImageUrl = '';
|
||||
document.body.style.overflow = 'auto';
|
||||
}
|
||||
|
||||
onImageError(event: Event) {
|
||||
const target = event.target as HTMLImageElement;
|
||||
if (target) {
|
||||
target.style.display = 'none';
|
||||
}
|
||||
this.bookService.uploadCoverFromUrl(this.bookId, image.url)
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Cover Updated',
|
||||
detail: 'Cover image updated successfully.'
|
||||
});
|
||||
this.dynamicDialogRef.close();
|
||||
},
|
||||
error: err => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Cover Update Failed',
|
||||
detail: err?.message || 'Failed to update cover image.'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onClear() {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
||||
'seriesName', 'seriesNumber', 'seriesTotal', 'isbn13', 'isbn10',
|
||||
'language', 'categories', 'cover'
|
||||
];
|
||||
providers: string[] = ['Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine'];
|
||||
providers: string[] = ['Amazon', 'Google', 'GoodReads', 'Hardcover', 'Comicvine', 'Douban'];
|
||||
|
||||
refreshCovers: boolean = false;
|
||||
mergeCategories: boolean = false;
|
||||
|
||||
Reference in New Issue
Block a user