Pull request #246: removed loading indicator

Merge in RED/ui from RED-1853 to master

* commit 'aaa9c51bbc41fd5ba2a06239e5c553f06efed555':
  removed loading indicator
This commit is contained in:
Timo Bejan 2021-07-20 11:37:19 +02:00
commit a6fff5ad6a
12 changed files with 62 additions and 103 deletions

View File

@ -23,15 +23,10 @@
<input formControlName="lastName" name="lastName" type="text" /> <input formControlName="lastName" name="lastName" type="text" />
</div> </div>
<div class="red-input-group"> <div class="red-input-group">
<label <label translate="top-bar.navigation-items.my-account.children.language.label"></label>
translate="top-bar.navigation-items.my-account.children.language.label"
></label>
<mat-select formControlName="language"> <mat-select formControlName="language">
<mat-option *ngFor="let language of languages" [value]="language"> <mat-option *ngFor="let language of languages" [value]="language">
{{ {{ 'top-bar.navigation-items.my-account.children.language.' + language | translate }}
'top-bar.navigation-items.my-account.children.language.' +
language | translate
}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</div> </div>
@ -47,15 +42,9 @@
> >
{{ 'user-profile.actions.save' | translate }} {{ 'user-profile.actions.save' | translate }}
</button> </button>
<a [href]="changePasswordUrl" target="_blank"> <a [href]="changePasswordUrl" target="_blank"> {{ 'user-profile.actions.change-password' | translate }}</a>
{{ 'user-profile.actions.change-password' | translate }}</a
>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</section> </section>
<redaction-full-page-loading-indicator
[displayed]="!viewReady"
></redaction-full-page-loading-indicator>

View File

@ -7,6 +7,7 @@ import { TranslateService } from '@ngx-translate/core';
import { UserControllerService } from '@redaction/red-ui-http'; import { UserControllerService } from '@redaction/red-ui-http';
import { AppConfigKey, AppConfigService } from '@app-config/app-config.service'; import { AppConfigKey, AppConfigService } from '@app-config/app-config.service';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { LoadingService } from '@services/loading.service';
@Component({ @Component({
selector: 'redaction-user-profile-screen', selector: 'redaction-user-profile-screen',
@ -14,7 +15,6 @@ import { DomSanitizer } from '@angular/platform-browser';
styleUrls: ['./user-profile-screen.component.scss'] styleUrls: ['./user-profile-screen.component.scss']
}) })
export class UserProfileScreenComponent implements OnInit { export class UserProfileScreenComponent implements OnInit {
viewReady = false;
formGroup: FormGroup; formGroup: FormGroup;
changePasswordUrl: any; changePasswordUrl: any;
@ -28,8 +28,10 @@ export class UserProfileScreenComponent implements OnInit {
private readonly _userControllerService: UserControllerService, private readonly _userControllerService: UserControllerService,
private readonly _languageService: LanguageService, private readonly _languageService: LanguageService,
private readonly _domSanitizer: DomSanitizer, private readonly _domSanitizer: DomSanitizer,
private readonly _translateService: TranslateService private readonly _translateService: TranslateService,
private readonly _loadingService: LoadingService
) { ) {
this._loadingService.start();
this.formGroup = this._formBuilder.group({ this.formGroup = this._formBuilder.group({
email: [undefined, [Validators.required, Validators.email]], email: [undefined, [Validators.required, Validators.email]],
firstName: [undefined], firstName: [undefined],
@ -68,7 +70,7 @@ export class UserProfileScreenComponent implements OnInit {
} }
async save(): Promise<void> { async save(): Promise<void> {
this.viewReady = false; this._loadingService.start();
if (this.languageChanged) { if (this.languageChanged) {
await this._languageService.changeLanguage(this.formGroup.get('language').value); await this._languageService.changeLanguage(this.formGroup.get('language').value);
@ -106,7 +108,7 @@ export class UserProfileScreenComponent implements OnInit {
this.formGroup.patchValue(this._profileModel, { emitEvent: false }); this.formGroup.patchValue(this._profileModel, { emitEvent: false });
} catch (e) { } catch (e) {
} finally { } finally {
this.viewReady = true; this._loadingService.stop();
} }
} }
} }

View File

@ -36,14 +36,7 @@
tooltipPosition="below" tooltipPosition="below"
></redaction-circle-button> ></redaction-circle-button>
<input <input #fileInput (change)="upload($event)" accept="text/plain" class="file-upload-input" hidden type="file" />
#fileInput
(change)="upload($event)"
accept="text/plain"
class="file-upload-input"
hidden
type="file"
/>
<redaction-circle-button <redaction-circle-button
[routerLink]="['..']" [routerLink]="['..']"
@ -98,16 +91,9 @@
</div> </div>
<div *ngIf="!!dictionary.description" class="pb-32 mt-20"> <div *ngIf="!!dictionary.description" class="pb-32 mt-20">
<div <div class="heading" translate="dictionary-overview.dictionary-details.description"></div>
class="heading"
translate="dictionary-overview.dictionary-details.description"
></div>
<div class="mt-8">{{ dictionary.description }}</div> <div class="mt-8">{{ dictionary.description }}</div>
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<redaction-full-page-loading-indicator
[displayed]="processing"
></redaction-full-page-loading-indicator>

View File

@ -18,7 +18,6 @@ import { LoadingService } from '@services/loading.service';
styleUrls: ['./dictionary-overview-screen.component.scss'] styleUrls: ['./dictionary-overview-screen.component.scss']
}) })
export class DictionaryOverviewScreenComponent extends ComponentHasChanges implements OnInit { export class DictionaryOverviewScreenComponent extends ComponentHasChanges implements OnInit {
processing = false;
entries: string[] = []; entries: string[] = [];
@ViewChild('dictionaryManager', { static: false }) @ViewChild('dictionaryManager', { static: false })
@ -109,29 +108,29 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
} }
saveEntries(entries: string[]) { saveEntries(entries: string[]) {
this.processing = true; this._loadingService.start();
this._dictionarySaveService this._dictionarySaveService
.saveEntries(entries, this.entries, this.dictionary.dossierTemplateId, this.dictionary.type, null) .saveEntries(entries, this.entries, this.dictionary.dossierTemplateId, this.dictionary.type, null)
.subscribe( .subscribe(
() => { () => {
this.processing = false; this._loadingService.stop();
this._loadEntries(); this._loadEntries();
}, },
() => { () => {
this.processing = false; this._loadingService.stop();
} }
); );
} }
private _loadEntries() { private _loadEntries() {
this.processing = true; this._loadingService.start();
this._dictionaryControllerService.getDictionaryForType(this.dictionary.dossierTemplateId, this.dictionary.type).subscribe( this._dictionaryControllerService.getDictionaryForType(this.dictionary.dossierTemplateId, this.dictionary.type).subscribe(
data => { data => {
this.processing = false; this._loadingService.stop();
this.entries = data.entries.sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' })); this.entries = data.entries.sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' }));
}, },
() => { () => {
this.processing = false; this._loadingService.stop();
this.entries = []; this.entries = [];
} }
); );

View File

@ -177,5 +177,3 @@
</div> </div>
</div> </div>
</section> </section>
<redaction-full-page-loading-indicator [displayed]="!viewReady"></redaction-full-page-loading-indicator>

View File

@ -1,16 +1,17 @@
import {Component, OnInit} from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {PermissionsService} from '@services/permissions.service'; import { PermissionsService } from '@services/permissions.service';
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import {AdminDialogService} from '../../services/admin-dialog.service'; import { AdminDialogService } from '../../services/admin-dialog.service';
import { import {
GeneralConfigurationModel, GeneralConfigurationModel,
GeneralSettingsControllerService, GeneralSettingsControllerService,
SmtpConfigurationControllerService, SmtpConfigurationControllerService,
SMTPConfigurationModel SMTPConfigurationModel
} from '@redaction/red-ui-http'; } from '@redaction/red-ui-http';
import {AppConfigService} from '../../../app-config/app-config.service'; import { AppConfigService } from '../../../app-config/app-config.service';
import {AutoUnsubscribeComponent} from "../../../shared/base/auto-unsubscribe.component"; import { AutoUnsubscribeComponent } from '../../../shared/base/auto-unsubscribe.component';
import {Toaster} from "../../../../services/toaster.service"; import { Toaster } from '../../../../services/toaster.service';
import { LoadingService } from '../../../../services/loading.service';
@Component({ @Component({
selector: 'redaction-general-config-screen', selector: 'redaction-general-config-screen',
@ -18,7 +19,6 @@ import {Toaster} from "../../../../services/toaster.service";
styleUrls: ['./general-config-screen.component.scss'] styleUrls: ['./general-config-screen.component.scss']
}) })
export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent implements OnInit { export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent implements OnInit {
viewReady = false;
configForm: FormGroup; configForm: FormGroup;
smtpForm: FormGroup; smtpForm: FormGroup;
@ -32,7 +32,8 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent imple
private readonly _formBuilder: FormBuilder, private readonly _formBuilder: FormBuilder,
private readonly _toaster: Toaster, private readonly _toaster: Toaster,
private readonly _dialogService: AdminDialogService, private readonly _dialogService: AdminDialogService,
private readonly _generalSettingsControllerService: GeneralSettingsControllerService private readonly _generalSettingsControllerService: GeneralSettingsControllerService,
private readonly _loadingService: LoadingService
) { ) {
super(); super();
@ -56,7 +57,6 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent imple
password: [undefined] password: [undefined]
}); });
this.addSubscription = this.configForm.controls.auth.valueChanges.subscribe(auth => { this.addSubscription = this.configForm.controls.auth.valueChanges.subscribe(auth => {
if (auth) { if (auth) {
this.openAuthConfigDialog(); this.openAuthConfigDialog();
@ -93,21 +93,21 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent imple
} }
async save() { async save() {
this.viewReady = false; this._loadingService.start();
await this._smtpConfigService.updateSMTPConfiguration(this.smtpForm.getRawValue()).toPromise(); await this._smtpConfigService.updateSMTPConfiguration(this.smtpForm.getRawValue()).toPromise();
this._initialSMTPConfiguration = this.smtpForm.getRawValue(); this._initialSMTPConfiguration = this.smtpForm.getRawValue();
this.viewReady = true; this._loadingService.stop();
} }
async saveGeneralConfig() { async saveGeneralConfig() {
this.viewReady = false; this._loadingService.start();
const configFormValues = this.configForm.getRawValue(); const configFormValues = this.configForm.getRawValue();
configFormValues.displayName = configFormValues.displayName || 'RedactManager'; configFormValues.displayName = configFormValues.displayName || 'RedactManager';
await this._generalSettingsControllerService.updateGeneralConfigurations(configFormValues).toPromise(); await this._generalSettingsControllerService.updateGeneralConfigurations(configFormValues).toPromise();
this._appConfigService.updateDisplayName(configFormValues.displayName); this._appConfigService.updateDisplayName(configFormValues.displayName);
this.viewReady = true; this._loadingService.stop();
} }
openAuthConfigDialog(skipDisableOnCancel?: boolean) { openAuthConfigDialog(skipDisableOnCancel?: boolean) {
@ -115,36 +115,35 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent imple
if (authConfig) { if (authConfig) {
this.smtpForm.patchValue(authConfig); this.smtpForm.patchValue(authConfig);
} else if (!skipDisableOnCancel) { } else if (!skipDisableOnCancel) {
this.smtpForm.patchValue({auth: false}, {emitEvent: false}); this.smtpForm.patchValue({ auth: false }, { emitEvent: false });
} }
}); });
} }
async testConnection() { async testConnection() {
this.viewReady = false; this._loadingService.start();
try { try {
await this._smtpConfigService.testSMTPConfiguration(this.smtpForm.getRawValue()).toPromise(); await this._smtpConfigService.testSMTPConfiguration(this.smtpForm.getRawValue()).toPromise();
this._toaster.success('smtp-config-screen.test.success'); this._toaster.success('smtp-config-screen.test.success');
} catch (e) { } catch (e) {
this._toaster.error('smtp-config-screen.test.error'); this._toaster.error('smtp-config-screen.test.error');
} finally { } finally {
this.viewReady = true; this._loadingService.stop();
} }
} }
private async _loadData() { private async _loadData() {
this._loadingService.start();
try { try {
this._initialGeneralConfiguration = await this._generalSettingsControllerService.getGeneralConfigurations().toPromise(); this._initialGeneralConfiguration = await this._generalSettingsControllerService.getGeneralConfigurations().toPromise();
this.configForm.patchValue(this._initialGeneralConfiguration, {emitEvent: false}); this.configForm.patchValue(this._initialGeneralConfiguration, { emitEvent: false });
} catch (e) { } catch (e) {}
}
try { try {
this._initialSMTPConfiguration = await this._smtpConfigService.getCurrentSMTPConfiguration().toPromise(); this._initialSMTPConfiguration = await this._smtpConfigService.getCurrentSMTPConfiguration().toPromise();
this.smtpForm.patchValue(this._initialSMTPConfiguration, {emitEvent: false}); this.smtpForm.patchValue(this._initialSMTPConfiguration, { emitEvent: false });
} catch (e) { } catch (e) {}
}
this.viewReady = true; this._loadingService.stop();
} }
} }

