perf(frontend): optimize initial bundle size with lazy-loaded dialogs and localized chart providers (#1110)
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ describe('MetadataProgressWidgetComponent', () => {
|
||||
cancelTask: vi.fn(() => of({cancelled: true})),
|
||||
};
|
||||
dialogLauncherService = {
|
||||
openMetadataReviewDialog: vi.fn(),
|
||||
openMetadataReviewDialog: vi.fn(() => Promise.resolve(null)),
|
||||
};
|
||||
messageService = {
|
||||
add: vi.fn(),
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
reviewTask(taskId: string): void {
|
||||
this.dialogLauncherService.openMetadataReviewDialog(taskId);
|
||||
void this.dialogLauncherService.openMetadataReviewDialog(taskId).catch(() => undefined);
|
||||
}
|
||||
|
||||
cancelTask(taskId: string): void {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { computed, signal, WritableSignal } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { MessageService } from 'primeng/api';
|
||||
|
||||
import { getTranslocoModule } from '../../../core/testing/transloco-testing';
|
||||
import { BookDialogHelperService } from '../../../features/book/components/book-browser/book-dialog-helper.service';
|
||||
@@ -104,13 +105,13 @@ describe('AppSidebarComponent', () => {
|
||||
{
|
||||
provide: DialogLauncherService,
|
||||
useValue: {
|
||||
openLibraryCreateDialog: vi.fn(),
|
||||
openMagicShelfCreateDialog: vi.fn(),
|
||||
openFileUploadDialog: vi.fn(),
|
||||
openLibraryCreateDialog: vi.fn(() => Promise.resolve(null)),
|
||||
openMagicShelfCreateDialog: vi.fn(() => Promise.resolve(null)),
|
||||
openFileUploadDialog: vi.fn(() => Promise.resolve(null)),
|
||||
},
|
||||
},
|
||||
{ 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: MetadataProgressService, useValue: { activeTasks$, progressUpdates$ } },
|
||||
{ provide: BookdropFileService, useValue: { hasPendingFiles$ } },
|
||||
@@ -120,6 +121,7 @@ describe('AppSidebarComponent', () => {
|
||||
{ provide: MagicShelfService, useValue: { shelves: signal([]), bookCountByMagicShelfId: signal(new Map()) } },
|
||||
{ provide: SeriesDataService, useValue: { allSeries: 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 { TranslocoDirective, TranslocoPipe, TranslocoService } from '@jsverse/transloco';
|
||||
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 { NavItem, SidebarSection } from '../navigation/nav-item.model';
|
||||
import { buildCreateActionNavItems } from '../navigation/nav-catalog';
|
||||
@@ -40,7 +42,6 @@ import {
|
||||
buildShelfSection,
|
||||
buildToolsSection,
|
||||
} from './sidebar-sections';
|
||||
import { VersionService } from '../../service/version.service';
|
||||
import { MetadataProgressService } from '../../service/metadata-progress.service';
|
||||
import { BookdropFileService } from '../../../features/bookdrop/service/bookdrop-file.service';
|
||||
import { MetadataBatchProgressNotification, MetadataBatchStatus } from '../../model/metadata-batch-progress.model';
|
||||
@@ -119,7 +120,6 @@ export class AppSidebarComponent {
|
||||
private readonly commandPaletteService = inject(CommandPaletteService);
|
||||
private readonly bookDialogHelperService = inject(BookDialogHelperService);
|
||||
private readonly authService = inject(AuthService);
|
||||
private readonly router = inject(Router);
|
||||
readonly layoutService = inject(LayoutService);
|
||||
private readonly userService = inject(UserService);
|
||||
private readonly versionService = inject(VersionService);
|
||||
@@ -128,9 +128,11 @@ export class AppSidebarComponent {
|
||||
private readonly authorService = inject(AuthorService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly renderer = inject(Renderer2);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly metadataProgressService = inject(MetadataProgressService);
|
||||
private readonly bookdropFileService = inject(BookdropFileService);
|
||||
private readonly router = inject(Router);
|
||||
private readonly messageService = inject(MessageService);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly metadataProgressService = inject(MetadataProgressService);
|
||||
private readonly bookdropFileService = inject(BookdropFileService);
|
||||
|
||||
readonly currentUser = this.userService.currentUser;
|
||||
private readonly allAuthors = this.authorService.allAuthors;
|
||||
@@ -199,10 +201,10 @@ export class AppSidebarComponent {
|
||||
if (!user) return [];
|
||||
|
||||
const actions = buildCreateActionNavItems(this.translate, user.permissions, {
|
||||
createLibrary: () => this.dialogLauncherService.openLibraryCreateDialog(),
|
||||
createShelf: () => this.bookDialogHelperService.openShelfCreatorDialog(),
|
||||
createMagicShelf: () => this.dialogLauncherService.openMagicShelfCreateDialog(),
|
||||
uploadBook: () => this.dialogLauncherService.openFileUploadDialog(),
|
||||
createLibrary: () => void this.dialogLauncherService.openLibraryCreateDialog().catch(() => undefined),
|
||||
createShelf: () => void this.bookDialogHelperService.openShelfCreatorDialog().catch(() => undefined),
|
||||
createMagicShelf: () => void this.dialogLauncherService.openMagicShelfCreateDialog().catch(() => undefined),
|
||||
uploadBook: () => void this.dialogLauncherService.openFileUploadDialog().catch(() => undefined),
|
||||
});
|
||||
return this.toMenuEntries(actions);
|
||||
});
|
||||
@@ -274,29 +276,28 @@ export class AppSidebarComponent {
|
||||
}
|
||||
|
||||
protected openAccountSettings(): void {
|
||||
this.dialogLauncherService.openUserProfileDialog();
|
||||
this.closeUserPopover();
|
||||
void this.dialogLauncherService.openUserProfileDialog().catch(() => undefined);
|
||||
this.closeUserPopover();
|
||||
}
|
||||
|
||||
protected openSettings(): void {
|
||||
this.router.navigate(['/settings']);
|
||||
this.closeUserPopover();
|
||||
this.router.navigate(['/settings']);
|
||||
this.closeUserPopover();
|
||||
}
|
||||
|
||||
protected openChangelogDialog(): void {
|
||||
this.dialogLauncherService.openVersionChangelogDialog();
|
||||
this.closeUserPopover();
|
||||
void this.dialogLauncherService.openVersionChangelogDialog().catch(() => undefined);
|
||||
this.closeUserPopover();
|
||||
}
|
||||
|
||||
protected openReadingStats(): void {
|
||||
this.router.navigate(['/reading-stats']);
|
||||
this.closeUserPopover();
|
||||
this.router.navigate(['/reading-stats']);
|
||||
this.closeUserPopover();
|
||||
}
|
||||
|
||||
protected openUploadDialog(): void {
|
||||
this.dialogLauncherService.openFileUploadDialog();
|
||||
void this.dialogLauncherService.openFileUploadDialog().catch(() => undefined);
|
||||
}
|
||||
|
||||
protected logout(): void {
|
||||
this.authService.logout();
|
||||
this.closeUserPopover();
|
||||
@@ -366,24 +367,24 @@ export class AppSidebarComponent {
|
||||
overlay.toggle(event);
|
||||
}
|
||||
|
||||
private subscribeToMetadataProgress(): void {
|
||||
this.metadataProgressService.progressUpdates$
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((progress) => {
|
||||
this.progressHighlight = progress.status === MetadataBatchStatus.IN_PROGRESS;
|
||||
});
|
||||
}
|
||||
private subscribeToMetadataProgress(): void {
|
||||
this.metadataProgressService.progressUpdates$
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((progress) => {
|
||||
this.progressHighlight = progress.status === MetadataBatchStatus.IN_PROGRESS;
|
||||
});
|
||||
}
|
||||
|
||||
private replaceLatestTasks(tasks: Record<string, MetadataBatchProgressNotification>): void {
|
||||
for (const key of Object.keys(this.latestTasks)) {
|
||||
delete this.latestTasks[key];
|
||||
}
|
||||
Object.assign(this.latestTasks, tasks);
|
||||
private replaceLatestTasks(tasks: Record<string, MetadataBatchProgressNotification>): void {
|
||||
for (const key of Object.keys(this.latestTasks)) {
|
||||
delete this.latestTasks[key];
|
||||
}
|
||||
Object.assign(this.latestTasks, tasks);
|
||||
}
|
||||
|
||||
private updateCompletedTaskCount(): void {
|
||||
const metadataTaskCount = Object.keys(this.latestTasks).length;
|
||||
const bookdropFileTaskCount = this.hasPendingBookdropFiles ? 1 : 0;
|
||||
this.completedTaskCount = metadataTaskCount + bookdropFileTaskCount;
|
||||
}
|
||||
private updateCompletedTaskCount(): void {
|
||||
const metadataTaskCount = Object.keys(this.latestTasks).length;
|
||||
const bookdropFileTaskCount = this.hasPendingBookdropFiles ? 1 : 0;
|
||||
this.completedTaskCount = metadataTaskCount + bookdropFileTaskCount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('IconPickerService', () => {
|
||||
});
|
||||
|
||||
it('returns the icon selected by the dialog', async () => {
|
||||
dialogLauncherService.openIconPickerDialog.mockReturnValue({
|
||||
dialogLauncherService.openIconPickerDialog.mockResolvedValue({
|
||||
onClose: of({type: 'PRIME_NG', value: 'pi pi-book'}),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs';
|
||||
import {EMPTY, from, Observable, switchMap} from 'rxjs';
|
||||
import {DialogLauncherService} from '../services/dialog-launcher.service';
|
||||
|
||||
export interface IconSelection {
|
||||
@@ -12,7 +12,13 @@ export class IconPickerService {
|
||||
private dialogLauncherService = inject(DialogLauncherService);
|
||||
|
||||
open(): Observable<IconSelection> {
|
||||
const ref = this.dialogLauncherService.openIconPickerDialog();
|
||||
return ref!.onClose as Observable<IconSelection>;
|
||||
return from(this.dialogLauncherService.openIconPickerDialog()).pipe(
|
||||
switchMap(ref => {
|
||||
if (!ref) {
|
||||
return EMPTY;
|
||||
}
|
||||
return ref.onClose as Observable<IconSelection>;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {beforeEach, describe, expect, it, vi} from 'vitest';
|
||||
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 {LibraryCreatorComponent} from '../../features/library-creator/library-creator.component';
|
||||
@@ -20,17 +22,19 @@ describe('DialogLauncherService', () => {
|
||||
|
||||
TestBed.resetTestingModule();
|
||||
TestBed.configureTestingModule({
|
||||
imports: [getTranslocoModule()],
|
||||
providers: [
|
||||
DialogLauncherService,
|
||||
{provide: DialogService, useValue: dialogService},
|
||||
{provide: MessageService, useValue: {add: vi.fn()}},
|
||||
]
|
||||
});
|
||||
|
||||
service = TestBed.inject(DialogLauncherService);
|
||||
});
|
||||
|
||||
it('merges the default dialog options with caller overrides', () => {
|
||||
service.openDialog(LibraryCreatorComponent, {
|
||||
it('merges the default dialog options with caller overrides', async () => {
|
||||
await service.openDialog(LibraryCreatorComponent, {
|
||||
showHeader: false,
|
||||
data: {mode: 'create'},
|
||||
});
|
||||
@@ -51,8 +55,8 @@ describe('DialogLauncherService', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('opens the dashboard settings dialog with the expected style class', () => {
|
||||
service.openDashboardSettingsDialog();
|
||||
it('opens the dashboard settings dialog with the expected style class', async () => {
|
||||
await service.openDashboardSettingsDialog();
|
||||
|
||||
expect(dialogService.open).toHaveBeenCalledWith(
|
||||
DashboardSettingsComponent,
|
||||
@@ -63,8 +67,8 @@ describe('DialogLauncherService', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('passes the library id into the library edit dialog', () => {
|
||||
service.openLibraryEditDialog(12);
|
||||
it('passes the library id into the library edit dialog', async () => {
|
||||
await service.openLibraryEditDialog(12);
|
||||
|
||||
expect(dialogService.open).toHaveBeenCalledWith(
|
||||
LibraryCreatorComponent,
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
import {inject, Injectable, Type} from '@angular/core';
|
||||
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {LibraryCreatorComponent} from '../../features/library-creator/library-creator.component';
|
||||
import {BookUploaderComponent} from '../components/book-uploader/book-uploader.component';
|
||||
import {UserProfileDialogComponent} from '../../features/settings/user-profile-dialog/user-profile-dialog.component';
|
||||
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 {TranslocoService} from '@jsverse/transloco';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {MetadataRefreshType} from '../../features/metadata/model/request/metadata-refresh-type.enum';
|
||||
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
|
||||
@@ -40,7 +29,9 @@ export const DialogStyle = {
|
||||
})
|
||||
export class DialogLauncherService {
|
||||
|
||||
dialogService = inject(DialogService);
|
||||
private readonly dialogService = inject(DialogService);
|
||||
private readonly messageService = inject(MessageService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
private defaultDialogOptions = {
|
||||
baseZIndex: 10,
|
||||
@@ -60,132 +51,206 @@ export class DialogLauncherService {
|
||||
});
|
||||
}
|
||||
|
||||
openDashboardSettingsDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(DashboardSettingsComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||
launchLazyDialog(dialogFn: () => Promise<DynamicDialogRef | null>): Promise<DynamicDialogRef | null> {
|
||||
return dialogFn().catch(err => {
|
||||
console.error('Failed to load dialog', err);
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: this.t.translate('common.error'),
|
||||
detail: this.t.translate('common.dialogLoadError')
|
||||
});
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
openLibraryCreateDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(LibraryCreatorComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
async openDashboardSettingsDialog(): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {DashboardSettingsComponent} = await import('../../features/dashboard/components/dashboard-settings/dashboard-settings.component');
|
||||
return this.openDialog(DashboardSettingsComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openDirectoryPickerDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(DirectoryPickerComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
async openLibraryCreateDialog(): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {LibraryCreatorComponent} = await import('../../features/library-creator/library-creator.component');
|
||||
return this.openDialog(LibraryCreatorComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openLibraryEditDialog(libraryId: number): DynamicDialogRef | null {
|
||||
return this.openDialog(LibraryCreatorComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
data: {
|
||||
mode: 'edit',
|
||||
libraryId: libraryId
|
||||
}
|
||||
async openDirectoryPickerDialog(): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {DirectoryPickerComponent} = await import('../components/directory-picker/directory-picker.component');
|
||||
return this.openDialog(DirectoryPickerComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openShelfEditDialog(shelfId: number): DynamicDialogRef | null {
|
||||
return this.openDialog(ShelfEditDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
||||
data: {
|
||||
shelfId: shelfId
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
openFileUploadDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(BookUploaderComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
async openLibraryEditDialog(libraryId: number): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {LibraryCreatorComponent} = await import('../../features/library-creator/library-creator.component');
|
||||
return this.openDialog(LibraryCreatorComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
data: {
|
||||
mode: 'edit',
|
||||
libraryId: libraryId
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openCreateUserDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(CreateUserDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||
async openLibraryMetadataFetchDialog(libraryId: number): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {MetadataFetchOptionsComponent} = await import('../../features/metadata/component/metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component');
|
||||
return this.openDialog(MetadataFetchOptionsComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
||||
data: {
|
||||
libraryId: libraryId,
|
||||
metadataRefreshType: MetadataRefreshType.LIBRARY,
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openUserProfileDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(UserProfileDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
||||
async openShelfEditDialog(shelfId: number): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {ShelfEditDialogComponent} = await import('../../features/book/components/shelf-edit-dialog/shelf-edit-dialog.component');
|
||||
return this.openDialog(ShelfEditDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
||||
data: {
|
||||
shelfId: shelfId
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openMagicShelfCreateDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(MagicShelfComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||
async openFileUploadDialog(): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {BookUploaderComponent} = await import('../components/book-uploader/book-uploader.component');
|
||||
return this.openDialog(BookUploaderComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openMagicShelfEditDialog(shelfId: number): DynamicDialogRef | null {
|
||||
return this.openDialog(MagicShelfComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||
data: {
|
||||
id: shelfId,
|
||||
editMode: true,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
openVersionChangelogDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(VersionChangelogDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||
async openCreateUserDialog(): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {CreateUserDialogComponent} = await import('../../features/settings/user-management/create-user-dialog/create-user-dialog.component');
|
||||
return this.openDialog(CreateUserDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openEmailRecipientDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(CreateEmailRecipientDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
async openUserProfileDialog(): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {UserProfileDialogComponent} = await import('../../features/settings/user-profile-dialog/user-profile-dialog.component');
|
||||
return this.openDialog(UserProfileDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openEmailProviderDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(CreateEmailProviderDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
async openMagicShelfCreateDialog(): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {MagicShelfComponent} = await import('../../features/magic-shelf/component/magic-shelf-component');
|
||||
return this.openDialog(MagicShelfComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openBookdropFinalizeResultDialog(result: BookdropFinalizeResult): DynamicDialogRef | null {
|
||||
return this.openDialog(BookdropFinalizeResultDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
|
||||
data: {
|
||||
result: result,
|
||||
},
|
||||
async openMagicShelfEditDialog(shelfId: number): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {MagicShelfComponent} = await import('../../features/magic-shelf/component/magic-shelf-component');
|
||||
return this.openDialog(MagicShelfComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
|
||||
data: {
|
||||
id: shelfId,
|
||||
editMode: true,
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openMetadataReviewDialog(taskId: string): DynamicDialogRef | null {
|
||||
return this.openDialog(MetadataReviewDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
|
||||
data: {
|
||||
taskId,
|
||||
},
|
||||
async openVersionChangelogDialog(): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {VersionChangelogDialogComponent} = await import('../layout/layout-sidebar/version-changelog-dialog/version-changelog-dialog.component');
|
||||
return this.openDialog(VersionChangelogDialogComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
openIconPickerDialog(): DynamicDialogRef | null {
|
||||
return this.openDialog(IconPickerComponent, {
|
||||
showHeader: false,
|
||||
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
|
||||
async openEmailRecipientDialog(): Promise<DynamicDialogRef | null> {
|
||||
return this.launchLazyDialog(async () => {
|
||||
const {CreateEmailRecipientDialogComponent} = await import('../../features/settings/email-v2/create-email-recipient-dialog/create-email-recipient-dialog.component');
|
||||
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}`,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user