Revert "Fix loading indicator"

This reverts commit 014c24b8cf70c2e99d4efd6a619e258629ac90c5.
This commit is contained in:
shamoon 2023-11-30 14:23:42 -08:00
parent 3b1ac7a144
commit 5828d5bcdc
2 changed files with 9 additions and 1 deletions

View File

@ -240,7 +240,7 @@
</div>
<ng-template #previewContent>
<div *ngIf="!metadata" class="w-100 h-100 d-flex align-items-center justify-content-center">
<div *ngIf="previewLoading" class="w-100 h-100 d-flex align-items-center justify-content-center">
<div>
<div class="spinner-border spinner-border-sm me-2" role="status"></div>
<ng-container i18n>Loading...</ng-container>
@ -255,6 +255,7 @@
[showBorders]="false"
[zoom]="previewZoomSetting"
(pagesLoaded)="onPagesLoaded($event)"
(pdfLoadingStarts)="onPdfLoadingStarts()"
(pdfLoadingFailed)="onPdfLoadingFailed($event)"
(beforePrint)="onBeforePrint()"
(afterPrint)="onAfterPrint()"

View File

@ -157,6 +157,7 @@ export class DocumentDetailComponent
previewCurrentPage: number = 1
previewNumPages: number = 1
previewZoomSetting: ZoomSetting = ZoomSetting.Width
previewLoading: boolean = true
printLoadingModal: NgbModalRef
@ -450,6 +451,8 @@ export class DocumentDetailComponent
.subscribe({
next: (result) => {
this.metadata = result
if (this.getContentType() !== 'application/pdf')
this.previewLoading = false
},
error: (error) => {
this.metadata = null
@ -771,6 +774,10 @@ export class DocumentDetailComponent
})
}
onPdfLoadingStarts() {
this.previewLoading = false
}
onPagesLoaded(event: PagesLoadedEvent) {
this.previewNumPages = event.pagesCount
}