Commit 33348125 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #20778 TIME 0:15 don't block document interface when converting

parent a02ef958
......@@ -45,12 +45,19 @@
<ion-label style="font-size: 13px;">{{'lang.substitutionInfo' | translate}}</ion-label>
</ion-toolbar>
<ion-toolbar class="ion-text-center" color="danger" *ngIf="mainDocument.id !== 0 && mainDocument.status === 'CONVERTING'">
<ion-label style="font-size: 13px;">{{'lang.convertingDocument' | translate}}</ion-label>
<div class="loading" style="display:flex;height:100%;">
<ion-label class="loadingMsg">{{'lang.convertingDocument' | translate}}</ion-label>
<ion-spinner name="dots" color="light" style="padding-top: 6.5%;"></ion-spinner>
</div>
</ion-toolbar>
<ion-toolbar class="ion-text-center" color="danger" *ngIf="mainDocument.id !== 0 && mainDocument.status === 'ERROR'">
<ion-label style="font-size: 13px;">{{'lang.errorConvertingDocument' | translate}}</ion-label>
</ion-toolbar>
<ion-content *ngIf="!loadingdocument" #mainContent>
<!-- <div *ngIf="mainDocument.status === 'READY'" class="loading" style="display:flex;height:100%;">
<ion-spinner name="lines" color="primary" style="margin: auto;"></ion-spinner>
<ion-label class="loadingMsg">{{'lang.convertingDocument' | translate}}</ion-label>
</div> -->
<ng-container *ngIf="(mainDocument.notes !== undefined && mainDocument.notes !== null) || hasWorkflowNotes">
<ion-fab-button *ngIf="!expandedNote" ngDraggable [bounds]="myBounds" [inBounds]="true"
(movingOffset)="signaturesService.dragging=true" (endOffset)="signaturesService.dragging=false"
......
......@@ -411,3 +411,22 @@ button.disabled {
::ng-deep.popover-viewport.sc-ion-popover-md {
overflow: auto;
}
.loading {
display: flex;
position: absolute;
justify-content: center;
top: 0;
left: 0px;
width: 100%;
height: 100%;
z-index: 2;
overflow: hidden;
}
.loadingMsg {
padding: 2%;
color: var(--ion-color-light);
font-weight: bold;
margin-right: -5px;
}
\ No newline at end of file
......@@ -398,34 +398,25 @@ export class DocumentComponent implements OnInit, OnDestroy {
this.load.dismiss();
if (this.mainDocument.status === 'CONVERTING') {
// CHECK DOCUMENT STATUS
this.loadingController.create({
message: this.translate.instant('lang.convertingDocument'),
spinner: 'dots'
}).then((loader: HTMLIonLoadingElement) => {
this.load = loader;
this.load.present();
// timer(0, 10000) call the function immediately and every 10 seconds
this.timerSubscription = timer(0, 10000).pipe(
tap(() => {
this.http.get('../rest/documents/' + params['id']).pipe(
tap((res: any) => {
if (res.document.status !== 'CONVERTING') {
this.totalPages = res.document.pages;
this.mainDocument.status = res.document.status;
this.load.dismiss();
this.timerSubscription?.unsubscribe();
}
})
).subscribe();
}),
catchError((err: any) => {
this.load.dismiss();
this.notificationService.handleErrors(err);
return of(false);
})
).subscribe();
});
// timer(0, 10000) call the function immediately and every 10 seconds
this.timerSubscription = timer(0, 10000).pipe(
tap(() => {
this.http.get('../rest/documents/' + params['id']).pipe(
tap((res: any) => {
this.totalPages = res.document.pages;
if (res.document.status !== 'CONVERTING') {
this.mainDocument.status = res.document.status;
this.timerSubscription?.unsubscribe();
}
})
).subscribe();
}),
catchError((err: any) => {
this.load.dismiss();
this.notificationService.handleErrors(err);
return of(false);
})
).subscribe();
}
}),
catchError((err: any) => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment