perf(frontend): optimize initial bundle size with lazy-loaded dialogs and localized chart providers (#1110)
This commit is contained in:
@@ -895,8 +895,8 @@ export class BookBrowserComponent implements AfterViewInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openShelfAssigner(): void {
|
async openShelfAssigner() {
|
||||||
this.dynamicDialogRef = this.dialogHelperService.openShelfAssignerDialog(null, this.selectedBooks());
|
this.dynamicDialogRef = await this.dialogHelperService.openShelfAssignerDialog(null, this.selectedBooks());
|
||||||
if (this.dynamicDialogRef) {
|
if (this.dynamicDialogRef) {
|
||||||
this.dynamicDialogRef.onClose.pipe(take(1)).subscribe(result => {
|
this.dynamicDialogRef.onClose.pipe(take(1)).subscribe(result => {
|
||||||
if (result?.assigned) {
|
if (result?.assigned) {
|
||||||
@@ -906,8 +906,8 @@ export class BookBrowserComponent implements AfterViewInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lockUnlockMetadata(): void {
|
async lockUnlockMetadata() {
|
||||||
this.dynamicDialogRef = this.dialogHelperService.openLockUnlockMetadataDialog(this.selectedBooks());
|
this.dynamicDialogRef = await this.dialogHelperService.openLockUnlockMetadataDialog(this.selectedBooks());
|
||||||
if (this.dynamicDialogRef) {
|
if (this.dynamicDialogRef) {
|
||||||
this.dynamicDialogRef.onClose.pipe(take(1)).subscribe(() => {
|
this.dynamicDialogRef.onClose.pipe(take(1)).subscribe(() => {
|
||||||
this.bookSelectionService.deselectAll();
|
this.bookSelectionService.deselectAll();
|
||||||
@@ -924,12 +924,12 @@ export class BookBrowserComponent implements AfterViewInit {
|
|||||||
}).subscribe();
|
}).subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchMetadata(): void {
|
async fetchMetadata() {
|
||||||
this.dialogHelperService.openMetadataRefreshDialog(this.selectedBooks());
|
await this.dialogHelperService.openMetadataRefreshDialog(this.selectedBooks());
|
||||||
}
|
}
|
||||||
|
|
||||||
bulkEditMetadata(): void {
|
async bulkEditMetadata() {
|
||||||
this.dynamicDialogRef = this.dialogHelperService.openBulkMetadataEditDialog(this.selectedBooks());
|
this.dynamicDialogRef = await this.dialogHelperService.openBulkMetadataEditDialog(this.selectedBooks());
|
||||||
if (this.dynamicDialogRef) {
|
if (this.dynamicDialogRef) {
|
||||||
this.dynamicDialogRef.onClose.pipe(take(1)).subscribe(() => {
|
this.dynamicDialogRef.onClose.pipe(take(1)).subscribe(() => {
|
||||||
this.bookSelectionService.deselectAll();
|
this.bookSelectionService.deselectAll();
|
||||||
@@ -937,8 +937,8 @@ export class BookBrowserComponent implements AfterViewInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
multiBookEditMetadata(): void {
|
async multiBookEditMetadata() {
|
||||||
this.dynamicDialogRef = this.dialogHelperService.openMultibookMetadataEditorDialog(this.selectedBooks());
|
this.dynamicDialogRef = await this.dialogHelperService.openMultibookMetadataEditorDialog(this.selectedBooks());
|
||||||
if (this.dynamicDialogRef) {
|
if (this.dynamicDialogRef) {
|
||||||
this.dynamicDialogRef.onClose.pipe(take(1)).subscribe(() => {
|
this.dynamicDialogRef.onClose.pipe(take(1)).subscribe(() => {
|
||||||
this.bookSelectionService.deselectAll();
|
this.bookSelectionService.deselectAll();
|
||||||
@@ -1028,11 +1028,11 @@ export class BookBrowserComponent implements AfterViewInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
moveFiles(): void {
|
async moveFiles() {
|
||||||
this.dialogHelperService.openFileMoverDialog(this.selectedBooks());
|
await this.dialogHelperService.openFileMoverDialog(this.selectedBooks());
|
||||||
}
|
}
|
||||||
|
|
||||||
attachFilesToBook(): void {
|
async attachFilesToBook() {
|
||||||
const selectedBookIds = Array.from(this.selectedBooks());
|
const selectedBookIds = Array.from(this.selectedBooks());
|
||||||
const sourceBooks = this.books().filter(book =>
|
const sourceBooks = this.books().filter(book =>
|
||||||
selectedBookIds.includes(book.id)
|
selectedBookIds.includes(book.id)
|
||||||
@@ -1058,7 +1058,7 @@ export class BookBrowserComponent implements AfterViewInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dynamicDialogRef = this.dialogHelperService.openBulkBookFileAttacherDialog(sourceBooks);
|
this.dynamicDialogRef = await this.dialogHelperService.openBulkBookFileAttacherDialog(sourceBooks);
|
||||||
if (this.dynamicDialogRef) {
|
if (this.dynamicDialogRef) {
|
||||||
this.dynamicDialogRef.onClose.pipe(take(1)).subscribe(result => {
|
this.dynamicDialogRef.onClose.pipe(take(1)).subscribe(result => {
|
||||||
if (result?.success) {
|
if (result?.success) {
|
||||||
|
|||||||
+5
-5
@@ -187,11 +187,11 @@ describe('BookCardComponent', () => {
|
|||||||
confirm: vi.fn(),
|
confirm: vi.fn(),
|
||||||
};
|
};
|
||||||
bookDialogHelperService = {
|
bookDialogHelperService = {
|
||||||
openShelfAssignerDialog: vi.fn(),
|
openShelfAssignerDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openBookDetailsDialog: vi.fn(),
|
openBookDetailsDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openCustomSendDialog: vi.fn(),
|
openCustomSendDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openMetadataRefreshDialog: vi.fn(),
|
openMetadataRefreshDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openFileMoverDialog: vi.fn(),
|
openFileMoverDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
};
|
};
|
||||||
bookNavigationService = {
|
bookNavigationService = {
|
||||||
availableBookIds: vi.fn(() => []),
|
availableBookIds: vi.fn(() => []),
|
||||||
|
|||||||
+6
-6
@@ -419,7 +419,7 @@ export class BookCardComponent {
|
|||||||
{
|
{
|
||||||
label: this.t.translate('book.card.menu.customSend'),
|
label: this.t.translate('book.card.menu.customSend'),
|
||||||
icon: 'pi pi-envelope',
|
icon: 'pi pi-envelope',
|
||||||
command: () => this.bookDialogHelperService.openCustomSendDialog(this.book())
|
command: () => void this.bookDialogHelperService.openCustomSendDialog(this.book()).catch(() => undefined)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -452,7 +452,7 @@ export class BookCardComponent {
|
|||||||
{
|
{
|
||||||
label: this.t.translate('book.card.menu.customFetch'),
|
label: this.t.translate('book.card.menu.customFetch'),
|
||||||
icon: 'pi pi-sync',
|
icon: 'pi pi-sync',
|
||||||
command: () => this.bookDialogHelperService.openMetadataRefreshDialog(new Set([this.book().id])),
|
command: () => void this.bookDialogHelperService.openMetadataRefreshDialog(new Set([this.book().id])).catch(() => undefined),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.t.translate('book.card.menu.regenerateCover'),
|
label: this.t.translate('book.card.menu.regenerateCover'),
|
||||||
@@ -505,7 +505,7 @@ export class BookCardComponent {
|
|||||||
moreActions.push({
|
moreActions.push({
|
||||||
label: this.t.translate('book.card.menu.organizeFile'),
|
label: this.t.translate('book.card.menu.organizeFile'),
|
||||||
icon: 'pi pi-arrows-h',
|
icon: 'pi pi-arrows-h',
|
||||||
command: () => this.bookDialogHelperService.openFileMoverDialog(new Set([this.book().id]))
|
command: () => void this.bookDialogHelperService.openFileMoverDialog(new Set([this.book().id])).catch(() => undefined)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -597,7 +597,7 @@ export class BookCardComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private openShelfDialog(): void {
|
private openShelfDialog(): void {
|
||||||
this.bookDialogHelperService.openShelfAssignerDialog(this.book(), null);
|
void this.bookDialogHelperService.openShelfAssignerDialog(this.book(), null).catch(() => undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
openSeriesInfo(): void {
|
openSeriesInfo(): void {
|
||||||
@@ -610,7 +610,7 @@ export class BookCardComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openBookInfo(book: Book): void {
|
async openBookInfo(book: Book) {
|
||||||
const allBookIds = this.bookNavigationService.availableBookIds();
|
const allBookIds = this.bookNavigationService.availableBookIds();
|
||||||
if (allBookIds.length > 0) {
|
if (allBookIds.length > 0) {
|
||||||
this.bookNavigationService.setNavigationContext(allBookIds, book.id);
|
this.bookNavigationService.setNavigationContext(allBookIds, book.id);
|
||||||
@@ -621,7 +621,7 @@ export class BookCardComponent {
|
|||||||
queryParams: {tab: 'view'}
|
queryParams: {tab: 'view'}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.bookDialogHelperService.openBookDetailsDialog(book.id);
|
await this.bookDialogHelperService.openBookDetailsDialog(book.id).catch(() => undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-8
@@ -6,11 +6,15 @@ import {BookDialogHelperService} from './book-dialog-helper.service';
|
|||||||
|
|
||||||
describe('BookDialogHelperService', () => {
|
describe('BookDialogHelperService', () => {
|
||||||
let service: BookDialogHelperService;
|
let service: BookDialogHelperService;
|
||||||
let dialogLauncherService: {openDialog: ReturnType<typeof vi.fn>};
|
let dialogLauncherService: {
|
||||||
|
openDialog: ReturnType<typeof vi.fn>,
|
||||||
|
launchLazyDialog: ReturnType<typeof vi.fn>
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
dialogLauncherService = {
|
dialogLauncherService = {
|
||||||
openDialog: vi.fn(() => ({id: 'dialog-ref'})),
|
openDialog: vi.fn().mockResolvedValue({id: 'dialog-ref'}),
|
||||||
|
launchLazyDialog: vi.fn((fn) => fn()),
|
||||||
};
|
};
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -27,8 +31,8 @@ describe('BookDialogHelperService', () => {
|
|||||||
TestBed.resetTestingModule();
|
TestBed.resetTestingModule();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('opens the book details dialog with the expected payload', () => {
|
it('opens the book details dialog with the expected payload', async () => {
|
||||||
const dialogRef = service.openBookDetailsDialog(42);
|
const dialogRef = await service.openBookDetailsDialog(42);
|
||||||
|
|
||||||
expect(dialogLauncherService.openDialog).toHaveBeenCalledWith(
|
expect(dialogLauncherService.openDialog).toHaveBeenCalledWith(
|
||||||
expect.any(Function),
|
expect.any(Function),
|
||||||
@@ -40,17 +44,17 @@ describe('BookDialogHelperService', () => {
|
|||||||
expect(dialogRef).toEqual({id: 'dialog-ref'});
|
expect(dialogRef).toEqual({id: 'dialog-ref'});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns null instead of opening the shelf assigner when no inputs are provided', () => {
|
it('returns null instead of opening the shelf assigner when no inputs are provided', async () => {
|
||||||
const dialogRef = service.openShelfAssignerDialog(null, null);
|
const dialogRef = await service.openShelfAssignerDialog(null, null);
|
||||||
|
|
||||||
expect(dialogRef).toBeNull();
|
expect(dialogRef).toBeNull();
|
||||||
expect(dialogLauncherService.openDialog).not.toHaveBeenCalled();
|
expect(dialogLauncherService.openDialog).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('opens the bulk file attacher with the provided source books', () => {
|
it('opens the bulk file attacher with the provided source books', async () => {
|
||||||
const sourceBooks = [{id: 1}, {id: 2}] as never[];
|
const sourceBooks = [{id: 1}, {id: 2}] as never[];
|
||||||
|
|
||||||
service.openBulkBookFileAttacherDialog(sourceBooks);
|
await service.openBulkBookFileAttacherDialog(sourceBooks);
|
||||||
|
|
||||||
expect(dialogLauncherService.openDialog).toHaveBeenCalledWith(
|
expect(dialogLauncherService.openDialog).toHaveBeenCalledWith(
|
||||||
expect.any(Function),
|
expect.any(Function),
|
||||||
|
|||||||
+174
-141
@@ -1,23 +1,8 @@
|
|||||||
import {inject, Injectable} from '@angular/core';
|
import {inject, Injectable} from '@angular/core';
|
||||||
import {DynamicDialogRef} from 'primeng/dynamicdialog';
|
import {DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||||
import {DialogLauncherService, DialogSize, DialogStyle} from '../../../../shared/services/dialog-launcher.service';
|
import {DialogLauncherService, DialogSize, DialogStyle} from '../../../../shared/services/dialog-launcher.service';
|
||||||
import {ShelfAssignerComponent} from '../shelf-assigner/shelf-assigner.component';
|
|
||||||
import {LockUnlockMetadataDialogComponent} from './lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component';
|
|
||||||
import {MetadataRefreshType} from '../../../metadata/model/request/metadata-refresh-type.enum';
|
import {MetadataRefreshType} from '../../../metadata/model/request/metadata-refresh-type.enum';
|
||||||
import {BulkMetadataUpdateComponent} from '../../../metadata/component/bulk-metadata-update/bulk-metadata-update-component';
|
|
||||||
import {MultiBookMetadataEditorComponent} from '../../../metadata/component/multi-book-metadata-editor/multi-book-metadata-editor-component';
|
|
||||||
import {MultiBookMetadataFetchComponent} from '../../../metadata/component/multi-book-metadata-fetch/multi-book-metadata-fetch-component';
|
|
||||||
import {FileMoverComponent} from '../../../../shared/components/file-mover/file-mover-component';
|
|
||||||
import {ShelfCreatorComponent} from '../shelf-creator/shelf-creator.component';
|
|
||||||
import {BookSenderComponent} from '../book-sender/book-sender.component';
|
|
||||||
import {BookMetadataCenterComponent} from '../../../metadata/component/book-metadata-center/book-metadata-center.component';
|
|
||||||
import {CoverSearchComponent} from '../../../metadata/component/cover-search/cover-search.component';
|
|
||||||
import {Book} from '../../model/book.model';
|
import {Book} from '../../model/book.model';
|
||||||
import {AdditionalFileUploaderComponent} from '../additional-file-uploader/additional-file-uploader.component';
|
|
||||||
import {BookFileAttacherComponent} from '../book-file-attacher/book-file-attacher.component';
|
|
||||||
import {AddPhysicalBookDialogComponent} from '../add-physical-book-dialog/add-physical-book-dialog.component';
|
|
||||||
import {BulkIsbnImportDialogComponent} from '../bulk-isbn-import-dialog/bulk-isbn-import-dialog.component';
|
|
||||||
import {DuplicateMergerComponent} from '../duplicate-merger/duplicate-merger.component';
|
|
||||||
|
|
||||||
interface MetadataRefreshDialogContext {
|
interface MetadataRefreshDialogContext {
|
||||||
metadataRefreshType: MetadataRefreshType;
|
metadataRefreshType: MetadataRefreshType;
|
||||||
@@ -34,180 +19,228 @@ export class BookDialogHelperService {
|
|||||||
return this.dialogLauncherService.openDialog(component, options);
|
return this.dialogLauncherService.openDialog(component, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
openBookDetailsDialog(bookId: number): DynamicDialogRef | null {
|
async openBookDetailsDialog(bookId: number): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(BookMetadataCenterComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {BookMetadataCenterComponent} = await import('../../../metadata/component/book-metadata-center/book-metadata-center.component');
|
||||||
styleClass: `book-details-dialog ${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(BookMetadataCenterComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
bookId: bookId,
|
styleClass: `book-details-dialog ${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
bookId: bookId,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openShelfAssignerDialog(book: Book | null, bookIds: Set<number> | null): DynamicDialogRef | null {
|
async openShelfAssignerDialog(book: Book | null, bookIds: Set<number> | null): Promise<DynamicDialogRef | null> {
|
||||||
const data: { isMultiBooks: boolean; book?: Book; bookIds?: Set<number> } = {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
isMultiBooks: false
|
const data: { isMultiBooks: boolean; book?: Book; bookIds?: Set<number> } = {
|
||||||
};
|
isMultiBooks: false
|
||||||
if (book !== null) {
|
};
|
||||||
data.book = book;
|
if (book !== null) {
|
||||||
} else if (bookIds !== null) {
|
data.book = book;
|
||||||
data.isMultiBooks = true;
|
} else if (bookIds !== null) {
|
||||||
data.bookIds = bookIds;
|
data.isMultiBooks = true;
|
||||||
} else {
|
data.bookIds = bookIds;
|
||||||
return null;
|
} else {
|
||||||
}
|
return null;
|
||||||
return this.openDialog(ShelfAssignerComponent, {
|
}
|
||||||
showHeader: false,
|
const {ShelfAssignerComponent} = await import('../shelf-assigner/shelf-assigner.component');
|
||||||
data: data,
|
return this.openDialog(ShelfAssignerComponent, {
|
||||||
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
showHeader: false,
|
||||||
|
data: data,
|
||||||
|
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openShelfCreatorDialog(): DynamicDialogRef {
|
async openShelfCreatorDialog(): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(ShelfCreatorComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {ShelfCreatorComponent} = await import('../shelf-creator/shelf-creator.component');
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(ShelfCreatorComponent, {
|
||||||
})!;
|
showHeader: false,
|
||||||
}
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
|
});
|
||||||
openLockUnlockMetadataDialog(bookIds: Set<number>): DynamicDialogRef | null {
|
|
||||||
return this.openDialog(LockUnlockMetadataDialogComponent, {
|
|
||||||
showHeader: false,
|
|
||||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
|
||||||
data: {
|
|
||||||
bookIds: Array.from(bookIds),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openMetadataRefreshDialog(bookIds: Set<number>): DynamicDialogRef | null {
|
async openLockUnlockMetadataDialog(bookIds: Set<number>): Promise<DynamicDialogRef | null> {
|
||||||
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
|
const {LockUnlockMetadataDialogComponent} = await import('./lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component');
|
||||||
|
return this.openDialog(LockUnlockMetadataDialogComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||||
|
data: {
|
||||||
|
bookIds: Array.from(bookIds),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async openMetadataRefreshDialog(bookIds: Set<number>): Promise<DynamicDialogRef | null> {
|
||||||
return this.openMetadataRefreshDialogWithContext({
|
return this.openMetadataRefreshDialogWithContext({
|
||||||
metadataRefreshType: MetadataRefreshType.BOOKS,
|
metadataRefreshType: MetadataRefreshType.BOOKS,
|
||||||
bookIds: Array.from(bookIds)
|
bookIds: Array.from(bookIds)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openMetadataRefreshDialogWithContext(context: MetadataRefreshDialogContext): DynamicDialogRef | null {
|
async openMetadataRefreshDialogWithContext(context: MetadataRefreshDialogContext): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(MultiBookMetadataFetchComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {MultiBookMetadataFetchComponent} = await import('../../../metadata/component/multi-book-metadata-fetch/multi-book-metadata-fetch-component');
|
||||||
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(MultiBookMetadataFetchComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
bookIds: context.bookIds ?? [],
|
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
||||||
libraryId: context.libraryId,
|
data: {
|
||||||
metadataRefreshType: context.metadataRefreshType,
|
bookIds: context.bookIds ?? [],
|
||||||
},
|
libraryId: context.libraryId,
|
||||||
|
metadataRefreshType: context.metadataRefreshType,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openBulkMetadataEditDialog(bookIds: Set<number>): DynamicDialogRef | null {
|
async openBulkMetadataEditDialog(bookIds: Set<number>): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(BulkMetadataUpdateComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {BulkMetadataUpdateComponent} = await import('../../../metadata/component/bulk-metadata-update/bulk-metadata-update-component');
|
||||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(BulkMetadataUpdateComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
bookIds: Array.from(bookIds),
|
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
bookIds: Array.from(bookIds),
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openMultibookMetadataEditorDialog(bookIds: Set<number>): DynamicDialogRef | null {
|
async openMultibookMetadataEditorDialog(bookIds: Set<number>): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(MultiBookMetadataEditorComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {MultiBookMetadataEditorComponent} = await import('../../../metadata/component/multi-book-metadata-editor/multi-book-metadata-editor-component');
|
||||||
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(MultiBookMetadataEditorComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
bookIds: Array.from(bookIds),
|
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
bookIds: Array.from(bookIds),
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openFileMoverDialog(bookIds: Set<number>): DynamicDialogRef | null {
|
async openFileMoverDialog(bookIds: Set<number>): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(FileMoverComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {FileMoverComponent} = await import('../../../../shared/components/file-mover/file-mover-component');
|
||||||
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(FileMoverComponent, {
|
||||||
maximizable: true,
|
showHeader: false,
|
||||||
data: {
|
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
||||||
bookIds: Array.from(bookIds),
|
maximizable: true,
|
||||||
},
|
data: {
|
||||||
|
bookIds: Array.from(bookIds),
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openCustomSendDialog(book: Book): DynamicDialogRef | null {
|
async openCustomSendDialog(book: Book): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(BookSenderComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {BookSenderComponent} = await import('../book-sender/book-sender.component');
|
||||||
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(BookSenderComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
book: book,
|
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
book: book,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openCoverSearchDialog(bookId: number, coverType?: 'ebook' | 'audiobook'): DynamicDialogRef | null {
|
async openCoverSearchDialog(bookId: number, coverType?: 'ebook' | 'audiobook'): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(CoverSearchComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {CoverSearchComponent} = await import('../../../metadata/component/cover-search/cover-search.component');
|
||||||
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(CoverSearchComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
bookId: bookId,
|
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
||||||
coverType: coverType,
|
data: {
|
||||||
},
|
bookId: bookId,
|
||||||
|
coverType: coverType,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openAdditionalFileUploaderDialog(book: Book): DynamicDialogRef | null {
|
async openAdditionalFileUploaderDialog(book: Book): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(AdditionalFileUploaderComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {AdditionalFileUploaderComponent} = await import('../additional-file-uploader/additional-file-uploader.component');
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(AdditionalFileUploaderComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
book: book,
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
book: book,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openBookFileAttacherDialog(sourceBook: Book): DynamicDialogRef | null {
|
async openBookFileAttacherDialog(sourceBook: Book): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(BookFileAttacherComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {BookFileAttacherComponent} = await import('../book-file-attacher/book-file-attacher.component');
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(BookFileAttacherComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
sourceBook: sourceBook,
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
sourceBook: sourceBook,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openBulkBookFileAttacherDialog(sourceBooks: Book[]): DynamicDialogRef | null {
|
async openBulkBookFileAttacherDialog(sourceBooks: Book[]): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(BookFileAttacherComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {BookFileAttacherComponent} = await import('../book-file-attacher/book-file-attacher.component');
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(BookFileAttacherComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
sourceBooks: sourceBooks,
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
sourceBooks: sourceBooks,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openDuplicateMergerDialog(libraryId: number): DynamicDialogRef | null {
|
async openDuplicateMergerDialog(libraryId: number): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(DuplicateMergerComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {DuplicateMergerComponent} = await import('../duplicate-merger/duplicate-merger.component');
|
||||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(DuplicateMergerComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
libraryId: libraryId,
|
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
libraryId: libraryId,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openAddPhysicalBookDialog(libraryId?: number): DynamicDialogRef | null {
|
async openAddPhysicalBookDialog(libraryId?: number): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(AddPhysicalBookDialogComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {AddPhysicalBookDialogComponent} = await import('../add-physical-book-dialog/add-physical-book-dialog.component');
|
||||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(AddPhysicalBookDialogComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
libraryId: libraryId,
|
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
libraryId: libraryId,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openBulkIsbnImportDialog(libraryId?: number): DynamicDialogRef | null {
|
async openBulkIsbnImportDialog(libraryId?: number): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(BulkIsbnImportDialogComponent, {
|
return this.dialogLauncherService.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {BulkIsbnImportDialogComponent} = await import('../bulk-isbn-import-dialog/bulk-isbn-import-dialog.component');
|
||||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(BulkIsbnImportDialogComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
libraryId: libraryId,
|
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
libraryId: libraryId,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -684,8 +684,8 @@ export class SeriesPageComponent implements AfterViewChecked {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openShelfAssigner(): void {
|
async openShelfAssigner() {
|
||||||
this.dialogRef = this.dialogHelperService.openShelfAssignerDialog(null, this.selectedBooks());
|
this.dialogRef = await this.dialogHelperService.openShelfAssignerDialog(null, this.selectedBooks());
|
||||||
if (this.dialogRef) {
|
if (this.dialogRef) {
|
||||||
this.dialogRef.onClose.pipe(take(1)).subscribe(result => {
|
this.dialogRef.onClose.pipe(take(1)).subscribe(result => {
|
||||||
if (result?.assigned) {
|
if (result?.assigned) {
|
||||||
@@ -695,8 +695,8 @@ export class SeriesPageComponent implements AfterViewChecked {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lockUnlockMetadata(): void {
|
async lockUnlockMetadata() {
|
||||||
this.dialogRef = this.dialogHelperService.openLockUnlockMetadataDialog(this.selectedBooks());
|
this.dialogRef = await this.dialogHelperService.openLockUnlockMetadataDialog(this.selectedBooks());
|
||||||
if (this.dialogRef) {
|
if (this.dialogRef) {
|
||||||
this.dialogRef.onClose.pipe(take(1)).subscribe(() => {
|
this.dialogRef.onClose.pipe(take(1)).subscribe(() => {
|
||||||
this.deselectAllBooks();
|
this.deselectAllBooks();
|
||||||
@@ -713,12 +713,12 @@ export class SeriesPageComponent implements AfterViewChecked {
|
|||||||
}).subscribe();
|
}).subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchMetadata(): void {
|
async fetchMetadata() {
|
||||||
this.dialogHelperService.openMetadataRefreshDialog(this.selectedBooks());
|
await this.dialogHelperService.openMetadataRefreshDialog(this.selectedBooks());
|
||||||
}
|
}
|
||||||
|
|
||||||
bulkEditMetadata(): void {
|
async bulkEditMetadata() {
|
||||||
this.dialogRef = this.dialogHelperService.openBulkMetadataEditDialog(this.selectedBooks());
|
this.dialogRef = await this.dialogHelperService.openBulkMetadataEditDialog(this.selectedBooks());
|
||||||
if (this.dialogRef) {
|
if (this.dialogRef) {
|
||||||
this.dialogRef.onClose.pipe(take(1)).subscribe(() => {
|
this.dialogRef.onClose.pipe(take(1)).subscribe(() => {
|
||||||
this.deselectAllBooks();
|
this.deselectAllBooks();
|
||||||
@@ -726,8 +726,8 @@ export class SeriesPageComponent implements AfterViewChecked {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
multiBookEditMetadata(): void {
|
async multiBookEditMetadata() {
|
||||||
this.dialogRef = this.dialogHelperService.openMultibookMetadataEditorDialog(this.selectedBooks());
|
this.dialogRef = await this.dialogHelperService.openMultibookMetadataEditorDialog(this.selectedBooks());
|
||||||
if (this.dialogRef) {
|
if (this.dialogRef) {
|
||||||
this.dialogRef.onClose.pipe(take(1)).subscribe(() => {
|
this.dialogRef.onClose.pipe(take(1)).subscribe(() => {
|
||||||
this.deselectAllBooks();
|
this.deselectAllBooks();
|
||||||
@@ -817,8 +817,8 @@ export class SeriesPageComponent implements AfterViewChecked {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
moveFiles() {
|
async moveFiles() {
|
||||||
this.dialogHelperService.openFileMoverDialog(this.selectedBooks());
|
await this.dialogHelperService.openFileMoverDialog(this.selectedBooks());
|
||||||
}
|
}
|
||||||
|
|
||||||
user() {
|
user() {
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ describe('LibraryShelfMenuService', () => {
|
|||||||
navigate: vi.fn(),
|
navigate: vi.fn(),
|
||||||
};
|
};
|
||||||
const dialogLauncherService = {
|
const dialogLauncherService = {
|
||||||
openLibraryEditDialog: vi.fn(),
|
openLibraryEditDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openShelfEditDialog: vi.fn(),
|
openShelfEditDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openMagicShelfEditDialog: vi.fn(),
|
openMagicShelfEditDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
};
|
};
|
||||||
const magicShelfService = {
|
const magicShelfService = {
|
||||||
deleteShelf: vi.fn(() => of(undefined)),
|
deleteShelf: vi.fn(() => of(undefined)),
|
||||||
@@ -99,10 +99,10 @@ describe('LibraryShelfMenuService', () => {
|
|||||||
hide: vi.fn(),
|
hide: vi.fn(),
|
||||||
};
|
};
|
||||||
const bookDialogHelperService = {
|
const bookDialogHelperService = {
|
||||||
openAddPhysicalBookDialog: vi.fn(),
|
openAddPhysicalBookDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openBulkIsbnImportDialog: vi.fn(),
|
openBulkIsbnImportDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openDuplicateMergerDialog: vi.fn(),
|
openDuplicateMergerDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openMetadataRefreshDialogWithContext: vi.fn(),
|
openMetadataRefreshDialogWithContext: vi.fn(() => Promise.resolve(null)),
|
||||||
};
|
};
|
||||||
const translocoService = {
|
const translocoService = {
|
||||||
translate: vi.fn((key: string) => key),
|
translate: vi.fn((key: string) => key),
|
||||||
|
|||||||
@@ -45,22 +45,22 @@ export class LibraryShelfMenuService {
|
|||||||
label: this.t.translate('book.shelfMenuService.library.addPhysicalBook'),
|
label: this.t.translate('book.shelfMenuService.library.addPhysicalBook'),
|
||||||
icon: 'pi pi-book',
|
icon: 'pi pi-book',
|
||||||
disabled: libraryId == null,
|
disabled: libraryId == null,
|
||||||
command: () => {
|
command: async () => {
|
||||||
if (libraryId == null) {
|
if (libraryId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.bookDialogHelperService.openAddPhysicalBookDialog(libraryId);
|
await this.bookDialogHelperService.openAddPhysicalBookDialog(libraryId).catch(() => undefined);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.t.translate('book.shelfMenuService.library.bulkIsbnImport'),
|
label: this.t.translate('book.shelfMenuService.library.bulkIsbnImport'),
|
||||||
icon: 'pi pi-barcode',
|
icon: 'pi pi-barcode',
|
||||||
disabled: libraryId == null,
|
disabled: libraryId == null,
|
||||||
command: () => {
|
command: async () => {
|
||||||
if (libraryId == null) {
|
if (libraryId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.bookDialogHelperService.openBulkIsbnImportDialog(libraryId);
|
await this.bookDialogHelperService.openBulkIsbnImportDialog(libraryId).catch(() => undefined);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ export class LibraryShelfMenuService {
|
|||||||
if (libraryId == null) {
|
if (libraryId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.dialogLauncherService.openLibraryEditDialog(libraryId);
|
void this.dialogLauncherService.openLibraryEditDialog(libraryId).catch(() => undefined);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -124,14 +124,14 @@ export class LibraryShelfMenuService {
|
|||||||
label: this.t.translate('book.shelfMenuService.library.customFetchMetadata'),
|
label: this.t.translate('book.shelfMenuService.library.customFetchMetadata'),
|
||||||
icon: 'pi pi-sync',
|
icon: 'pi pi-sync',
|
||||||
disabled: libraryId == null,
|
disabled: libraryId == null,
|
||||||
command: () => {
|
command: async () => {
|
||||||
if (libraryId == null) {
|
if (libraryId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.bookDialogHelperService.openMetadataRefreshDialogWithContext({
|
await this.bookDialogHelperService.openMetadataRefreshDialogWithContext({
|
||||||
metadataRefreshType: MetadataRefreshType.LIBRARY,
|
metadataRefreshType: MetadataRefreshType.LIBRARY,
|
||||||
libraryId
|
libraryId
|
||||||
});
|
}).catch(() => undefined);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -152,11 +152,11 @@ export class LibraryShelfMenuService {
|
|||||||
label: this.t.translate('book.shelfMenuService.library.findDuplicates'),
|
label: this.t.translate('book.shelfMenuService.library.findDuplicates'),
|
||||||
icon: 'pi pi-copy',
|
icon: 'pi pi-copy',
|
||||||
disabled: libraryId == null,
|
disabled: libraryId == null,
|
||||||
command: () => {
|
command: async () => {
|
||||||
if (libraryId == null) {
|
if (libraryId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.bookDialogHelperService.openDuplicateMergerDialog(libraryId);
|
await this.bookDialogHelperService.openDuplicateMergerDialog(libraryId).catch(() => undefined);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -227,7 +227,7 @@ export class LibraryShelfMenuService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dialogLauncherService.openShelfEditDialog(shelfId);
|
void this.dialogLauncherService.openShelfEditDialog(shelfId).catch(() => undefined);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -303,7 +303,7 @@ export class LibraryShelfMenuService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dialogLauncherService.openMagicShelfEditDialog(magicShelfId);
|
void this.dialogLauncherService.openMagicShelfEditDialog(magicShelfId).catch(() => undefined);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -23,9 +23,9 @@ describe('BookdropFileReviewComponent', () => {
|
|||||||
const discardFiles = vi.fn();
|
const discardFiles = vi.fn();
|
||||||
const finalizeImport = vi.fn();
|
const finalizeImport = vi.fn();
|
||||||
const rescan = vi.fn();
|
const rescan = vi.fn();
|
||||||
const openBookdropFinalizeResultDialog = vi.fn();
|
const openBookdropFinalizeResultDialog = vi.fn(() => Promise.resolve(null));
|
||||||
const openDialog = vi.fn();
|
const openDialog = vi.fn(() => Promise.resolve(null));
|
||||||
const openDirectoryPickerDialog = vi.fn();
|
const openDirectoryPickerDialog = vi.fn(() => Promise.resolve(null));
|
||||||
const setPageTitle = vi.fn();
|
const setPageTitle = vi.fn();
|
||||||
const translate = vi.fn((key: string, params?: Record<string, unknown>) => {
|
const translate = vi.fn((key: string, params?: Record<string, unknown>) => {
|
||||||
if (!params) {
|
if (!params) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { Router } from '@angular/router';
|
|||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
|
|
||||||
|
import { MessageService } from 'primeng/api';
|
||||||
import { getTranslocoModule } from '../../core/testing/transloco-testing';
|
import { getTranslocoModule } from '../../core/testing/transloco-testing';
|
||||||
import { BookDialogHelperService } from '../book/components/book-browser/book-dialog-helper.service';
|
import { BookDialogHelperService } from '../book/components/book-browser/book-dialog-helper.service';
|
||||||
import { Book } from '../book/model/book.model';
|
import { Book } from '../book/model/book.model';
|
||||||
@@ -65,20 +66,21 @@ describe('CommandPaletteService', () => {
|
|||||||
{ provide: MagicShelfService, useValue: { shelves: signal([]) } },
|
{ provide: MagicShelfService, useValue: { shelves: signal([]) } },
|
||||||
{ provide: LibraryService, useValue: { libraries: signal([]) } },
|
{ provide: LibraryService, useValue: { libraries: signal([]) } },
|
||||||
{ provide: UserService, useValue: { currentUser: signal({ permissions: {} }) } },
|
{ provide: UserService, useValue: { currentUser: signal({ permissions: {} }) } },
|
||||||
|
{ provide: MessageService, useValue: { add: vi.fn() } },
|
||||||
{ provide: UrlHelperService, useValue: urlHelper },
|
{ provide: UrlHelperService, useValue: urlHelper },
|
||||||
{ provide: IconService, useValue: { getSvgIconContent: vi.fn(() => of('')) } },
|
{ provide: IconService, useValue: { getSvgIconContent: vi.fn(() => of('')) } },
|
||||||
{
|
{
|
||||||
provide: DialogLauncherService,
|
provide: DialogLauncherService,
|
||||||
useValue: {
|
useValue: {
|
||||||
openLibraryCreateDialog: vi.fn(),
|
openLibraryCreateDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openMagicShelfCreateDialog: vi.fn(),
|
openMagicShelfCreateDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openFileUploadDialog: vi.fn(),
|
openFileUploadDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: BookDialogHelperService,
|
provide: BookDialogHelperService,
|
||||||
useValue: {
|
useValue: {
|
||||||
openShelfCreatorDialog: vi.fn(),
|
openShelfCreatorDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { computed, inject, Injectable, signal } from '@angular/core';
|
import { computed, inject, Injectable, signal } from '@angular/core';
|
||||||
|
import { MessageService } from 'primeng/api';
|
||||||
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
|
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { TranslocoService } from '@jsverse/transloco';
|
import { TranslocoService } from '@jsverse/transloco';
|
||||||
@@ -50,6 +51,7 @@ export class CommandPaletteService {
|
|||||||
private readonly bookDialogHelperService = inject(BookDialogHelperService);
|
private readonly bookDialogHelperService = inject(BookDialogHelperService);
|
||||||
private readonly iconService = inject(IconService);
|
private readonly iconService = inject(IconService);
|
||||||
private readonly urlHelper = inject(UrlHelperService);
|
private readonly urlHelper = inject(UrlHelperService);
|
||||||
|
private readonly messageService = inject(MessageService);
|
||||||
|
|
||||||
private readonly _isOpen = signal(false);
|
private readonly _isOpen = signal(false);
|
||||||
readonly isOpen = this._isOpen.asReadonly();
|
readonly isOpen = this._isOpen.asReadonly();
|
||||||
@@ -131,7 +133,7 @@ export class CommandPaletteService {
|
|||||||
this.hide();
|
this.hide();
|
||||||
queueMicrotask(() => {
|
queueMicrotask(() => {
|
||||||
if (item.command) {
|
if (item.command) {
|
||||||
item.command();
|
void Promise.resolve(item.command()).catch(() => undefined);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (item.route) {
|
if (item.route) {
|
||||||
@@ -211,10 +213,10 @@ export class CommandPaletteService {
|
|||||||
const user = this.userService.currentUser();
|
const user = this.userService.currentUser();
|
||||||
if (!user) return [];
|
if (!user) return [];
|
||||||
return buildQuickActionNavItems(this.translate, user.permissions, {
|
return buildQuickActionNavItems(this.translate, user.permissions, {
|
||||||
createLibrary: () => this.dialogLauncherService.openLibraryCreateDialog(),
|
createLibrary: () => void this.dialogLauncherService.openLibraryCreateDialog().catch(() => undefined),
|
||||||
createShelf: () => this.bookDialogHelperService.openShelfCreatorDialog(),
|
createShelf: () => void this.bookDialogHelperService.openShelfCreatorDialog().catch(() => undefined),
|
||||||
createMagicShelf: () => this.dialogLauncherService.openMagicShelfCreateDialog(),
|
createMagicShelf: () => void this.dialogLauncherService.openMagicShelfCreateDialog().catch(() => undefined),
|
||||||
uploadBook: () => this.dialogLauncherService.openFileUploadDialog(),
|
uploadBook: () => void this.dialogLauncherService.openFileUploadDialog().catch(() => undefined),
|
||||||
}).map((item) => this.toPaletteNavItem(item, 'action'));
|
}).map((item) => this.toPaletteNavItem(item, 'action'));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -320,5 +322,4 @@ export class CommandPaletteService {
|
|||||||
command: item.action,
|
command: item.action,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -62,10 +62,10 @@ export class MainDashboardComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
openDashboardSettings(): void {
|
openDashboardSettings(): void {
|
||||||
this.dialogLauncher.openDashboardSettingsDialog();
|
void this.dialogLauncher.openDashboardSettingsDialog().catch(() => undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
createNewLibrary() {
|
createNewLibrary() {
|
||||||
this.dialogLauncher.openLibraryCreateDialog();
|
void this.dialogLauncher.openLibraryCreateDialog().catch(() => undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,8 +215,8 @@ export class LibraryCreatorComponent {
|
|||||||
return this.allBookFormats.some(f => this.getFormatWarning(f.type) !== null);
|
return this.allBookFormats.some(f => this.getFormatWarning(f.type) !== null);
|
||||||
}
|
}
|
||||||
|
|
||||||
openDirectoryPicker(): void {
|
async openDirectoryPicker(): Promise<void> {
|
||||||
const ref = this.dialogLauncherService.openDirectoryPickerDialog();
|
const ref = await this.dialogLauncherService.openDirectoryPickerDialog().catch(() => null);
|
||||||
ref?.onClose.subscribe((selectedFolders: string[] | null) => {
|
ref?.onClose.subscribe((selectedFolders: string[] | null) => {
|
||||||
if (selectedFolders && selectedFolders.length > 0) {
|
if (selectedFolders && selectedFolders.length > 0) {
|
||||||
this.folders.update(current => {
|
this.folders.update(current => {
|
||||||
|
|||||||
+4
-4
@@ -1114,8 +1114,8 @@ export class MetadataEditorComponent implements OnInit {
|
|||||||
this.closeDialogButtonClicked.emit();
|
this.closeDialogButtonClicked.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
openCoverSearch() {
|
async openCoverSearch() {
|
||||||
const ref = this.bookDialogHelperService.openCoverSearchDialog(this.currentBookId, 'ebook');
|
const ref = await this.bookDialogHelperService.openCoverSearchDialog(this.currentBookId, 'ebook');
|
||||||
ref?.onClose.pipe(
|
ref?.onClose.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
filter(result => !!result),
|
filter(result => !!result),
|
||||||
@@ -1204,8 +1204,8 @@ export class MetadataEditorComponent implements OnInit {
|
|||||||
return this.bookMetadataManageService.getUploadAudiobookCoverUrl(this.currentBookId);
|
return this.bookMetadataManageService.getUploadAudiobookCoverUrl(this.currentBookId);
|
||||||
}
|
}
|
||||||
|
|
||||||
openAudiobookCoverSearch() {
|
async openAudiobookCoverSearch() {
|
||||||
const ref = this.bookDialogHelperService.openCoverSearchDialog(this.currentBookId, 'audiobook');
|
const ref = await this.bookDialogHelperService.openCoverSearchDialog(this.currentBookId, 'audiobook');
|
||||||
ref?.onClose.pipe(
|
ref?.onClose.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
filter(result => !!result),
|
filter(result => !!result),
|
||||||
|
|||||||
+5
-5
@@ -67,11 +67,11 @@ describe('MetadataViewerComponent', () => {
|
|||||||
const deleteBookFile = vi.fn(() => of(void 0));
|
const deleteBookFile = vi.fn(() => of(void 0));
|
||||||
const detachBookFile = vi.fn(() => of(void 0));
|
const detachBookFile = vi.fn(() => of(void 0));
|
||||||
|
|
||||||
const openAdditionalFileUploaderDialog = vi.fn();
|
const openAdditionalFileUploaderDialog = vi.fn(() => Promise.resolve(null));
|
||||||
const openCustomSendDialog = vi.fn();
|
const openCustomSendDialog = vi.fn(() => Promise.resolve(null));
|
||||||
const openBookFileAttacherDialog = vi.fn();
|
const openBookFileAttacherDialog = vi.fn(() => Promise.resolve(null));
|
||||||
const openFileMoverDialog = vi.fn();
|
const openFileMoverDialog = vi.fn(() => Promise.resolve(null));
|
||||||
const openShelfAssignerDialog = vi.fn();
|
const openShelfAssignerDialog = vi.fn(() => Promise.resolve(null));
|
||||||
|
|
||||||
const emailBookQuick = vi.fn(() => of(void 0));
|
const emailBookQuick = vi.fn(() => of(void 0));
|
||||||
const refreshMetadataTask = vi.fn(() => of(void 0));
|
const refreshMetadataTask = vi.fn(() => of(void 0));
|
||||||
|
|||||||
+11
-9
@@ -214,7 +214,9 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
|||||||
items.push({
|
items.push({
|
||||||
label: this.t.translate('metadata.viewer.menuShelf'),
|
label: this.t.translate('metadata.viewer.menuShelf'),
|
||||||
icon: 'pi pi-folder',
|
icon: 'pi pi-folder',
|
||||||
command: () => this.assignShelf(book.id)
|
command: () => {
|
||||||
|
void this.assignShelf(book).catch(() => undefined);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (permissions?.canManageLibrary || permissions?.admin) {
|
if (permissions?.canManageLibrary || permissions?.admin) {
|
||||||
@@ -235,7 +237,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
|||||||
label: this.t.translate('metadata.viewer.menuUploadFile'),
|
label: this.t.translate('metadata.viewer.menuUploadFile'),
|
||||||
icon: 'pi pi-upload',
|
icon: 'pi pi-upload',
|
||||||
command: () => {
|
command: () => {
|
||||||
this.bookDialogHelperService.openAdditionalFileUploaderDialog(book);
|
void this.bookDialogHelperService.openAdditionalFileUploaderDialog(book).catch(() => undefined);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -247,7 +249,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
|||||||
label: this.t.translate('metadata.viewer.menuOrganizeFiles'),
|
label: this.t.translate('metadata.viewer.menuOrganizeFiles'),
|
||||||
icon: 'pi pi-arrows-h',
|
icon: 'pi pi-arrows-h',
|
||||||
command: () => {
|
command: () => {
|
||||||
this.openFileMoverDialog(book.id);
|
void this.openFileMoverDialog(book.id).catch(() => undefined);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -266,7 +268,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
|||||||
label: this.t.translate('metadata.viewer.menuCustomSend'),
|
label: this.t.translate('metadata.viewer.menuCustomSend'),
|
||||||
icon: 'pi pi-cog',
|
icon: 'pi pi-cog',
|
||||||
command: () => {
|
command: () => {
|
||||||
this.bookDialogHelperService.openCustomSendDialog(book);
|
void this.bookDialogHelperService.openCustomSendDialog(book).catch(() => undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -281,7 +283,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
|||||||
label: this.t.translate('metadata.viewer.menuAttachToAnotherBook'),
|
label: this.t.translate('metadata.viewer.menuAttachToAnotherBook'),
|
||||||
icon: 'pi pi-link',
|
icon: 'pi pi-link',
|
||||||
command: () => {
|
command: () => {
|
||||||
this.bookDialogHelperService.openBookFileAttacherDialog(book);
|
void this.bookDialogHelperService.openBookFileAttacherDialog(book).catch(() => undefined);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -687,8 +689,8 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assignShelf(bookId: number) {
|
async assignShelf(book: Book) {
|
||||||
this.bookDialogHelperService.openShelfAssignerDialog((this.bookService.findBookById(bookId) as Book), null);
|
await this.bookDialogHelperService.openShelfAssignerDialog(book, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateReadStatus(status: ReadStatus): void {
|
updateReadStatus(status: ReadStatus): void {
|
||||||
@@ -1251,8 +1253,8 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
|||||||
this.editDateFinished = null;
|
this.editDateFinished = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
openFileMoverDialog(bookId: number): void {
|
async openFileMoverDialog(bookId: number) {
|
||||||
this.bookDialogHelperService.openFileMoverDialog(new Set([bookId]));
|
await this.bookDialogHelperService.openFileMoverDialog(new Set([bookId]));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly ResetProgressTypes = ResetProgressTypes;
|
protected readonly ResetProgressTypes = ResetProgressTypes;
|
||||||
|
|||||||
+2
-2
@@ -153,8 +153,8 @@ export class EmailV2ProviderComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openCreateProviderDialog() {
|
async openCreateProviderDialog() {
|
||||||
this.ref = this.dialogLauncherService.openEmailProviderDialog();
|
this.ref = await this.dialogLauncherService.openEmailProviderDialog().catch(() => null);
|
||||||
this.ref?.onClose.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((result) => {
|
this.ref?.onClose.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.loadEmailProviders();
|
this.loadEmailProviders();
|
||||||
|
|||||||
+2
-2
@@ -140,8 +140,8 @@ export class EmailV2RecipientComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openAddRecipientDialog() {
|
async openAddRecipientDialog() {
|
||||||
this.ref = this.dialogLauncherService.openEmailRecipientDialog();
|
this.ref = await this.dialogLauncherService.openEmailRecipientDialog().catch(() => null);
|
||||||
this.ref?.onClose.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((result) => {
|
this.ref?.onClose.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.loadRecipientEmails();
|
this.loadRecipientEmails();
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ export class UserManagementComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openCreateUserDialog() {
|
async openCreateUserDialog() {
|
||||||
this.ref = this.dialogLauncherService.openCreateUserDialog();
|
this.ref = await this.dialogLauncherService.openCreateUserDialog().catch(() => null);
|
||||||
this.ref?.onClose.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((result) => {
|
this.ref?.onClose.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.loadUsers();
|
this.loadUsers();
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ interface ChartConfig {
|
|||||||
category: string;
|
category: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import {provideCharts, withDefaultRegisterables} from 'ng2-charts';
|
||||||
|
import ChartDataLabels from 'chartjs-plugin-datalabels';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-library-stats',
|
selector: 'app-library-stats',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -44,6 +47,7 @@ interface ChartConfig {
|
|||||||
ReadingJourneyChartComponent,
|
ReadingJourneyChartComponent,
|
||||||
TranslocoDirective
|
TranslocoDirective
|
||||||
],
|
],
|
||||||
|
providers: [provideCharts(withDefaultRegisterables(ChartDataLabels))],
|
||||||
templateUrl: './library-stats.component.html',
|
templateUrl: './library-stats.component.html',
|
||||||
styleUrls: ['./library-stats.component.scss']
|
styleUrls: ['./library-stats.component.scss']
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ import {PublicationEraChartComponent} from './charts/publication-era-chart/publi
|
|||||||
import {SessionArchetypesChartComponent} from './charts/session-archetypes-chart/session-archetypes-chart.component';
|
import {SessionArchetypesChartComponent} from './charts/session-archetypes-chart/session-archetypes-chart.component';
|
||||||
import {UserChartConfig, UserChartConfigService} from './service/user-chart-config.service';
|
import {UserChartConfig, UserChartConfigService} from './service/user-chart-config.service';
|
||||||
|
|
||||||
|
import {provideCharts, withDefaultRegisterables} from 'ng2-charts';
|
||||||
|
import ChartDataLabels from 'chartjs-plugin-datalabels';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-stats',
|
selector: 'app-user-stats',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -61,6 +64,7 @@ import {UserChartConfig, UserChartConfigService} from './service/user-chart-conf
|
|||||||
SessionArchetypesChartComponent,
|
SessionArchetypesChartComponent,
|
||||||
TranslocoDirective
|
TranslocoDirective
|
||||||
],
|
],
|
||||||
|
providers: [provideCharts(withDefaultRegisterables(ChartDataLabels))],
|
||||||
templateUrl: './user-stats.component.html',
|
templateUrl: './user-stats.component.html',
|
||||||
styleUrls: ['./user-stats.component.scss']
|
styleUrls: ['./user-stats.component.scss']
|
||||||
})
|
})
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ describe('MetadataProgressWidgetComponent', () => {
|
|||||||
cancelTask: vi.fn(() => of({cancelled: true})),
|
cancelTask: vi.fn(() => of({cancelled: true})),
|
||||||
};
|
};
|
||||||
dialogLauncherService = {
|
dialogLauncherService = {
|
||||||
openMetadataReviewDialog: vi.fn(),
|
openMetadataReviewDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
};
|
};
|
||||||
messageService = {
|
messageService = {
|
||||||
add: vi.fn(),
|
add: vi.fn(),
|
||||||
|
|||||||
+1
-1
@@ -102,7 +102,7 @@ export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reviewTask(taskId: string): void {
|
reviewTask(taskId: string): void {
|
||||||
this.dialogLauncherService.openMetadataReviewDialog(taskId);
|
void this.dialogLauncherService.openMetadataReviewDialog(taskId).catch(() => undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelTask(taskId: string): void {
|
cancelTask(taskId: string): void {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { computed, signal, WritableSignal } from '@angular/core';
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { BehaviorSubject } from 'rxjs';
|
import { BehaviorSubject } from 'rxjs';
|
||||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||||
|
import { MessageService } from 'primeng/api';
|
||||||
|
|
||||||
import { getTranslocoModule } from '../../../core/testing/transloco-testing';
|
import { getTranslocoModule } from '../../../core/testing/transloco-testing';
|
||||||
import { BookDialogHelperService } from '../../../features/book/components/book-browser/book-dialog-helper.service';
|
import { BookDialogHelperService } from '../../../features/book/components/book-browser/book-dialog-helper.service';
|
||||||
@@ -104,13 +105,13 @@ describe('AppSidebarComponent', () => {
|
|||||||
{
|
{
|
||||||
provide: DialogLauncherService,
|
provide: DialogLauncherService,
|
||||||
useValue: {
|
useValue: {
|
||||||
openLibraryCreateDialog: vi.fn(),
|
openLibraryCreateDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openMagicShelfCreateDialog: vi.fn(),
|
openMagicShelfCreateDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
openFileUploadDialog: vi.fn(),
|
openFileUploadDialog: vi.fn(() => Promise.resolve(null)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ provide: CommandPaletteService, useValue: commandPaletteService },
|
{ provide: CommandPaletteService, useValue: commandPaletteService },
|
||||||
{ provide: BookDialogHelperService, useValue: { openShelfCreatorDialog: vi.fn() } },
|
{ provide: BookDialogHelperService, useValue: { openShelfCreatorDialog: vi.fn(() => Promise.resolve(null)) } },
|
||||||
{ provide: AuthService, useValue: { logout: vi.fn() } },
|
{ provide: AuthService, useValue: { logout: vi.fn() } },
|
||||||
{ provide: MetadataProgressService, useValue: { activeTasks$, progressUpdates$ } },
|
{ provide: MetadataProgressService, useValue: { activeTasks$, progressUpdates$ } },
|
||||||
{ provide: BookdropFileService, useValue: { hasPendingFiles$ } },
|
{ provide: BookdropFileService, useValue: { hasPendingFiles$ } },
|
||||||
@@ -120,6 +121,7 @@ describe('AppSidebarComponent', () => {
|
|||||||
{ provide: MagicShelfService, useValue: { shelves: signal([]), bookCountByMagicShelfId: signal(new Map()) } },
|
{ provide: MagicShelfService, useValue: { shelves: signal([]), bookCountByMagicShelfId: signal(new Map()) } },
|
||||||
{ provide: SeriesDataService, useValue: { allSeries: signal([]) } },
|
{ provide: SeriesDataService, useValue: { allSeries: signal([]) } },
|
||||||
{ provide: AuthorService, useValue: { allAuthors: signal([]) } },
|
{ provide: AuthorService, useValue: { allAuthors: signal([]) } },
|
||||||
|
{ provide: MessageService, useValue: { add: vi.fn() } },
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ import { AuthService } from '../../service/auth.service';
|
|||||||
import { LayoutService } from '../layout.service';
|
import { LayoutService } from '../layout.service';
|
||||||
import { TranslocoDirective, TranslocoPipe, TranslocoService } from '@jsverse/transloco';
|
import { TranslocoDirective, TranslocoPipe, TranslocoService } from '@jsverse/transloco';
|
||||||
import { Tooltip } from 'primeng/tooltip';
|
import { Tooltip } from 'primeng/tooltip';
|
||||||
|
import { MessageService } from 'primeng/api';
|
||||||
|
import { VersionService } from '../../service/version.service';
|
||||||
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
||||||
import { NavItem, SidebarSection } from '../navigation/nav-item.model';
|
import { NavItem, SidebarSection } from '../navigation/nav-item.model';
|
||||||
import { buildCreateActionNavItems } from '../navigation/nav-catalog';
|
import { buildCreateActionNavItems } from '../navigation/nav-catalog';
|
||||||
@@ -40,7 +42,6 @@ import {
|
|||||||
buildShelfSection,
|
buildShelfSection,
|
||||||
buildToolsSection,
|
buildToolsSection,
|
||||||
} from './sidebar-sections';
|
} from './sidebar-sections';
|
||||||
import { VersionService } from '../../service/version.service';
|
|
||||||
import { MetadataProgressService } from '../../service/metadata-progress.service';
|
import { MetadataProgressService } from '../../service/metadata-progress.service';
|
||||||
import { BookdropFileService } from '../../../features/bookdrop/service/bookdrop-file.service';
|
import { BookdropFileService } from '../../../features/bookdrop/service/bookdrop-file.service';
|
||||||
import { MetadataBatchProgressNotification, MetadataBatchStatus } from '../../model/metadata-batch-progress.model';
|
import { MetadataBatchProgressNotification, MetadataBatchStatus } from '../../model/metadata-batch-progress.model';
|
||||||
@@ -119,7 +120,6 @@ export class AppSidebarComponent {
|
|||||||
private readonly commandPaletteService = inject(CommandPaletteService);
|
private readonly commandPaletteService = inject(CommandPaletteService);
|
||||||
private readonly bookDialogHelperService = inject(BookDialogHelperService);
|
private readonly bookDialogHelperService = inject(BookDialogHelperService);
|
||||||
private readonly authService = inject(AuthService);
|
private readonly authService = inject(AuthService);
|
||||||
private readonly router = inject(Router);
|
|
||||||
readonly layoutService = inject(LayoutService);
|
readonly layoutService = inject(LayoutService);
|
||||||
private readonly userService = inject(UserService);
|
private readonly userService = inject(UserService);
|
||||||
private readonly versionService = inject(VersionService);
|
private readonly versionService = inject(VersionService);
|
||||||
@@ -128,9 +128,11 @@ export class AppSidebarComponent {
|
|||||||
private readonly authorService = inject(AuthorService);
|
private readonly authorService = inject(AuthorService);
|
||||||
private readonly t = inject(TranslocoService);
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly renderer = inject(Renderer2);
|
private readonly renderer = inject(Renderer2);
|
||||||
private readonly destroyRef = inject(DestroyRef);
|
private readonly router = inject(Router);
|
||||||
private readonly metadataProgressService = inject(MetadataProgressService);
|
private readonly messageService = inject(MessageService);
|
||||||
private readonly bookdropFileService = inject(BookdropFileService);
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
private readonly metadataProgressService = inject(MetadataProgressService);
|
||||||
|
private readonly bookdropFileService = inject(BookdropFileService);
|
||||||
|
|
||||||
readonly currentUser = this.userService.currentUser;
|
readonly currentUser = this.userService.currentUser;
|
||||||
private readonly allAuthors = this.authorService.allAuthors;
|
private readonly allAuthors = this.authorService.allAuthors;
|
||||||
@@ -199,10 +201,10 @@ export class AppSidebarComponent {
|
|||||||
if (!user) return [];
|
if (!user) return [];
|
||||||
|
|
||||||
const actions = buildCreateActionNavItems(this.translate, user.permissions, {
|
const actions = buildCreateActionNavItems(this.translate, user.permissions, {
|
||||||
createLibrary: () => this.dialogLauncherService.openLibraryCreateDialog(),
|
createLibrary: () => void this.dialogLauncherService.openLibraryCreateDialog().catch(() => undefined),
|
||||||
createShelf: () => this.bookDialogHelperService.openShelfCreatorDialog(),
|
createShelf: () => void this.bookDialogHelperService.openShelfCreatorDialog().catch(() => undefined),
|
||||||
createMagicShelf: () => this.dialogLauncherService.openMagicShelfCreateDialog(),
|
createMagicShelf: () => void this.dialogLauncherService.openMagicShelfCreateDialog().catch(() => undefined),
|
||||||
uploadBook: () => this.dialogLauncherService.openFileUploadDialog(),
|
uploadBook: () => void this.dialogLauncherService.openFileUploadDialog().catch(() => undefined),
|
||||||
});
|
});
|
||||||
return this.toMenuEntries(actions);
|
return this.toMenuEntries(actions);
|
||||||
});
|
});
|
||||||
@@ -274,29 +276,28 @@ export class AppSidebarComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected openAccountSettings(): void {
|
protected openAccountSettings(): void {
|
||||||
this.dialogLauncherService.openUserProfileDialog();
|
void this.dialogLauncherService.openUserProfileDialog().catch(() => undefined);
|
||||||
this.closeUserPopover();
|
this.closeUserPopover();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected openSettings(): void {
|
protected openSettings(): void {
|
||||||
this.router.navigate(['/settings']);
|
this.router.navigate(['/settings']);
|
||||||
this.closeUserPopover();
|
this.closeUserPopover();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected openChangelogDialog(): void {
|
protected openChangelogDialog(): void {
|
||||||
this.dialogLauncherService.openVersionChangelogDialog();
|
void this.dialogLauncherService.openVersionChangelogDialog().catch(() => undefined);
|
||||||
this.closeUserPopover();
|
this.closeUserPopover();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected openReadingStats(): void {
|
protected openReadingStats(): void {
|
||||||
this.router.navigate(['/reading-stats']);
|
this.router.navigate(['/reading-stats']);
|
||||||
this.closeUserPopover();
|
this.closeUserPopover();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected openUploadDialog(): void {
|
protected openUploadDialog(): void {
|
||||||
this.dialogLauncherService.openFileUploadDialog();
|
void this.dialogLauncherService.openFileUploadDialog().catch(() => undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected logout(): void {
|
protected logout(): void {
|
||||||
this.authService.logout();
|
this.authService.logout();
|
||||||
this.closeUserPopover();
|
this.closeUserPopover();
|
||||||
@@ -366,24 +367,24 @@ export class AppSidebarComponent {
|
|||||||
overlay.toggle(event);
|
overlay.toggle(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
private subscribeToMetadataProgress(): void {
|
private subscribeToMetadataProgress(): void {
|
||||||
this.metadataProgressService.progressUpdates$
|
this.metadataProgressService.progressUpdates$
|
||||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((progress) => {
|
.subscribe((progress) => {
|
||||||
this.progressHighlight = progress.status === MetadataBatchStatus.IN_PROGRESS;
|
this.progressHighlight = progress.status === MetadataBatchStatus.IN_PROGRESS;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private replaceLatestTasks(tasks: Record<string, MetadataBatchProgressNotification>): void {
|
private replaceLatestTasks(tasks: Record<string, MetadataBatchProgressNotification>): void {
|
||||||
for (const key of Object.keys(this.latestTasks)) {
|
for (const key of Object.keys(this.latestTasks)) {
|
||||||
delete this.latestTasks[key];
|
delete this.latestTasks[key];
|
||||||
}
|
|
||||||
Object.assign(this.latestTasks, tasks);
|
|
||||||
}
|
}
|
||||||
|
Object.assign(this.latestTasks, tasks);
|
||||||
|
}
|
||||||
|
|
||||||
private updateCompletedTaskCount(): void {
|
private updateCompletedTaskCount(): void {
|
||||||
const metadataTaskCount = Object.keys(this.latestTasks).length;
|
const metadataTaskCount = Object.keys(this.latestTasks).length;
|
||||||
const bookdropFileTaskCount = this.hasPendingBookdropFiles ? 1 : 0;
|
const bookdropFileTaskCount = this.hasPendingBookdropFiles ? 1 : 0;
|
||||||
this.completedTaskCount = metadataTaskCount + bookdropFileTaskCount;
|
this.completedTaskCount = metadataTaskCount + bookdropFileTaskCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ describe('IconPickerService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns the icon selected by the dialog', async () => {
|
it('returns the icon selected by the dialog', async () => {
|
||||||
dialogLauncherService.openIconPickerDialog.mockReturnValue({
|
dialogLauncherService.openIconPickerDialog.mockResolvedValue({
|
||||||
onClose: of({type: 'PRIME_NG', value: 'pi pi-book'}),
|
onClose: of({type: 'PRIME_NG', value: 'pi pi-book'}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {inject, Injectable} from '@angular/core';
|
import {inject, Injectable} from '@angular/core';
|
||||||
import {Observable} from 'rxjs';
|
import {EMPTY, from, Observable, switchMap} from 'rxjs';
|
||||||
import {DialogLauncherService} from '../services/dialog-launcher.service';
|
import {DialogLauncherService} from '../services/dialog-launcher.service';
|
||||||
|
|
||||||
export interface IconSelection {
|
export interface IconSelection {
|
||||||
@@ -12,7 +12,13 @@ export class IconPickerService {
|
|||||||
private dialogLauncherService = inject(DialogLauncherService);
|
private dialogLauncherService = inject(DialogLauncherService);
|
||||||
|
|
||||||
open(): Observable<IconSelection> {
|
open(): Observable<IconSelection> {
|
||||||
const ref = this.dialogLauncherService.openIconPickerDialog();
|
return from(this.dialogLauncherService.openIconPickerDialog()).pipe(
|
||||||
return ref!.onClose as Observable<IconSelection>;
|
switchMap(ref => {
|
||||||
|
if (!ref) {
|
||||||
|
return EMPTY;
|
||||||
|
}
|
||||||
|
return ref.onClose as Observable<IconSelection>;
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import {TestBed} from '@angular/core/testing';
|
import {TestBed} from '@angular/core/testing';
|
||||||
import {beforeEach, describe, expect, it, vi} from 'vitest';
|
import {beforeEach, describe, expect, it, vi} from 'vitest';
|
||||||
import {DialogService} from 'primeng/dynamicdialog';
|
import {DialogService} from 'primeng/dynamicdialog';
|
||||||
|
import {MessageService} from 'primeng/api';
|
||||||
|
import {getTranslocoModule} from '../../core/testing/transloco-testing';
|
||||||
|
|
||||||
import {DashboardSettingsComponent} from '../../features/dashboard/components/dashboard-settings/dashboard-settings.component';
|
import {DashboardSettingsComponent} from '../../features/dashboard/components/dashboard-settings/dashboard-settings.component';
|
||||||
import {LibraryCreatorComponent} from '../../features/library-creator/library-creator.component';
|
import {LibraryCreatorComponent} from '../../features/library-creator/library-creator.component';
|
||||||
@@ -20,17 +22,19 @@ describe('DialogLauncherService', () => {
|
|||||||
|
|
||||||
TestBed.resetTestingModule();
|
TestBed.resetTestingModule();
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
|
imports: [getTranslocoModule()],
|
||||||
providers: [
|
providers: [
|
||||||
DialogLauncherService,
|
DialogLauncherService,
|
||||||
{provide: DialogService, useValue: dialogService},
|
{provide: DialogService, useValue: dialogService},
|
||||||
|
{provide: MessageService, useValue: {add: vi.fn()}},
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
service = TestBed.inject(DialogLauncherService);
|
service = TestBed.inject(DialogLauncherService);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('merges the default dialog options with caller overrides', () => {
|
it('merges the default dialog options with caller overrides', async () => {
|
||||||
service.openDialog(LibraryCreatorComponent, {
|
await service.openDialog(LibraryCreatorComponent, {
|
||||||
showHeader: false,
|
showHeader: false,
|
||||||
data: {mode: 'create'},
|
data: {mode: 'create'},
|
||||||
});
|
});
|
||||||
@@ -51,8 +55,8 @@ describe('DialogLauncherService', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('opens the dashboard settings dialog with the expected style class', () => {
|
it('opens the dashboard settings dialog with the expected style class', async () => {
|
||||||
service.openDashboardSettingsDialog();
|
await service.openDashboardSettingsDialog();
|
||||||
|
|
||||||
expect(dialogService.open).toHaveBeenCalledWith(
|
expect(dialogService.open).toHaveBeenCalledWith(
|
||||||
DashboardSettingsComponent,
|
DashboardSettingsComponent,
|
||||||
@@ -63,8 +67,8 @@ describe('DialogLauncherService', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('passes the library id into the library edit dialog', () => {
|
it('passes the library id into the library edit dialog', async () => {
|
||||||
service.openLibraryEditDialog(12);
|
await service.openLibraryEditDialog(12);
|
||||||
|
|
||||||
expect(dialogService.open).toHaveBeenCalledWith(
|
expect(dialogService.open).toHaveBeenCalledWith(
|
||||||
LibraryCreatorComponent,
|
LibraryCreatorComponent,
|
||||||
|
|||||||
@@ -1,20 +1,9 @@
|
|||||||
import {inject, Injectable, Type} from '@angular/core';
|
import {inject, Injectable, Type} from '@angular/core';
|
||||||
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||||
import {LibraryCreatorComponent} from '../../features/library-creator/library-creator.component';
|
import {TranslocoService} from '@jsverse/transloco';
|
||||||
import {BookUploaderComponent} from '../components/book-uploader/book-uploader.component';
|
import {MessageService} from 'primeng/api';
|
||||||
import {UserProfileDialogComponent} from '../../features/settings/user-profile-dialog/user-profile-dialog.component';
|
import {MetadataRefreshType} from '../../features/metadata/model/request/metadata-refresh-type.enum';
|
||||||
import {MagicShelfComponent} from '../../features/magic-shelf/component/magic-shelf-component';
|
|
||||||
import {DashboardSettingsComponent} from '../../features/dashboard/components/dashboard-settings/dashboard-settings.component';
|
|
||||||
import {VersionChangelogDialogComponent} from '../layout/layout-sidebar/version-changelog-dialog/version-changelog-dialog.component';
|
|
||||||
import {CreateUserDialogComponent} from '../../features/settings/user-management/create-user-dialog/create-user-dialog.component';
|
|
||||||
import {CreateEmailRecipientDialogComponent} from '../../features/settings/email-v2/create-email-recipient-dialog/create-email-recipient-dialog.component';
|
|
||||||
import {CreateEmailProviderDialogComponent} from '../../features/settings/email-v2/create-email-provider-dialog/create-email-provider-dialog.component';
|
|
||||||
import {DirectoryPickerComponent} from '../components/directory-picker/directory-picker.component';
|
|
||||||
import {BookdropFinalizeResultDialogComponent} from '../../features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component';
|
|
||||||
import {BookdropFinalizeResult} from '../../features/bookdrop/service/bookdrop.service';
|
import {BookdropFinalizeResult} from '../../features/bookdrop/service/bookdrop.service';
|
||||||
import {MetadataReviewDialogComponent} from '../../features/metadata/component/metadata-review-dialog/metadata-review-dialog-component';
|
|
||||||
import {ShelfEditDialogComponent} from '../../features/book/components/shelf-edit-dialog/shelf-edit-dialog.component';
|
|
||||||
import {IconPickerComponent} from '../components/icon-picker/icon-picker-component';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog size classes - use these to control dialog dimensions
|
* Dialog size classes - use these to control dialog dimensions
|
||||||
@@ -40,7 +29,9 @@ export const DialogStyle = {
|
|||||||
})
|
})
|
||||||
export class DialogLauncherService {
|
export class DialogLauncherService {
|
||||||
|
|
||||||
dialogService = inject(DialogService);
|
private readonly dialogService = inject(DialogService);
|
||||||
|
private readonly messageService = inject(MessageService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
|
|
||||||
private defaultDialogOptions = {
|
private defaultDialogOptions = {
|
||||||
baseZIndex: 10,
|
baseZIndex: 10,
|
||||||
@@ -60,132 +51,206 @@ export class DialogLauncherService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openDashboardSettingsDialog(): DynamicDialogRef | null {
|
launchLazyDialog(dialogFn: () => Promise<DynamicDialogRef | null>): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(DashboardSettingsComponent, {
|
return dialogFn().catch(err => {
|
||||||
showHeader: false,
|
console.error('Failed to load dialog', err);
|
||||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
this.messageService.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: this.t.translate('common.error'),
|
||||||
|
detail: this.t.translate('common.dialogLoadError')
|
||||||
|
});
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openLibraryCreateDialog(): DynamicDialogRef | null {
|
async openDashboardSettingsDialog(): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(LibraryCreatorComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {DashboardSettingsComponent} = await import('../../features/dashboard/components/dashboard-settings/dashboard-settings.component');
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(DashboardSettingsComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openDirectoryPickerDialog(): DynamicDialogRef | null {
|
async openLibraryCreateDialog(): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(DirectoryPickerComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {LibraryCreatorComponent} = await import('../../features/library-creator/library-creator.component');
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(LibraryCreatorComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openLibraryEditDialog(libraryId: number): DynamicDialogRef | null {
|
async openDirectoryPickerDialog(): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(LibraryCreatorComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {DirectoryPickerComponent} = await import('../components/directory-picker/directory-picker.component');
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(DirectoryPickerComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
mode: 'edit',
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
libraryId: libraryId
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openShelfEditDialog(shelfId: number): DynamicDialogRef | null {
|
async openLibraryEditDialog(libraryId: number): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(ShelfEditDialogComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {LibraryCreatorComponent} = await import('../../features/library-creator/library-creator.component');
|
||||||
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(LibraryCreatorComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
shelfId: shelfId
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
})
|
mode: 'edit',
|
||||||
}
|
libraryId: libraryId
|
||||||
|
}
|
||||||
openFileUploadDialog(): DynamicDialogRef | null {
|
});
|
||||||
return this.openDialog(BookUploaderComponent, {
|
|
||||||
showHeader: false,
|
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openCreateUserDialog(): DynamicDialogRef | null {
|
async openLibraryMetadataFetchDialog(libraryId: number): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(CreateUserDialogComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {MetadataFetchOptionsComponent} = await import('../../features/metadata/component/metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component');
|
||||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(MetadataFetchOptionsComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
||||||
|
data: {
|
||||||
|
libraryId: libraryId,
|
||||||
|
metadataRefreshType: MetadataRefreshType.LIBRARY,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openUserProfileDialog(): DynamicDialogRef | null {
|
async openShelfEditDialog(shelfId: number): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(UserProfileDialogComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {ShelfEditDialogComponent} = await import('../../features/book/components/shelf-edit-dialog/shelf-edit-dialog.component');
|
||||||
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(ShelfEditDialogComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
||||||
|
data: {
|
||||||
|
shelfId: shelfId
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openMagicShelfCreateDialog(): DynamicDialogRef | null {
|
async openFileUploadDialog(): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(MagicShelfComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {BookUploaderComponent} = await import('../components/book-uploader/book-uploader.component');
|
||||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(BookUploaderComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openMagicShelfEditDialog(shelfId: number): DynamicDialogRef | null {
|
async openCreateUserDialog(): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(MagicShelfComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {CreateUserDialogComponent} = await import('../../features/settings/user-management/create-user-dialog/create-user-dialog.component');
|
||||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(CreateUserDialogComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
id: shelfId,
|
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||||
editMode: true,
|
});
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
openVersionChangelogDialog(): DynamicDialogRef | null {
|
|
||||||
return this.openDialog(VersionChangelogDialogComponent, {
|
|
||||||
showHeader: false,
|
|
||||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openEmailRecipientDialog(): DynamicDialogRef | null {
|
async openUserProfileDialog(): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(CreateEmailRecipientDialogComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {UserProfileDialogComponent} = await import('../../features/settings/user-profile-dialog/user-profile-dialog.component');
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(UserProfileDialogComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openEmailProviderDialog(): DynamicDialogRef | null {
|
async openMagicShelfCreateDialog(): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(CreateEmailProviderDialogComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {MagicShelfComponent} = await import('../../features/magic-shelf/component/magic-shelf-component');
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(MagicShelfComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openBookdropFinalizeResultDialog(result: BookdropFinalizeResult): DynamicDialogRef | null {
|
async openMagicShelfEditDialog(shelfId: number): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(BookdropFinalizeResultDialogComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {MagicShelfComponent} = await import('../../features/magic-shelf/component/magic-shelf-component');
|
||||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(MagicShelfComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
result: result,
|
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
data: {
|
||||||
|
id: shelfId,
|
||||||
|
editMode: true,
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openMetadataReviewDialog(taskId: string): DynamicDialogRef | null {
|
async openVersionChangelogDialog(): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(MetadataReviewDialogComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {VersionChangelogDialogComponent} = await import('../layout/layout-sidebar/version-changelog-dialog/version-changelog-dialog.component');
|
||||||
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(VersionChangelogDialogComponent, {
|
||||||
data: {
|
showHeader: false,
|
||||||
taskId,
|
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||||
},
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openIconPickerDialog(): DynamicDialogRef | null {
|
async openEmailRecipientDialog(): Promise<DynamicDialogRef | null> {
|
||||||
return this.openDialog(IconPickerComponent, {
|
return this.launchLazyDialog(async () => {
|
||||||
showHeader: false,
|
const {CreateEmailRecipientDialogComponent} = await import('../../features/settings/email-v2/create-email-recipient-dialog/create-email-recipient-dialog.component');
|
||||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
return this.openDialog(CreateEmailRecipientDialogComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async openEmailProviderDialog(): Promise<DynamicDialogRef | null> {
|
||||||
|
return this.launchLazyDialog(async () => {
|
||||||
|
const {CreateEmailProviderDialogComponent} = await import('../../features/settings/email-v2/create-email-provider-dialog/create-email-provider-dialog.component');
|
||||||
|
return this.openDialog(CreateEmailProviderDialogComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async openBookdropFinalizeResultDialog(result: BookdropFinalizeResult): Promise<DynamicDialogRef | null> {
|
||||||
|
return this.launchLazyDialog(async () => {
|
||||||
|
const {BookdropFinalizeResultDialogComponent} = await import('../../features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component');
|
||||||
|
return this.openDialog(BookdropFinalizeResultDialogComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||||
|
data: {
|
||||||
|
result: result,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async openMetadataReviewDialog(taskId: string): Promise<DynamicDialogRef | null> {
|
||||||
|
return this.launchLazyDialog(async () => {
|
||||||
|
const {MetadataReviewDialogComponent} = await import('../../features/metadata/component/metadata-review-dialog/metadata-review-dialog-component');
|
||||||
|
return this.openDialog(MetadataReviewDialogComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
||||||
|
data: {
|
||||||
|
taskId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async openIconPickerDialog(): Promise<DynamicDialogRef | null> {
|
||||||
|
return this.launchLazyDialog(async () => {
|
||||||
|
const {IconPickerComponent} = await import('../components/icon-picker/icon-picker-component');
|
||||||
|
return this.openDialog(IconPickerComponent, {
|
||||||
|
showHeader: false,
|
||||||
|
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,7 +300,8 @@
|
|||||||
"magicShelfDeletedDetail": "Magic shelf was deleted",
|
"magicShelfDeletedDetail": "Magic shelf was deleted",
|
||||||
"magicShelfDeleteFailedDetail": "Failed to delete shelf",
|
"magicShelfDeleteFailedDetail": "Failed to delete shelf",
|
||||||
"magicShelfJsonCopiedDetail": "Magic shelf JSON copied to clipboard",
|
"magicShelfJsonCopiedDetail": "Magic shelf JSON copied to clipboard",
|
||||||
"failedSummary": "Failed"
|
"failedSummary": "Failed",
|
||||||
|
"dialogLoadFailedDetail": "An error occurred while loading the dialog. Please try again."
|
||||||
},
|
},
|
||||||
"loading": {
|
"loading": {
|
||||||
"deletingLibrary": "Deleting library '{{ name }}'..."
|
"deletingLibrary": "Deleting library '{{ name }}'..."
|
||||||
|
|||||||
@@ -30,5 +30,6 @@
|
|||||||
"cardSizeControls": "Card size controls",
|
"cardSizeControls": "Card size controls",
|
||||||
"on": "On",
|
"on": "On",
|
||||||
"off": "Off",
|
"off": "Off",
|
||||||
"moreActionsFor": "More actions for {{label}}"
|
"moreActionsFor": "More actions for {{label}}",
|
||||||
|
"dialogLoadError": "An error occurred while loading the dialog. Please try again."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ import { GlobalErrorHandler } from './app/core/errors/global-error-handler';
|
|||||||
import { PwaUpdateService } from './app/core/services/pwa-update.service';
|
import { PwaUpdateService } from './app/core/services/pwa-update.service';
|
||||||
import { initializeAuthFactory } from './app/core/security/auth-initializer';
|
import { initializeAuthFactory } from './app/core/security/auth-initializer';
|
||||||
import { StartupService } from './app/shared/service/startup.service';
|
import { StartupService } from './app/shared/service/startup.service';
|
||||||
import { provideCharts, withDefaultRegisterables } from 'ng2-charts';
|
|
||||||
import ChartDataLabels from 'chartjs-plugin-datalabels';
|
|
||||||
import { provideServiceWorker } from '@angular/service-worker';
|
import { provideServiceWorker } from '@angular/service-worker';
|
||||||
import { provideTransloco } from '@jsverse/transloco';
|
import { provideTransloco } from '@jsverse/transloco';
|
||||||
import { AVAILABLE_LANGS, TranslocoInlineLoader } from './app/core/config/transloco-loader';
|
import { AVAILABLE_LANGS, TranslocoInlineLoader } from './app/core/config/transloco-loader';
|
||||||
@@ -28,7 +26,6 @@ import { provideTanStackQuery, QueryClient } from '@tanstack/angular-query-exper
|
|||||||
bootstrapApplication(AppComponent, {
|
bootstrapApplication(AppComponent, {
|
||||||
providers: [
|
providers: [
|
||||||
provideZonelessChangeDetection(),
|
provideZonelessChangeDetection(),
|
||||||
provideCharts(withDefaultRegisterables(), ChartDataLabels),
|
|
||||||
provideTanStackQuery(new QueryClient({
|
provideTanStackQuery(new QueryClient({
|
||||||
defaultOptions: {
|
defaultOptions: {
|
||||||
queries: {
|
queries: {
|
||||||
|
|||||||
Reference in New Issue
Block a user