View File

@ -20,11 +20,7 @@
<redaction-admin-side-nav type="dossier-templates"></redaction-admin-side-nav> <redaction-admin-side-nav type="dossier-templates"></redaction-admin-side-nav>
<div class="editor-container"> <div class="editor-container">
<ngx-monaco-editor <ngx-monaco-editor (init)="onCodeEditorInit($event)" [(ngModel)]="codeEditorText" [options]="editorOptions"></ngx-monaco-editor>
(init)="onCodeEditorInit($event)"
[(ngModel)]="codeEditorText"
[options]="editorOptions"
></ngx-monaco-editor>
</div> </div>
<div *ngIf="hasChanges && permissionsService.isAdmin()" class="changes-box"> <div *ngIf="hasChanges && permissionsService.isAdmin()" class="changes-box">
<redaction-icon-button <redaction-icon-button
@ -33,15 +29,7 @@
text="rules-screen.save-changes" text="rules-screen.save-changes"
type="primary" type="primary"
></redaction-icon-button> ></redaction-icon-button>
<div <div (click)="revert()" class="all-caps-label cancel" translate="rules-screen.revert-changes"></div>
(click)="revert()"
class="all-caps-label cancel"
translate="rules-screen.revert-changes"
></div>
</div> </div>
</div> </div>
</section> </section>
<redaction-full-page-loading-indicator
[displayed]="processing"
></redaction-full-page-loading-indicator>

