Support Editing Metadata for Multiple Books at Once via Bulk Edit Interface
This commit is contained in:
committed by
Aditya Chandel
parent
2d041f79f3
commit
82c843bbe5
@@ -4,6 +4,7 @@ import {ShelfAssignerComponent} from '../shelf-assigner/shelf-assigner.component
|
||||
import {LockUnlockMetadataDialogComponent} from './lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component';
|
||||
import {MetadataFetchOptionsComponent} from '../../metadata/metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component';
|
||||
import {MetadataRefreshType} from '../../metadata/model/request/metadata-refresh-type.enum';
|
||||
import {BulkMetadataUpdateComponent} from '../../metadata/bulk-metadata-update-component/bulk-metadata-update-component';
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class BookDialogHelperService {
|
||||
@@ -51,4 +52,20 @@ export class BookDialogHelperService {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
openBulkMetadataEditDialog(bookIds: Set<number>): DynamicDialogRef {
|
||||
return this.dialogService.open(BulkMetadataUpdateComponent, {
|
||||
header: 'Bulk Edit Metadata',
|
||||
modal: true,
|
||||
closable: true,
|
||||
style: {
|
||||
width: '90vw',
|
||||
maxWidth: '1200px',
|
||||
position: 'absolute'
|
||||
},
|
||||
data: {
|
||||
bookIds: Array.from(bookIds)
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,40 +215,40 @@
|
||||
<div class="book-browser-footer bg-[var(--card-background)] bg-opacity-10" [@slideInOut]>
|
||||
<div class="flex justify-between gap-8">
|
||||
@if (entityType$ | async; as entityType) {
|
||||
@if (entityType === EntityType.LIBRARY || entityType === EntityType.ALL_BOOKS || entityType === EntityType.UNSHELVED) {
|
||||
<p-button
|
||||
icon="pi pi-bookmark-fill"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(onClick)="openShelfAssigner()"
|
||||
pTooltip="Assign to shelf"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
@if (entityType === EntityType.SHELF) {
|
||||
<p-button
|
||||
icon="pi pi-bookmark"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(click)="unshelfBooks()"
|
||||
pTooltip="Remove from shelf"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
@if (userService.userState$ | async; as userData) {
|
||||
<div>
|
||||
@if (userData.permissions.canEditMetadata) {
|
||||
<p-button
|
||||
icon="pi pi-database"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(click)="updateMetadata()"
|
||||
pTooltip="Update metadata"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
</div>
|
||||
@if (userData.permissions.canEditMetadata) {
|
||||
<p-tieredmenu #menu [model]="metadataMenuItems" [popup]="true" appendTo="body"/>
|
||||
<p-button
|
||||
(click)="menu.toggle($event)"
|
||||
tooltip="Metadata actions"
|
||||
tooltipPosition="top"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
icon="pi pi-database">
|
||||
</p-button>
|
||||
}
|
||||
@if (entityType === EntityType.LIBRARY || entityType === EntityType.ALL_BOOKS || entityType === EntityType.UNSHELVED) {
|
||||
<p-button
|
||||
icon="pi pi-bookmark-fill"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(onClick)="openShelfAssigner()"
|
||||
pTooltip="Assign to shelf"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
@if (entityType === EntityType.SHELF) {
|
||||
<p-button
|
||||
icon="pi pi-bookmark"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(click)="unshelfBooks()"
|
||||
pTooltip="Remove from shelf"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
}
|
||||
|
||||
<p-button
|
||||
outlined="true"
|
||||
icon="pi pi-lock"
|
||||
|
||||
@@ -41,6 +41,7 @@ import {Popover} from 'primeng/popover';
|
||||
import {Slider} from 'primeng/slider';
|
||||
import {Select} from 'primeng/select';
|
||||
import {FilterSortPreferenceService} from './filters/filter-sorting-preferences.service';
|
||||
import {TieredMenu} from 'primeng/tieredmenu';
|
||||
|
||||
export enum EntityType {
|
||||
LIBRARY = 'Library',
|
||||
@@ -73,7 +74,7 @@ const SORT_DIRECTION = {
|
||||
standalone: true,
|
||||
templateUrl: './book-browser.component.html',
|
||||
styleUrls: ['./book-browser.component.scss'],
|
||||
imports: [Button, VirtualScrollerModule, BookCardComponent, AsyncPipe, ProgressSpinner, Menu, InputText, FormsModule, BookTableComponent, BookFilterComponent, Tooltip, NgClass, Fluid, PrimeTemplate, NgStyle, OverlayPanelModule, DropdownModule, Checkbox, Popover, Slider, Select],
|
||||
imports: [Button, VirtualScrollerModule, BookCardComponent, AsyncPipe, ProgressSpinner, Menu, InputText, FormsModule, BookTableComponent, BookFilterComponent, Tooltip, NgClass, Fluid, PrimeTemplate, NgStyle, OverlayPanelModule, DropdownModule, Checkbox, Popover, Slider, Select, TieredMenu],
|
||||
providers: [SeriesCollapseFilter],
|
||||
animations: [
|
||||
trigger('slideInOut', [
|
||||
@@ -143,6 +144,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
lastAppliedSort: SortOption | null = null;
|
||||
filterVisibility = true;
|
||||
private settingFiltersFromUrl = false;
|
||||
protected metadataMenuItems: MenuItem[] | undefined;
|
||||
|
||||
get currentCardSize() {
|
||||
return this.coverScalePreferenceService.currentCardSize;
|
||||
@@ -192,6 +194,19 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
this.deselectAllBooks();
|
||||
this.clearFilter();
|
||||
});
|
||||
|
||||
this.metadataMenuItems = [
|
||||
{
|
||||
label: 'Refresh Metadata',
|
||||
icon: 'pi pi-refresh',
|
||||
command: () => this.updateMetadata()
|
||||
},
|
||||
{
|
||||
label: 'Bulk Edit Metadata',
|
||||
icon: 'pi pi-pencil',
|
||||
command: () => this.bulkEditMetadata()
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
@@ -577,4 +592,8 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
updateMetadata(): void {
|
||||
this.dialogHelperService.openMetadataRefreshDialog(this.selectedBooks);
|
||||
}
|
||||
|
||||
bulkEditMetadata(): void {
|
||||
this.dialogHelperService.openBulkMetadataEditDialog(this.selectedBooks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
}
|
||||
|
||||
.cover-container.shimmer {
|
||||
background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
|
||||
/*background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
|
||||
background-size: 200% 100%;
|
||||
animation: shimmer 2.5s infinite linear;
|
||||
animation: shimmer 2.5s infinite linear;*/
|
||||
}
|
||||
|
||||
@keyframes shimmer {
|
||||
|
||||
Reference in New Issue
Block a user