Support File Move Operations with Watcher Refactor for Accurate Tracking
This commit is contained in:
committed by
Aditya Chandel
parent
1c9c09628a
commit
841e359b92
@@ -420,9 +420,9 @@ export class BookService {
|
||||
|
||||
handleBookUpdate(updatedBook: Book) {
|
||||
const currentState = this.bookStateSubject.value;
|
||||
const updatedBooks = (currentState.books || []).map(book => {
|
||||
return book.id == updatedBook.id ? {...book, metadata: updatedBook.metadata} : book
|
||||
});
|
||||
const updatedBooks = (currentState.books || []).map(book =>
|
||||
book.id === updatedBook.id ? updatedBook : book
|
||||
);
|
||||
this.bookStateSubject.next({...currentState, books: updatedBooks});
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,11 @@ export class LibraryShelfMenuService {
|
||||
header: 'Confirmation',
|
||||
rejectButtonProps: {
|
||||
label: 'Cancel',
|
||||
severity: 'secondary',
|
||||
},
|
||||
acceptButtonProps: {
|
||||
label: 'Yes',
|
||||
severity: 'success',
|
||||
},
|
||||
accept: () => {
|
||||
this.libraryService.deleteLibrary(entity?.id!).subscribe({
|
||||
@@ -84,6 +89,11 @@ export class LibraryShelfMenuService {
|
||||
header: 'Confirmation',
|
||||
rejectButtonProps: {
|
||||
label: 'Cancel',
|
||||
severity: 'secondary',
|
||||
},
|
||||
acceptButtonProps: {
|
||||
label: 'Yes',
|
||||
severity: 'success',
|
||||
},
|
||||
accept: () => {
|
||||
this.libraryService.refreshLibrary(entity?.id!).subscribe({
|
||||
|
||||
@@ -120,7 +120,16 @@ export class LibraryService {
|
||||
return this.libraryStateSubject.value.libraries || [];
|
||||
}
|
||||
|
||||
getAllLibrariesFromAPI(): Observable<Library[]> {
|
||||
return this.http.get <Library[]>(`${this.url}`);
|
||||
getLibraryPathById(pathId: number): string | undefined {
|
||||
const libraries = this.libraryStateSubject.value.libraries || [];
|
||||
|
||||
for (const library of libraries) {
|
||||
const match = library.paths.find(p => p.id === pathId);
|
||||
if (match) {
|
||||
return match.path;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user