Stability (I hope) (#2688)

This commit is contained in:
Joe Milazzo 2024-02-04 10:51:07 -06:00 committed by GitHub
parent 92ad7db918
commit 7e61cca92d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 3336 additions and 177 deletions

View file

@ -460,6 +460,18 @@
<div [ngbNavOutlet]="nav" class="tab-content {{utilityService.getActiveBreakpoint() === Breakpoint.Mobile ? 'mt-3' : 'ms-4 flex-fill'}}"></div>
</div>
<div class="modal-footer">
@if (accountService.hasValidLicense$ | async) {
<button type="button" class="btn btn-light" (click)="forceScan()" position="above"
[ngbTooltip]="t('force-refresh-tooltip')">
@if (forceIsLoading) {
<div class="spinner-border spinner-border-sm text-primary" role="status">
<span class="visually-hidden">loading...</span>
</div>
} @else {
{{t('force-refresh')}}
}
</button>
}
<button type="button" class="btn btn-secondary" (click)="close()">{{t('close')}}</button>
<button type="submit" class="btn btn-primary" [disabled]="!editSeriesForm.valid" (click)="save()">{{t('save')}}</button>
</div>

View file

@ -51,10 +51,13 @@ import {PublicationStatusPipe} from "../../../_pipes/publication-status.pipe";
import {BytesPipe} from "../../../_pipes/bytes.pipe";
import {ImageComponent} from "../../../shared/image/image.component";
import {DefaultValuePipe} from "../../../_pipes/default-value.pipe";
import {TranslocoModule} from "@ngneat/transloco";
import {translate, TranslocoModule} from "@ngneat/transloco";
import {TranslocoDatePipe} from "@ngneat/transloco-locale";
import {UtcToLocalTimePipe} from "../../../_pipes/utc-to-local-time.pipe";
import {EditListComponent} from "../../../shared/edit-list/edit-list.component";
import {AccountService} from "../../../_services/account.service";
import {LibraryType} from "../../../_models/library/library";
import {ToastrService} from "ngx-toastr";
enum TabID {
General = 0,
@ -66,6 +69,13 @@ enum TabID {
Info = 6,
}
export interface EditSeriesModalCloseResult {
success: boolean;
series: Series;
coverImageUpdate: boolean;
updateExternal: boolean
}
@Component({
selector: 'app-edit-series-modal',
standalone: true,
@ -112,6 +122,9 @@ export class EditSeriesModalComponent implements OnInit {
private readonly uploadService = inject(UploadService);
private readonly metadataService = inject(MetadataService);
private readonly cdRef = inject(ChangeDetectorRef);
public readonly accountService = inject(AccountService);
private readonly destroyRef = inject(DestroyRef);
private readonly toastr = inject(ToastrService);
protected readonly TabID = TabID;
protected readonly PersonRole = PersonRole;
@ -133,7 +146,9 @@ export class EditSeriesModalComponent implements OnInit {
editSeriesForm!: FormGroup;
libraryName: string | undefined = undefined;
size: number = 0;
private readonly destroyRef = inject(DestroyRef);
hasForcedKPlus = false;
forceIsLoading = false;
// Typeaheads
tagsSettings: TypeaheadSettings<Tag> = new TypeaheadSettings();
@ -502,7 +517,17 @@ export class EditSeriesModalComponent implements OnInit {
}
close() {
this.modal.close({success: false, series: undefined, coverImageUpdate: this.coverImageReset});
this.modal.close({success: false, series: undefined, coverImageUpdate: this.coverImageReset, updateExternal: this.hasForcedKPlus});
}
forceScan() {
this.forceIsLoading = true;
this.metadataService.forceRefreshFromPlus(this.series.id).subscribe(() => {
this.hasForcedKPlus = true;
this.forceIsLoading = false;
this.toastr.info(translate('toasts.force-kavita+-refresh-success'));
this.cdRef.markForCheck();
});
}
fetchCollectionTags(filter: string = '') {
@ -541,7 +566,7 @@ export class EditSeriesModalComponent implements OnInit {
this.saveNestedComponents.emit();
forkJoin(apis).subscribe(results => {
this.modal.close({success: true, series: model, coverImageUpdate: selectedIndex > 0 || this.coverImageReset});
this.modal.close({success: true, series: model, coverImageUpdate: selectedIndex > 0 || this.coverImageReset, updateExternal: this.hasForcedKPlus});
});
}