Revert "Loading indicator"

This reverts commit 825ce7998d33b770a194de6641c63d20e8d84194.
This commit is contained in:
shamoon 2023-11-30 14:23:49 -08:00
parent 042073a061
commit 68b4df4d3d
2 changed files with 48 additions and 62 deletions

View File

@ -240,12 +240,6 @@
</div> </div>
<ng-template #previewContent> <ng-template #previewContent>
<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>
</div>
</div>
<ng-container *ngIf="getContentType() === 'application/pdf'"> <ng-container *ngIf="getContentType() === 'application/pdf'">
<div class="preview-sticky pdf-viewer-container" *ngIf="!useNativePdfViewer ; else nativePdfViewer"> <div class="preview-sticky pdf-viewer-container" *ngIf="!useNativePdfViewer ; else nativePdfViewer">
<ngx-extended-pdf-viewer <ngx-extended-pdf-viewer
@ -254,7 +248,6 @@
[showToolbar]="false" [showToolbar]="false"
[zoom]="previewZoomSetting" [zoom]="previewZoomSetting"
(pagesLoaded)="onPagesLoaded($event)" (pagesLoaded)="onPagesLoaded($event)"
(pdfLoadingStarts)="onPdfLoadingStarts()"
(pdfLoadingFailed)="onPdfLoadingFailed($event)" (pdfLoadingFailed)="onPdfLoadingFailed($event)"
[(page)]="previewCurrentPage"> [(page)]="previewCurrentPage">
</ngx-extended-pdf-viewer> </ngx-extended-pdf-viewer>

View File

@ -154,7 +154,6 @@ export class DocumentDetailComponent
previewCurrentPage: number = 1 previewCurrentPage: number = 1
previewNumPages: number = 1 previewNumPages: number = 1
previewZoomSetting: ZoomSetting = ZoomSetting.Width previewZoomSetting: ZoomSetting = ZoomSetting.Width
previewLoading: boolean = true
store: BehaviorSubject<any> store: BehaviorSubject<any>
isDirty$: Observable<boolean> isDirty$: Observable<boolean>
@ -446,8 +445,6 @@ export class DocumentDetailComponent
.subscribe({ .subscribe({
next: (result) => { next: (result) => {
this.metadata = result this.metadata = result
if (this.getContentType() !== 'application/pdf')
this.previewLoading = false
}, },
error: (error) => { error: (error) => {
this.metadata = null this.metadata = null
@ -769,10 +766,6 @@ export class DocumentDetailComponent
}) })
} }
onPdfLoadingStarts() {
this.previewLoading = false
}
onPagesLoaded(event: PagesLoadedEvent) { onPagesLoaded(event: PagesLoadedEvent) {
this.previewNumPages = event.pagesCount this.previewNumPages = event.pagesCount
} }
@ -791,54 +784,6 @@ export class DocumentDetailComponent
} }
} }
onZoomSelect(event: Event) {
this.previewZoomSetting = (event.target as HTMLSelectElement)
?.value as ZoomSetting
}
get zoomSettings() {
return Object.values(ZoomSetting)
}
getZoomSettingTitle(setting: ZoomSetting = null): string {
switch (setting) {
case ZoomSetting.Auto:
return $localize`Auto`
case ZoomSetting.Actual:
return $localize`Actual Size`
case ZoomSetting.Fit:
return $localize`Page Fit`
case ZoomSetting.Width:
return $localize`Page Width`
default:
return setting
}
}
increaseZoom(): void {
let currentIndex = Object.values(ZoomSetting).indexOf(
this.previewZoomSetting
)
if (currentIndex < 4) currentIndex = 7
this.previewZoomSetting =
Object.values(ZoomSetting)[
Math.min(Object.values(ZoomSetting).length - 1, currentIndex + 1)
]
}
decreaseZoom(): void {
let currentIndex = Object.values(ZoomSetting).indexOf(
this.previewZoomSetting
)
if (currentIndex < 4) currentIndex = 7
this.previewZoomSetting =
Object.values(ZoomSetting)[Math.max(4, currentIndex - 1)]
}
print(): void {
this.printService.print()
}
get showPermissions(): boolean { get showPermissions(): boolean {
return ( return (
this.permissionsService.currentUserCan( this.permissionsService.currentUserCan(
@ -992,4 +937,52 @@ export class DocumentDetailComponent
this.updateFormForCustomFields(true) this.updateFormForCustomFields(true)
this.documentForm.updateValueAndValidity() this.documentForm.updateValueAndValidity()
} }
onZoomSelect(event: Event) {
this.previewZoomSetting = (event.target as HTMLSelectElement)
?.value as ZoomSetting
}
get zoomSettings() {
return Object.values(ZoomSetting)
}
getZoomSettingTitle(setting: ZoomSetting = null): string {
switch (setting) {
case ZoomSetting.Auto:
return $localize`Auto`
case ZoomSetting.Actual:
return $localize`Actual Size`
case ZoomSetting.Fit:
return $localize`Page Fit`
case ZoomSetting.Width:
return $localize`Page Width`
default:
return setting
}
}
increaseZoom(): void {
let currentIndex = Object.values(ZoomSetting).indexOf(
this.previewZoomSetting
)
if (currentIndex < 4) currentIndex = 7
this.previewZoomSetting =
Object.values(ZoomSetting)[
Math.min(Object.values(ZoomSetting).length - 1, currentIndex + 1)
]
}
decreaseZoom(): void {
let currentIndex = Object.values(ZoomSetting).indexOf(
this.previewZoomSetting
)
if (currentIndex < 4) currentIndex = 7
this.previewZoomSetting =
Object.values(ZoomSetting)[Math.max(4, currentIndex - 1)]
}
print(): void {
this.printService.print()
}
} }