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:
+3
@@ -3,6 +3,9 @@
|
||||
@if (hasMetadataTasks$ | async) {
|
||||
<app-metadata-progress-widget/>
|
||||
}
|
||||
@if (hasActiveLibraryImport$ | async) {
|
||||
<app-library-import-progress-widget/>
|
||||
}
|
||||
@if (hasPendingBookdropFiles$ | async) {
|
||||
<app-bookdrop-files-widget-component/>
|
||||
}
|
||||
|
||||
+18
@@ -6,6 +6,7 @@ import {BookdropFileService} from '../../../features/bookdrop/service/bookdrop-f
|
||||
import {getTranslocoModule} from '../../../core/testing/transloco-testing';
|
||||
import {MetadataBatchStatus} from '../../model/metadata-batch-progress.model';
|
||||
import {MetadataProgressService} from '../../service/metadata-progress.service';
|
||||
import {LibraryImportProgressService} from '../../service/library-import-progress.service';
|
||||
import {UnifiedNotificationBoxComponent} from './unified-notification-popover-component';
|
||||
|
||||
describe('UnifiedNotificationBoxComponent', () => {
|
||||
@@ -13,10 +14,12 @@ describe('UnifiedNotificationBoxComponent', () => {
|
||||
let component: UnifiedNotificationBoxComponent;
|
||||
let activeTasks$: BehaviorSubject<Record<string, unknown>>;
|
||||
let hasPendingFiles$: BehaviorSubject<boolean>;
|
||||
let hasActiveImport$: BehaviorSubject<boolean>;
|
||||
|
||||
beforeEach(async () => {
|
||||
activeTasks$ = new BehaviorSubject<Record<string, unknown>>({});
|
||||
hasPendingFiles$ = new BehaviorSubject(false);
|
||||
hasActiveImport$ = new BehaviorSubject(false);
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [UnifiedNotificationBoxComponent, getTranslocoModule()],
|
||||
@@ -29,6 +32,10 @@ describe('UnifiedNotificationBoxComponent', () => {
|
||||
provide: BookdropFileService,
|
||||
useValue: {hasPendingFiles$},
|
||||
},
|
||||
{
|
||||
provide: LibraryImportProgressService,
|
||||
useValue: {hasActiveImport$},
|
||||
},
|
||||
],
|
||||
}).compileComponents();
|
||||
|
||||
@@ -72,4 +79,15 @@ describe('UnifiedNotificationBoxComponent', () => {
|
||||
hasPendingFiles$.next(true);
|
||||
expect(hasPendingFiles).toBe(true);
|
||||
});
|
||||
|
||||
it('forwards the active library import signal', () => {
|
||||
let hasActiveImport: boolean | undefined;
|
||||
component.hasActiveLibraryImport$.subscribe(value => {
|
||||
hasActiveImport = value;
|
||||
});
|
||||
|
||||
expect(hasActiveImport).toBe(false);
|
||||
hasActiveImport$.next(true);
|
||||
expect(hasActiveImport).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
+5
@@ -6,12 +6,15 @@ import {AsyncPipe} from '@angular/common';
|
||||
import {BookdropFileService} from '../../../features/bookdrop/service/bookdrop-file.service';
|
||||
import {BookdropFilesWidgetComponent} from '../../../features/bookdrop/component/bookdrop-files-widget/bookdrop-files-widget.component';
|
||||
import {MetadataProgressWidgetComponent} from '../metadata-progress-widget/metadata-progress-widget-component';
|
||||
import {LibraryImportProgressService} from '../../service/library-import-progress.service';
|
||||
import {LibraryImportProgressWidgetComponent} from '../library-import-progress-widget/library-import-progress-widget-component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-unified-notification-popover-component',
|
||||
imports: [
|
||||
LiveNotificationBoxComponent,
|
||||
MetadataProgressWidgetComponent,
|
||||
LibraryImportProgressWidgetComponent,
|
||||
AsyncPipe,
|
||||
BookdropFilesWidgetComponent
|
||||
],
|
||||
@@ -22,10 +25,12 @@ import {MetadataProgressWidgetComponent} from '../metadata-progress-widget/metad
|
||||
export class UnifiedNotificationBoxComponent {
|
||||
metadataProgressService = inject(MetadataProgressService);
|
||||
bookdropFileService = inject(BookdropFileService);
|
||||
libraryImportProgressService = inject(LibraryImportProgressService);
|
||||
|
||||
hasMetadataTasks$ = this.metadataProgressService.activeTasks$.pipe(
|
||||
map(tasks => Object.keys(tasks).length > 0)
|
||||
);
|
||||
|
||||
hasPendingBookdropFiles$ = this.bookdropFileService.hasPendingFiles$;
|
||||
hasActiveLibraryImport$ = this.libraryImportProgressService.hasActiveImport$;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user