Fix
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div class="library-header-dial">
|
||||
<h3 class="library-name">{{ (entityType$ | async) }}: {{ (entity$ | async)?.name }}</h3>
|
||||
<p-speedDial
|
||||
[model]="items!"
|
||||
[model]="speedDialItems!"
|
||||
direction="right"
|
||||
transitionDelay="80"
|
||||
showIcon="pi pi-ellipsis-v"
|
||||
@@ -17,7 +17,7 @@
|
||||
<p-button *ngIf="(entityType$ | async) === 'Shelf'" icon="pi pi-minus-circle" label="Unshelf" severity="primary" [rounded]="true" [outlined]="true" (click)="unshelfBooks()"></p-button>
|
||||
<p-button icon="pi pi-times" label="Deselect" severity="warning" [rounded]="true" [outlined]="true" (click)="deselectAllBooks()"></p-button>
|
||||
</div>
|
||||
<p-menu #menu [model]="items" [popup]="true" appendTo="body"></p-menu>
|
||||
<p-menu #menu [model]="multiSelectItems" [popup]="true" appendTo="body"></p-menu>
|
||||
</div>
|
||||
|
||||
<div class="library-header-right">
|
||||
|
||||
@@ -28,7 +28,8 @@ export class BooksBrowserComponent implements OnInit {
|
||||
|
||||
entity: Library | Shelf | null = null;
|
||||
entityType: string = '';
|
||||
items: MenuItem[] | undefined;
|
||||
speedDialItems: MenuItem[] | undefined;
|
||||
multiSelectItems: MenuItem[] | undefined;
|
||||
selectedBooks: Set<number> = new Set();
|
||||
selectedSort: SortOption | null = null;
|
||||
sortOptions: SortOption[] = [];
|
||||
@@ -182,7 +183,7 @@ export class BooksBrowserComponent implements OnInit {
|
||||
}
|
||||
|
||||
setupMenu(): void {
|
||||
this.items = [
|
||||
this.multiSelectItems = [
|
||||
{
|
||||
label: 'Options',
|
||||
items: [
|
||||
@@ -210,7 +211,7 @@ export class BooksBrowserComponent implements OnInit {
|
||||
}
|
||||
|
||||
private initializeLibraryMenuItems(): void {
|
||||
this.items = [
|
||||
this.speedDialItems = [
|
||||
{
|
||||
icon: 'pi pi-trash',
|
||||
tooltipOptions: {
|
||||
@@ -229,19 +230,10 @@ export class BooksBrowserComponent implements OnInit {
|
||||
this.libraryService.deleteLibrary(this.entity?.id!).subscribe({
|
||||
complete: () => {
|
||||
this.router.navigate(['/']);
|
||||
this.messageService.add({
|
||||
severity: 'info',
|
||||
summary: 'Success',
|
||||
detail: 'Library was deleted'
|
||||
});
|
||||
this.messageService.add({severity: 'info', summary: 'Success', detail: 'Library was deleted'});
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Failed',
|
||||
detail: 'Failed to delete library',
|
||||
life: 3000
|
||||
});
|
||||
this.messageService.add({severity: 'error', summary: 'Failed', detail: 'Failed to delete library', life: 3000});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -252,7 +244,7 @@ export class BooksBrowserComponent implements OnInit {
|
||||
}
|
||||
|
||||
private initializeShelfMenuItems(): void {
|
||||
this.items = [
|
||||
this.speedDialItems = [
|
||||
{
|
||||
icon: 'pi pi-trash',
|
||||
tooltipOptions: {
|
||||
@@ -271,19 +263,10 @@ export class BooksBrowserComponent implements OnInit {
|
||||
this.shelfService.deleteShelf(this.entity?.id!).subscribe({
|
||||
complete: () => {
|
||||
this.router.navigate(['/']);
|
||||
this.messageService.add({
|
||||
severity: 'info',
|
||||
summary: 'Success',
|
||||
detail: 'Shelf was deleted'
|
||||
});
|
||||
this.messageService.add({severity: 'info', summary: 'Success', detail: 'Shelf was deleted'});
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Failed',
|
||||
detail: 'Failed to delete shelf',
|
||||
life: 3000
|
||||
});
|
||||
this.messageService.add({severity: 'error', summary: 'Failed', detail: 'Failed to delete shelf', life: 3000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user