Refactored naming convention to match rest of the project.
This commit is contained in:
parent
b372efaada
commit
d417a0a610
7 changed files with 33 additions and 21 deletions
|
|
@ -31,7 +31,9 @@ import {ChapterService} from "./chapter.service";
|
||||||
import {VolumeService} from "./volume.service";
|
import {VolumeService} from "./volume.service";
|
||||||
import {DefaultModalOptions} from "../_models/default-modal-options";
|
import {DefaultModalOptions} from "../_models/default-modal-options";
|
||||||
import {MatchSeriesModalComponent} from "../_single-module/match-series-modal/match-series-modal.component";
|
import {MatchSeriesModalComponent} from "../_single-module/match-series-modal/match-series-modal.component";
|
||||||
import {BulkSetReadingProfileComponent} from "../cards/_modals/bulk-set-reading-profile/bulk-set-reading-profile.component";
|
import {
|
||||||
|
BulkSetReadingProfileModalComponent
|
||||||
|
} from "../cards/_modals/bulk-set-reading-profile-modal/bulk-set-reading-profile-modal.component";
|
||||||
|
|
||||||
|
|
||||||
export type LibraryActionCallback = (library: Partial<Library>) => void;
|
export type LibraryActionCallback = (library: Partial<Library>) => void;
|
||||||
|
|
@ -822,7 +824,7 @@ export class ActionService {
|
||||||
setReadingProfileForMultiple(series: Array<Series>, callback?: BooleanActionCallback) {
|
setReadingProfileForMultiple(series: Array<Series>, callback?: BooleanActionCallback) {
|
||||||
if (this.readingListModalRef != null) { return; }
|
if (this.readingListModalRef != null) { return; }
|
||||||
|
|
||||||
this.readingListModalRef = this.modalService.open(BulkSetReadingProfileComponent, { scrollable: true, size: 'md', fullscreen: 'md' });
|
this.readingListModalRef = this.modalService.open(BulkSetReadingProfileModalComponent, { scrollable: true, size: 'md', fullscreen: 'md' });
|
||||||
this.readingListModalRef.componentInstance.seriesIds = series.map(s => s.id)
|
this.readingListModalRef.componentInstance.seriesIds = series.map(s => s.id)
|
||||||
this.readingListModalRef.componentInstance.title = ""
|
this.readingListModalRef.componentInstance.title = ""
|
||||||
|
|
||||||
|
|
@ -848,7 +850,7 @@ export class ActionService {
|
||||||
setReadingProfileForLibrary(library: Library, callback?: BooleanActionCallback) {
|
setReadingProfileForLibrary(library: Library, callback?: BooleanActionCallback) {
|
||||||
if (this.readingListModalRef != null) { return; }
|
if (this.readingListModalRef != null) { return; }
|
||||||
|
|
||||||
this.readingListModalRef = this.modalService.open(BulkSetReadingProfileComponent, { scrollable: true, size: 'md', fullscreen: 'md' });
|
this.readingListModalRef = this.modalService.open(BulkSetReadingProfileModalComponent, { scrollable: true, size: 'md', fullscreen: 'md' });
|
||||||
this.readingListModalRef.componentInstance.libraryId = library.id;
|
this.readingListModalRef.componentInstance.libraryId = library.id;
|
||||||
this.readingListModalRef.componentInstance.title = ""
|
this.readingListModalRef.componentInstance.title = ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export class ReadingProfileService {
|
||||||
return this.httpClient.post<ReadingProfile>(this.baseUrl + "reading-profile/series?seriesId="+seriesId, profile);
|
return this.httpClient.post<ReadingProfile>(this.baseUrl + "reading-profile/series?seriesId="+seriesId, profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
all() {
|
getAllProfiles() {
|
||||||
return this.httpClient.get<ReadingProfile[]>(this.baseUrl + 'reading-profile/all');
|
return this.httpClient.get<ReadingProfile[]>(this.baseUrl + 'reading-profile/all');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
<ng-container *transloco="let t; prefix: 'bulk-set-reading-profile'">
|
<ng-container *transloco="let t; prefix: 'bulk-set-reading-profile-modal'">
|
||||||
|
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="modal-basic-title">{{t('title')}}</h4>
|
<h4 class="modal-title" id="modal-basic-title">{{t('title')}}</h4>
|
||||||
<button type="button" class="btn-close" [attr.aria-label]="t('close')" (click)="close()"></button>
|
<button type="button" class="btn-close" [attr.aria-label]="t('close')" (click)="close()"></button>
|
||||||
</div>
|
</div>
|
||||||
<form style="width: 100%" [formGroup]="profileForm">
|
<form [formGroup]="profileForm">
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
@if (profiles.length >= MaxItems) {
|
@if (profiles.length >= MaxItems) {
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
|
@ -18,16 +18,16 @@
|
||||||
|
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
@for(profile of profiles | filter: filterList; let i = $index; track profile.name) {
|
@for(profile of profiles | filter: filterList; let i = $index; track profile.name) {
|
||||||
<li class="list-group-item clickable" tabindex="0" role="option" (click)="addToProfile(profile)">
|
<li class="list-group-item clickable" tabindex="0" role="option" (click)="addToProfile(profile)">
|
||||||
{{profile.name}}
|
{{profile.name}}
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (profiles.length === 0 && !loading) {
|
@if (profiles.length === 0 && !isLoading) {
|
||||||
<li class="list-group-item">{{t('no-data')}}</li>
|
<li class="list-group-item">{{t('no-data')}}</li>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (loading) {
|
@if (isLoading) {
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<div class="spinner-border text-primary" role="status">
|
<div class="spinner-border text-primary" role="status">
|
||||||
<span class="visually-hidden">{{t('loading')}}</span>
|
<span class="visually-hidden">{{t('loading')}}</span>
|
||||||
|
|
@ -36,8 +36,14 @@
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" (click)="close()">{{t('close')}}</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
@ -8,22 +8,25 @@ import {ReadingProfile} from "../../../_models/preferences/reading-profiles";
|
||||||
import {FilterPipe} from "../../../_pipes/filter.pipe";
|
import {FilterPipe} from "../../../_pipes/filter.pipe";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-bulk-set-reading-profile',
|
selector: 'app-bulk-set-reading-profile-modal',
|
||||||
imports: [
|
imports: [
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
FilterPipe,
|
FilterPipe,
|
||||||
TranslocoDirective
|
TranslocoDirective
|
||||||
],
|
],
|
||||||
templateUrl: './bulk-set-reading-profile.component.html',
|
templateUrl: './bulk-set-reading-profile-modal.component.html',
|
||||||
styleUrl: './bulk-set-reading-profile.component.scss'
|
styleUrl: './bulk-set-reading-profile-modal.component.scss'
|
||||||
})
|
})
|
||||||
export class BulkSetReadingProfileComponent implements OnInit, AfterViewInit {
|
export class BulkSetReadingProfileModalComponent implements OnInit, AfterViewInit {
|
||||||
private readonly modal = inject(NgbActiveModal);
|
private readonly modal = inject(NgbActiveModal);
|
||||||
private readonly readingProfileService = inject(ReadingProfileService);
|
private readonly readingProfileService = inject(ReadingProfileService);
|
||||||
private readonly toastr = inject(ToastrService);
|
private readonly toastr = inject(ToastrService);
|
||||||
private readonly cdRef = inject(ChangeDetectorRef);
|
private readonly cdRef = inject(ChangeDetectorRef);
|
||||||
protected readonly MaxItems = 8;
|
protected readonly MaxItems = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modal Header - since this code is used for multiple flows
|
||||||
|
*/
|
||||||
@Input({required: true}) title!: string;
|
@Input({required: true}) title!: string;
|
||||||
/**
|
/**
|
||||||
* Series Ids to add to Reading Profile
|
* Series Ids to add to Reading Profile
|
||||||
|
|
@ -33,19 +36,20 @@ export class BulkSetReadingProfileComponent implements OnInit, AfterViewInit {
|
||||||
@ViewChild('title') inputElem!: ElementRef<HTMLInputElement>;
|
@ViewChild('title') inputElem!: ElementRef<HTMLInputElement>;
|
||||||
|
|
||||||
profiles: Array<ReadingProfile> = [];
|
profiles: Array<ReadingProfile> = [];
|
||||||
loading: boolean = false;
|
isLoading: boolean = false;
|
||||||
profileForm: FormGroup = new FormGroup({});
|
profileForm: FormGroup = new FormGroup({
|
||||||
|
filterQuery: new FormControl('', []), // Used for inline filtering when too many RPs
|
||||||
|
});
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
this.profileForm.addControl('title', new FormControl(this.title, []));
|
this.profileForm.addControl('title', new FormControl(this.title, []));
|
||||||
this.profileForm.addControl('filterQuery', new FormControl('', []));
|
|
||||||
|
|
||||||
this.loading = true;
|
this.isLoading = true;
|
||||||
this.cdRef.markForCheck();
|
this.cdRef.markForCheck();
|
||||||
this.readingProfileService.all().subscribe(profiles => {
|
this.readingProfileService.getAllProfiles().subscribe(profiles => {
|
||||||
this.profiles = profiles;
|
this.profiles = profiles;
|
||||||
this.loading = false;
|
this.isLoading = false;
|
||||||
this.cdRef.markForCheck();
|
this.cdRef.markForCheck();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -129,7 +129,7 @@ export class ManageReadingProfilesComponent implements OnInit {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.readingProfileService.all().subscribe(profiles => {
|
this.readingProfileService.getAllProfiles().subscribe(profiles => {
|
||||||
this.readingProfiles = profiles;
|
this.readingProfiles = profiles;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.setupForm();
|
this.setupForm();
|
||||||
|
|
|
||||||
|
|
@ -1276,7 +1276,7 @@
|
||||||
"create": "{{common.create}}"
|
"create": "{{common.create}}"
|
||||||
},
|
},
|
||||||
|
|
||||||
"bulk-set-reading-profile": {
|
"bulk-set-reading-profile-modal": {
|
||||||
"title": "Set Reading profile",
|
"title": "Set Reading profile",
|
||||||
"close": "{{common.close}}",
|
"close": "{{common.close}}",
|
||||||
"filter-label": "{{common.filter}}",
|
"filter-label": "{{common.filter}}",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue