refactor(ui): move large library processing screen to notifications (#1428)
Co-authored-by: Alex <25013571+alexhb1@users.noreply.github.com>
This commit is contained in:
@@ -37,6 +37,7 @@ import { VersionService } from '../../service/version.service';
|
||||
import { MetadataProgressService } from '../../service/metadata-progress.service';
|
||||
import { BookdropFileService } from '../../../features/bookdrop/service/bookdrop-file.service';
|
||||
import { MetadataBatchProgressNotification, MetadataBatchStatus } from '../../model/metadata-batch-progress.model';
|
||||
import { LibraryImportProgressService } from '../../service/library-import-progress.service';
|
||||
|
||||
const DOCUMENTATION_URL = 'https://grimmory.org/docs/getting-started';
|
||||
const ABOVE_ALIGN_LEFT: ConnectedPosition[] = [
|
||||
@@ -139,6 +140,7 @@ export class AppSidebarComponent {
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly metadataProgressService = inject(MetadataProgressService);
|
||||
private readonly bookdropFileService = inject(BookdropFileService);
|
||||
private readonly libraryImportProgressService = inject(LibraryImportProgressService);
|
||||
|
||||
readonly currentUser = this.userService.currentUser;
|
||||
private readonly allAuthors = this.authorService.allAuthors;
|
||||
@@ -231,6 +233,7 @@ export class AppSidebarComponent {
|
||||
protected progressHighlight = false;
|
||||
protected completedTaskCount = 0;
|
||||
protected hasPendingBookdropFiles = false;
|
||||
protected hasActiveLibraryImport = false;
|
||||
|
||||
private readonly latestTasks: Record<string, MetadataBatchProgressNotification> = {};
|
||||
|
||||
@@ -250,6 +253,13 @@ export class AppSidebarComponent {
|
||||
this.hasPendingBookdropFiles = hasPending;
|
||||
this.updateCompletedTaskCount();
|
||||
});
|
||||
|
||||
this.libraryImportProgressService.hasActiveImport$
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((hasActive) => {
|
||||
this.hasActiveLibraryImport = hasActive;
|
||||
this.updateCompletedTaskCount();
|
||||
});
|
||||
}
|
||||
|
||||
openSearch(): void {
|
||||
@@ -383,6 +393,7 @@ export class AppSidebarComponent {
|
||||
private updateCompletedTaskCount(): void {
|
||||
const metadataTaskCount = Object.keys(this.latestTasks).length;
|
||||
const bookdropFileTaskCount = this.hasPendingBookdropFiles ? 1 : 0;
|
||||
this.completedTaskCount = metadataTaskCount + bookdropFileTaskCount;
|
||||
const libraryImportTaskCount = this.hasActiveLibraryImport ? 1 : 0;
|
||||
this.completedTaskCount = metadataTaskCount + bookdropFileTaskCount + libraryImportTaskCount;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user