View File

@ -8,6 +8,7 @@ import { ComponentHasChanges } from '@guards/can-deactivate.guard';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { AppStateService } from '@state/app-state.service'; import { AppStateService } from '@state/app-state.service';
import { debounce } from '../../../../utils/debounce'; import { debounce } from '../../../../utils/debounce';
import { LoadingService } from '../../../../services/loading.service';
import ICodeEditor = monaco.editor.ICodeEditor; import ICodeEditor = monaco.editor.ICodeEditor;
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration; import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions; import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions;
@ -24,7 +25,6 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
automaticLayout: true, automaticLayout: true,
readOnly: !this.permissionsService.isAdmin() readOnly: !this.permissionsService.isAdmin()
}; };
processing = true;
initialLines: string[] = []; initialLines: string[] = [];
currentLines: string[] = []; currentLines: string[] = [];
@ -41,7 +41,8 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
private readonly _appStateService: AppStateService, private readonly _appStateService: AppStateService,
private readonly _toaster: Toaster, private readonly _toaster: Toaster,
protected readonly _translateService: TranslateService, protected readonly _translateService: TranslateService,
private readonly _activatedRoute: ActivatedRoute private readonly _activatedRoute: ActivatedRoute,
private readonly _loadingService: LoadingService
) { ) {
super(_translateService); super(_translateService);
_appStateService.activateDossierTemplate(_activatedRoute.snapshot.params.dossierTemplateId); _appStateService.activateDossierTemplate(_activatedRoute.snapshot.params.dossierTemplateId);
@ -85,7 +86,7 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
} }
async save(): Promise<void> { async save(): Promise<void> {
this.processing = true; this._loadingService.start();
await this._rulesControllerService await this._rulesControllerService
.uploadRules({ .uploadRules({
rules: this._codeEditor.getModel().getValue(), rules: this._codeEditor.getModel().getValue(),
@ -98,7 +99,7 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
this._toaster.success('rules-screen.success.generic'); this._toaster.success('rules-screen.success.generic');
}, },
() => { () => {
this.processing = false; this._loadingService.stop();
this._toaster.error('rules-screen.error.generic'); this._toaster.error('rules-screen.error.generic');
} }
); );
@ -107,7 +108,7 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
revert(): void { revert(): void {
this.currentLines = this.initialLines; this.currentLines = this.initialLines;
this._decorations = this._codeEditor?.deltaDecorations(this._decorations, []) || []; this._decorations = this._codeEditor?.deltaDecorations(this._decorations, []) || [];
this.processing = false; this._loadingService.stop();
} }
download(): void { download(): void {
@ -145,6 +146,7 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
} }
private async _initialize() { private async _initialize() {
this._loadingService.start();
await this._rulesControllerService await this._rulesControllerService
.downloadRules(this._appStateService.activeDossierTemplateId) .downloadRules(this._appStateService.activeDossierTemplateId)
.toPromise() .toPromise()
@ -153,7 +155,7 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
this.currentLines = this.initialLines = rules.rules.split('\n'); this.currentLines = this.initialLines = rules.rules.split('\n');
this.revert(); this.revert();
}, },
() => (this.processing = false) () => this._loadingService.stop()
); );
} }
} }

