Misc bunch of changes (#2815)

This commit is contained in:
Joe Milazzo 2024-03-23 16:20:16 -05:00 committed by GitHub
parent 18792b7b56
commit 63c9bff32e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
81 changed files with 4567 additions and 339 deletions

View file

@ -7,6 +7,7 @@
<h6 subtitle class="subtitle-with-actionables" *ngIf="active.fragment === ''">{{t('common.series-count', {num: pagination.totalItems | number})}} </h6>
</app-side-nav-companion-bar>
<app-bulk-operations [actionCallback]="bulkActionCallback"></app-bulk-operations>
<app-loading [absolute]="true" [loading]="bulkLoader"></app-loading>
<app-card-detail-layout *ngIf="filter"
[isLoading]="loadingSeries"
[items]="series"

View file

@ -44,6 +44,7 @@ import {MetadataService} from "../_services/metadata.service";
import {FilterComparison} from "../_models/metadata/v2/filter-comparison";
import {FilterField} from "../_models/metadata/v2/filter-field";
import {CardActionablesComponent} from "../_single-module/card-actionables/card-actionables.component";
import {LoadingComponent} from "../shared/loading/loading.component";
@Component({
selector: 'app-library-detail',
@ -52,10 +53,14 @@ import {CardActionablesComponent} from "../_single-module/card-actionables/card-
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [SideNavCompanionBarComponent, CardActionablesComponent, NgbNav, NgFor, NgbNavItem, NgbNavItemRole, NgbNavLink, NgbNavContent, NgIf
, CardDetailLayoutComponent, SeriesCardComponent, BulkOperationsComponent, NgbNavOutlet, DecimalPipe, SentenceCasePipe, TranslocoDirective]
, CardDetailLayoutComponent, SeriesCardComponent, BulkOperationsComponent, NgbNavOutlet, DecimalPipe, SentenceCasePipe, TranslocoDirective, LoadingComponent]
})
export class LibraryDetailComponent implements OnInit {
private readonly destroyRef = inject(DestroyRef);
private readonly metadataService = inject(MetadataService);
private readonly cdRef = inject(ChangeDetectorRef);
libraryId!: number;
libraryName = '';
series: Series[] = [];
@ -69,18 +74,16 @@ export class LibraryDetailComponent implements OnInit {
filterActiveCheck!: SeriesFilterV2;
refresh: EventEmitter<void> = new EventEmitter();
jumpKeys: Array<JumpKey> = [];
bulkLoader: boolean = false;
tabs: Array<{title: string, fragment: string, icon: string}> = [
{title: 'library-tab', fragment: '', icon: 'fa-landmark'},
{title: 'recommended-tab', fragment: 'recommended', icon: 'fa-award'},
];
active = this.tabs[0];
private readonly destroyRef = inject(DestroyRef);
private readonly metadataService = inject(MetadataService);
private readonly cdRef = inject(ChangeDetectorRef);
bulkActionCallback = (action: ActionItem<any>, data: any) => {
bulkActionCallback = async (action: ActionItem<any>, data: any) => {
const selectedSeriesIndices = this.bulkSelectionService.getSelectedCardsForSource('series');
const selectedSeries = this.series.filter((series, index: number) => selectedSeriesIndices.includes(index + ''));
@ -123,7 +126,14 @@ export class LibraryDetailComponent implements OnInit {
});
break;
case Action.Delete:
this.actionService.deleteMultipleSeries(selectedSeries, (successful) => {
if (selectedSeries.length > 25) {
this.bulkLoader = true;
this.cdRef.markForCheck();
}
await this.actionService.deleteMultipleSeries(selectedSeries, (successful) => {
this.bulkLoader = false;
this.cdRef.markForCheck();
if (!successful) return;
this.bulkSelectionService.deselectAll();
this.loadPage();