RED-5289 - Docs/Pages switch in dossier stats
This commit is contained in:
parent
f91e70f38b
commit
994e7057e2
@ -16,9 +16,9 @@ import { UserService } from '@users/user.service';
|
||||
import { ContextComponent, FilterService, getParam, INestedFilter, ProgressBarConfigModel, shareLast, Toaster } from '@iqser/common-ui';
|
||||
import { workflowFileStatusTranslations } from '@translations/file-status-translations';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { firstValueFrom, Observable } from 'rxjs';
|
||||
import { combineLatestWith, firstValueFrom, Observable } from 'rxjs';
|
||||
import { DossierStatsService } from '@services/dossiers/dossier-stats.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { map, tap } from 'rxjs/operators';
|
||||
import { DossiersService } from '@services/dossiers/dossiers.service';
|
||||
import { FilesMapService } from '@services/files/files-map.service';
|
||||
|
||||
@ -26,6 +26,7 @@ interface DossierDetailsContext {
|
||||
needsWorkFilters: INestedFilter[] | undefined;
|
||||
dossier: Dossier;
|
||||
dossierStats: DossierStats;
|
||||
filesChanged: boolean;
|
||||
chartConfig: void;
|
||||
statusConfig: ProgressBarConfigModel[];
|
||||
}
|
||||
@ -50,6 +51,7 @@ export class DossierDetailsComponent extends ContextComponent<DossierDetailsCont
|
||||
readonly currentUser = this._userService.currentUser;
|
||||
readonly dossier$: Observable<Dossier>;
|
||||
readonly dossierStats$: Observable<DossierStats>;
|
||||
readonly filesChanged$: Observable<boolean>;
|
||||
readonly chartConfig$: Observable<void>;
|
||||
readonly statusConfig$: Observable<ProgressBarConfigModel[]>;
|
||||
|
||||
@ -68,7 +70,11 @@ export class DossierDetailsComponent extends ContextComponent<DossierDetailsCont
|
||||
this.#dossierId = getParam(DOSSIER_ID);
|
||||
this.dossier$ = _dossiersService.getEntityChanged$(this.#dossierId).pipe(shareLast());
|
||||
this.dossierStats$ = dossierStatsService.watch$(this.#dossierId).pipe(shareLast());
|
||||
this.chartConfig$ = this.dossierStats$.pipe(map(stats => this.#calculateChartConfig(stats)));
|
||||
this.filesChanged$ = _filesMapService.watchChanged$(this.#dossierId).pipe(shareLast());
|
||||
this.chartConfig$ = this.dossierStats$.pipe(
|
||||
combineLatestWith(this.filesChanged$),
|
||||
map(([stats]) => this.#calculateChartConfig(stats)),
|
||||
);
|
||||
this.statusConfig$ = this.dossierStats$.pipe(map(stats => this.#calculateStatusConfig(stats)));
|
||||
}
|
||||
|
||||
@ -77,6 +83,7 @@ export class DossierDetailsComponent extends ContextComponent<DossierDetailsCont
|
||||
needsWorkFilters: this.needsWorkFilters$,
|
||||
dossier: this.dossier$,
|
||||
dossierStats: this.dossierStats$,
|
||||
filesChanged: this.filesChanged$,
|
||||
chartConfig: this.chartConfig$,
|
||||
statusConfig: this.statusConfig$,
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user