View File

@ -125,5 +125,3 @@
</div> </div>
</div> </div>
</section> </section>
<redaction-full-page-loading-indicator [displayed]="!viewReady"></redaction-full-page-loading-indicator>

View File

@ -11,6 +11,7 @@ import { Toaster } from '../../../../services/toaster.service';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { BASE_HREF } from '../../../../tokens'; import { BASE_HREF } from '../../../../tokens';
import { stampPDFPage } from '../../../../utils/page-stamper'; import { stampPDFPage } from '../../../../utils/page-stamper';
import { LoadingService } from '../../../../services/loading.service';
export const DEFAULT_WATERMARK: WatermarkModelRes = { export const DEFAULT_WATERMARK: WatermarkModelRes = {
text: null, text: null,
@ -27,7 +28,6 @@ export const DEFAULT_WATERMARK: WatermarkModelRes = {
styleUrls: ['./watermark-screen.component.scss'] styleUrls: ['./watermark-screen.component.scss']
}) })
export class WatermarkScreenComponent implements OnInit { export class WatermarkScreenComponent implements OnInit {
viewReady = false;
configForm: FormGroup; configForm: FormGroup;
private _instance: WebViewerInstance; private _instance: WebViewerInstance;
private _watermark: WatermarkModelRes = {}; private _watermark: WatermarkModelRes = {};
@ -43,9 +43,11 @@ export class WatermarkScreenComponent implements OnInit {
private readonly _http: HttpClient, private readonly _http: HttpClient,
private readonly _changeDetectorRef: ChangeDetectorRef, private readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _formBuilder: FormBuilder, private readonly _formBuilder: FormBuilder,
private readonly _activatedRoute: ActivatedRoute private readonly _activatedRoute: ActivatedRoute,
private readonly _loadingService: LoadingService
) { ) {
appStateService.activateDossierTemplate(_activatedRoute.snapshot.params.dossierTemplateId); appStateService.activateDossierTemplate(_activatedRoute.snapshot.params.dossierTemplateId);
this._loadingService.start();
this._initForm(); this._initForm();
} }
@ -133,7 +135,7 @@ export class WatermarkScreenComponent implements OnInit {
this._instance = instance; this._instance = instance;
instance.docViewer.on('documentLoaded', async () => { instance.docViewer.on('documentLoaded', async () => {
this.viewReady = true; this._loadingService.stop();
await this._drawWatermark(); await this._drawWatermark();
}); });

View File

@ -29,7 +29,7 @@
</div> </div>
</div> </div>
<div *ngIf="viewReady" class="flex-1 actions-container"> <div class="flex-1 actions-container">
<ng-container *ngIf="!appStateService.activeFile.isExcluded"> <ng-container *ngIf="!appStateService.activeFile.isExcluded">
<ng-container *ngIf="!appStateService.activeFile.isProcessing"> <ng-container *ngIf="!appStateService.activeFile.isProcessing">
<redaction-status-bar [config]="statusBarConfig" [small]="true"> </redaction-status-bar> <redaction-status-bar [config]="statusBarConfig" [small]="true"> </redaction-status-bar>
@ -89,7 +89,6 @@
<redaction-file-actions <redaction-file-actions
(actionPerformed)="fileActionPerformed($event)" (actionPerformed)="fileActionPerformed($event)"
*ngIf="viewReady"
[activeDocumentInfo]="viewDocumentInfo" [activeDocumentInfo]="viewDocumentInfo"
[activeExcludePages]="excludePages" [activeExcludePages]="excludePages"
></redaction-file-actions> ></redaction-file-actions>
@ -149,7 +148,7 @@
<div class="right-container"> <div class="right-container">
<redaction-empty-state <redaction-empty-state
*ngIf="viewReady && appStateService.activeFile.isExcluded && !viewDocumentInfo && !excludePages" *ngIf="appStateService.activeFile.isExcluded && !viewDocumentInfo && !excludePages"
[horizontalPadding]="40" [horizontalPadding]="40"
icon="red:needs-work" icon="red:needs-work"
text="file-preview.tabs.is-excluded" text="file-preview.tabs.is-excluded"
@ -157,7 +156,7 @@
<redaction-document-info <redaction-document-info
(closeDocumentInfoView)="viewDocumentInfo = false" (closeDocumentInfoView)="viewDocumentInfo = false"
*ngIf="viewReady && viewDocumentInfo" *ngIf="viewDocumentInfo"
[file]="fileData.fileStatus.fileStatus" [file]="fileData.fileStatus.fileStatus"
></redaction-document-info> ></redaction-document-info>
@ -187,8 +186,6 @@
</div> </div>
</section> </section>
<redaction-full-page-loading-indicator [displayed]="!viewReady"> </redaction-full-page-loading-indicator>
<ng-template #annotationActionsTemplate let-annotation="annotation"> <ng-template #annotationActionsTemplate let-annotation="annotation">
<redaction-annotation-actions <redaction-annotation-actions
(annotationsChanged)="annotationsChangedByReviewAction($event)" (annotationsChanged)="annotationsChangedByReviewAction($event)"

View File

@ -54,7 +54,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
fileData: FileDataModel; fileData: FileDataModel;
annotationData: AnnotationData; annotationData: AnnotationData;
selectedAnnotations: AnnotationWrapper[]; selectedAnnotations: AnnotationWrapper[];
viewReady = false;
primaryFilters: FilterModel[]; primaryFilters: FilterModel[];
secondaryFilters: FilterModel[]; secondaryFilters: FilterModel[];
canPerformAnnotationActions: boolean; canPerformAnnotationActions: boolean;
@ -92,6 +91,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
private readonly _translateService: TranslateService private readonly _translateService: TranslateService
) { ) {
super(); super();
this._loadingService.start();
document.documentElement.addEventListener('fullscreenchange', () => { document.documentElement.addEventListener('fullscreenchange', () => {
if (!document.fullscreenElement) { if (!document.fullscreenElement) {
this.fullScreen = false; this.fullScreen = false;
@ -220,7 +220,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
ngOnDetach() { ngOnDetach() {
this.displayPDFViewer = false; this.displayPDFViewer = false;
this.viewReady = false;
super.ngOnDestroy(); super.ngOnDestroy();
} }
@ -246,7 +245,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
} }
this._subscribeToFileUpdates(); this._subscribeToFileUpdates();
this.viewReady = true; this._loadingService.stop();
} }
rebuildFilters(deletePreviousAnnotations: boolean = false) { rebuildFilters(deletePreviousAnnotations: boolean = false) {
@ -394,7 +393,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
await this._stampExcludedPages(); await this._stampExcludedPages();
this._cleanupAndRedrawManualAnnotations(); this._cleanupAndRedrawManualAnnotations();
this._updateCanPerformActions(); this._updateCanPerformActions();
this.viewReady = true; this._loadingService.stop();
// Go to initial page from query params // Go to initial page from query params
const pageNumber = this._lastPage || this._activatedRoute.snapshot.queryParams.page; const pageNumber = this._lastPage || this._activatedRoute.snapshot.queryParams.page;
if (pageNumber) { if (pageNumber) {
@ -540,7 +539,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribeComponent impleme
if (fileStatus.fileId === this.fileId) { if (fileStatus.fileId === this.fileId) {
await this._loadFileData(!this._reloadFileOnReanalysis); await this._loadFileData(!this._reloadFileOnReanalysis);
this._reloadFileOnReanalysis = false; this._reloadFileOnReanalysis = false;
this.viewReady = true; this._loadingService.stop();
this._updateCanPerformActions(); this._updateCanPerformActions();
this._cleanupAndRedrawManualAnnotations(); this._cleanupAndRedrawManualAnnotations();
} }