diff --git a/apps/red-ui/src/app/app.component.html b/apps/red-ui/src/app/app.component.html index dbdf8372d..5735353bf 100644 --- a/apps/red-ui/src/app/app.component.html +++ b/apps/red-ui/src/app/app.component.html @@ -1,2 +1,2 @@ - + diff --git a/apps/red-ui/src/app/modules/shared/components/full-page-loading-indicator/full-page-loading-indicator.component.html b/apps/red-ui/src/app/modules/shared/components/full-page-loading-indicator/full-page-loading-indicator.component.html index edfadb0bb..46e67a5fe 100644 --- a/apps/red-ui/src/app/modules/shared/components/full-page-loading-indicator/full-page-loading-indicator.component.html +++ b/apps/red-ui/src/app/modules/shared/components/full-page-loading-indicator/full-page-loading-indicator.component.html @@ -1,5 +1,7 @@ -
-
- - -
+ +
+
+ + +
+
diff --git a/apps/red-ui/src/app/modules/shared/components/full-page-loading-indicator/full-page-loading-indicator.component.ts b/apps/red-ui/src/app/modules/shared/components/full-page-loading-indicator/full-page-loading-indicator.component.ts index d03e2ea20..cbf497e43 100644 --- a/apps/red-ui/src/app/modules/shared/components/full-page-loading-indicator/full-page-loading-indicator.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/full-page-loading-indicator/full-page-loading-indicator.component.ts @@ -1,4 +1,5 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { LoadingService } from '@services/loading.service'; @Component({ selector: 'redaction-full-page-loading-indicator', @@ -7,5 +8,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; changeDetection: ChangeDetectionStrategy.OnPush }) export class FullPageLoadingIndicatorComponent { - @Input() displayed = false; + constructor(readonly loadingService: LoadingService) {} } diff --git a/apps/red-ui/src/app/services/loading.service.ts b/apps/red-ui/src/app/services/loading.service.ts index 322faa823..ef834d90f 100644 --- a/apps/red-ui/src/app/services/loading.service.ts +++ b/apps/red-ui/src/app/services/loading.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { BehaviorSubject, Observable } from 'rxjs'; +import { BehaviorSubject } from 'rxjs'; const MIN_LOADING_TIME = 300; @@ -7,16 +7,15 @@ const MIN_LOADING_TIME = 300; providedIn: 'root' }) export class LoadingService { - private readonly _loadingEvent = new BehaviorSubject(false); + private readonly _loadingEvent$ = new BehaviorSubject(false); + readonly isLoading$ = this._loadingEvent$.asObservable(); private _loadingStarted: number; - get isLoading$(): Observable { - return this._loadingEvent.asObservable(); - } - start(): void { - this._loadingEvent.next(true); - this._loadingStarted = new Date().getTime(); + setTimeout(() => { + this._loadingEvent$.next(true); + this._loadingStarted = new Date().getTime(); + }); } stop(): void { @@ -36,7 +35,7 @@ export class LoadingService { } private _stop() { - setTimeout(() => this._loadingEvent.next(false)); + setTimeout(() => this._loadingEvent$.next(false)); } private _stopAfter(timeout: number) {