removed loading indicator

This commit is contained in:
Timo 2021-07-20 12:07:04 +03:00
parent eb00732f2f
commit aaa9c51bbc
12 changed files with 62 additions and 103 deletions

View File

@ -23,15 +23,10 @@
<input formControlName="lastName" name="lastName" type="text" />
</div>
<div class="red-input-group">
<label
translate="top-bar.navigation-items.my-account.children.language.label"
></label>
<label translate="top-bar.navigation-items.my-account.children.language.label"></label>
<mat-select formControlName="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-select>
</div>
@ -47,15 +42,9 @@
>
{{ 'user-profile.actions.save' | translate }}
</button>
<a [href]="changePasswordUrl" target="_blank">
{{ 'user-profile.actions.change-password' | translate }}</a
>
<a [href]="changePasswordUrl" target="_blank"> {{ 'user-profile.actions.change-password' | translate }}</a>
</div>
</form>
</div>
</div>
</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 { AppConfigKey, AppConfigService } from '@app-config/app-config.service';
import { DomSanitizer } from '@angular/platform-browser';
import { LoadingService } from '@services/loading.service';
@Component({
selector: 'redaction-user-profile-screen',
@ -14,7 +15,6 @@ import { DomSanitizer } from '@angular/platform-browser';
styleUrls: ['./user-profile-screen.component.scss']
})
export class UserProfileScreenComponent implements OnInit {
viewReady = false;
formGroup: FormGroup;
changePasswordUrl: any;
@ -28,8 +28,10 @@ export class UserProfileScreenComponent implements OnInit {
private readonly _userControllerService: UserControllerService,
private readonly _languageService: LanguageService,
private readonly _domSanitizer: DomSanitizer,
private readonly _translateService: TranslateService
private readonly _translateService: TranslateService,
private readonly _loadingService: LoadingService
) {
this._loadingService.start();
this.formGroup = this._formBuilder.group({
email: [undefined, [Validators.required, Validators.email]],
firstName: [undefined],
@ -68,7 +70,7 @@ export class UserProfileScreenComponent implements OnInit {
}
async save(): Promise<void> {
this.viewReady = false;
this._loadingService.start();
if (this.languageChanged) {
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 });
} catch (e) {
} finally {
this.viewReady = true;
this._loadingService.stop();
}
}
}

View File

@ -36,14 +36,7 @@
tooltipPosition="below"
></redaction-circle-button>
<input
#fileInput
(change)="upload($event)"
accept="text/plain"
class="file-upload-input"
hidden
type="file"
/>
<input #fileInput (change)="upload($event)" accept="text/plain" class="file-upload-input" hidden type="file" />
<redaction-circle-button
[routerLink]="['..']"
@ -98,16 +91,9 @@
</div>
<div *ngIf="!!dictionary.description" class="pb-32 mt-20">
<div
class="heading"
translate="dictionary-overview.dictionary-details.description"
></div>
<div class="heading" translate="dictionary-overview.dictionary-details.description"></div>
<div class="mt-8">{{ dictionary.description }}</div>
</div>
</div>
</div>
</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']
})
export class DictionaryOverviewScreenComponent extends ComponentHasChanges implements OnInit {
processing = false;
entries: string[] = [];
@ViewChild('dictionaryManager', { static: false })
@ -109,29 +108,29 @@ export class DictionaryOverviewScreenComponent extends ComponentHasChanges imple
}
saveEntries(entries: string[]) {
this.processing = true;
this._loadingService.start();
this._dictionarySaveService
.saveEntries(entries, this.entries, this.dictionary.dossierTemplateId, this.dictionary.type, null)
.subscribe(
() => {
this.processing = false;
this._loadingService.stop();
this._loadEntries();
},
() => {
this.processing = false;
this._loadingService.stop();
}
);
}
private _loadEntries() {
this.processing = true;
this._loadingService.start();
this._dictionaryControllerService.getDictionaryForType(this.dictionary.dossierTemplateId, this.dictionary.type).subscribe(
data => {
this.processing = false;
this._loadingService.stop();
this.entries = data.entries.sort((str1, str2) => str1.localeCompare(str2, undefined, { sensitivity: 'accent' }));
},
() => {
this.processing = false;
this._loadingService.stop();
this.entries = [];
}
);

View File

@ -177,5 +177,3 @@
</div>
</div>
</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 {PermissionsService} from '@services/permissions.service';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {AdminDialogService} from '../../services/admin-dialog.service';
import { Component, OnInit } from '@angular/core';
import { PermissionsService } from '@services/permissions.service';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { AdminDialogService } from '../../services/admin-dialog.service';
import {
GeneralConfigurationModel,
GeneralSettingsControllerService,
SmtpConfigurationControllerService,
SMTPConfigurationModel
} from '@redaction/red-ui-http';
import {AppConfigService} from '../../../app-config/app-config.service';
import {AutoUnsubscribeComponent} from "../../../shared/base/auto-unsubscribe.component";
import {Toaster} from "../../../../services/toaster.service";
import { AppConfigService } from '../../../app-config/app-config.service';
import { AutoUnsubscribeComponent } from '../../../shared/base/auto-unsubscribe.component';
import { Toaster } from '../../../../services/toaster.service';
import { LoadingService } from '../../../../services/loading.service';
@Component({
selector: 'redaction-general-config-screen',
@ -18,7 +19,6 @@ import {Toaster} from "../../../../services/toaster.service";
styleUrls: ['./general-config-screen.component.scss']
})
export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent implements OnInit {
viewReady = false;
configForm: FormGroup;
smtpForm: FormGroup;
@ -32,7 +32,8 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent imple
private readonly _formBuilder: FormBuilder,
private readonly _toaster: Toaster,
private readonly _dialogService: AdminDialogService,
private readonly _generalSettingsControllerService: GeneralSettingsControllerService
private readonly _generalSettingsControllerService: GeneralSettingsControllerService,
private readonly _loadingService: LoadingService
) {
super();
@ -56,7 +57,6 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent imple
password: [undefined]
});
this.addSubscription = this.configForm.controls.auth.valueChanges.subscribe(auth => {
if (auth) {
this.openAuthConfigDialog();
@ -93,21 +93,21 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent imple
}
async save() {
this.viewReady = false;
this._loadingService.start();
await this._smtpConfigService.updateSMTPConfiguration(this.smtpForm.getRawValue()).toPromise();
this._initialSMTPConfiguration = this.smtpForm.getRawValue();
this.viewReady = true;
this._loadingService.stop();
}
async saveGeneralConfig() {
this.viewReady = false;
this._loadingService.start();
const configFormValues = this.configForm.getRawValue();
configFormValues.displayName = configFormValues.displayName || 'RedactManager';
await this._generalSettingsControllerService.updateGeneralConfigurations(configFormValues).toPromise();
this._appConfigService.updateDisplayName(configFormValues.displayName);
this.viewReady = true;
this._loadingService.stop();
}
openAuthConfigDialog(skipDisableOnCancel?: boolean) {
@ -115,36 +115,35 @@ export class GeneralConfigScreenComponent extends AutoUnsubscribeComponent imple
if (authConfig) {
this.smtpForm.patchValue(authConfig);
} else if (!skipDisableOnCancel) {
this.smtpForm.patchValue({auth: false}, {emitEvent: false});
this.smtpForm.patchValue({ auth: false }, { emitEvent: false });
}
});
}
async testConnection() {
this.viewReady = false;
this._loadingService.start();
try {
await this._smtpConfigService.testSMTPConfiguration(this.smtpForm.getRawValue()).toPromise();
this._toaster.success('smtp-config-screen.test.success');
} catch (e) {
this._toaster.error('smtp-config-screen.test.error');
} finally {
this.viewReady = true;
this._loadingService.stop();
}
}
private async _loadData() {
this._loadingService.start();
try {
this._initialGeneralConfiguration = await this._generalSettingsControllerService.getGeneralConfigurations().toPromise();
this.configForm.patchValue(this._initialGeneralConfiguration, {emitEvent: false});
} catch (e) {
}
this.configForm.patchValue(this._initialGeneralConfiguration, { emitEvent: false });
} catch (e) {}
try {
this._initialSMTPConfiguration = await this._smtpConfigService.getCurrentSMTPConfiguration().toPromise();
this.smtpForm.patchValue(this._initialSMTPConfiguration, {emitEvent: false});
} catch (e) {
}
this.smtpForm.patchValue(this._initialSMTPConfiguration, { emitEvent: false });
} 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>
<div class="editor-container">
<ngx-monaco-editor
(init)="onCodeEditorInit($event)"
[(ngModel)]="codeEditorText"
[options]="editorOptions"
></ngx-monaco-editor>
<ngx-monaco-editor (init)="onCodeEditorInit($event)" [(ngModel)]="codeEditorText" [options]="editorOptions"></ngx-monaco-editor>
</div>
<div *ngIf="hasChanges && permissionsService.isAdmin()" class="changes-box">
<redaction-icon-button
@ -33,15 +29,7 @@
text="rules-screen.save-changes"
type="primary"
></redaction-icon-button>
<div
(click)="revert()"
class="all-caps-label cancel"
translate="rules-screen.revert-changes"
></div>
<div (click)="revert()" class="all-caps-label cancel" translate="rules-screen.revert-changes"></div>
</div>
</div>
</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 { AppStateService } from '@state/app-state.service';
import { debounce } from '../../../../utils/debounce';
import { LoadingService } from '../../../../services/loading.service';
import ICodeEditor = monaco.editor.ICodeEditor;
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions;
@ -24,7 +25,6 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
automaticLayout: true,
readOnly: !this.permissionsService.isAdmin()
};
processing = true;
initialLines: string[] = [];
currentLines: string[] = [];
@ -41,7 +41,8 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
private readonly _appStateService: AppStateService,
private readonly _toaster: Toaster,
protected readonly _translateService: TranslateService,
private readonly _activatedRoute: ActivatedRoute
private readonly _activatedRoute: ActivatedRoute,
private readonly _loadingService: LoadingService
) {
super(_translateService);
_appStateService.activateDossierTemplate(_activatedRoute.snapshot.params.dossierTemplateId);
@ -85,7 +86,7 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
}
async save(): Promise<void> {
this.processing = true;
this._loadingService.start();
await this._rulesControllerService
.uploadRules({
rules: this._codeEditor.getModel().getValue(),
@ -98,7 +99,7 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
this._toaster.success('rules-screen.success.generic');
},
() => {
this.processing = false;
this._loadingService.stop();
this._toaster.error('rules-screen.error.generic');
}
);
@ -107,7 +108,7 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
revert(): void {
this.currentLines = this.initialLines;
this._decorations = this._codeEditor?.deltaDecorations(this._decorations, []) || [];
this.processing = false;
this._loadingService.stop();
}
download(): void {
@ -145,6 +146,7 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
}
private async _initialize() {
this._loadingService.start();
await this._rulesControllerService
.downloadRules(this._appStateService.activeDossierTemplateId)
.toPromise()
@ -153,7 +155,7 @@ export class RulesScreenComponent extends ComponentHasChanges implements OnInit
this.currentLines = this.initialLines = rules.rules.split('\n');
this.revert();
},
() => (this.processing = false)
() => this._loadingService.stop()
);
}
}

View File

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

View File

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

View File

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