show deleted dossiers count in dossiers details
This commit is contained in:
parent
39e6fcac92
commit
cae558c77e
@ -1,6 +1,7 @@
|
||||
<div>
|
||||
<redaction-simple-doughnut-chart
|
||||
[config]="dossiersChartData$ | async"
|
||||
*ngIf="dossiersChartData$ | async as config"
|
||||
[config]="config"
|
||||
[radius]="80"
|
||||
[strokeWidth]="15"
|
||||
[subtitle]="'dossier-listing.stats.charts.dossiers' | translate"
|
||||
|
||||
@ -3,7 +3,7 @@ import { DoughnutChartConfig } from '@shared/components/simple-doughnut-chart/si
|
||||
import { FilterService, mapEach } from '@iqser/common-ui';
|
||||
import { DossiersService } from '@services/entity-services/dossiers.service';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
import { Dossier, DossierStats, DossierStatuses, FileCountPerWorkflowStatus, StatusSorter } from '@red/domain';
|
||||
import { Dossier, DossierStats, FileCountPerWorkflowStatus, StatusSorter } from '@red/domain';
|
||||
import { workflowFileStatusTranslations } from '../../../../translations/file-status-translations';
|
||||
import { TranslateChartService } from '@services/translate-chart.service';
|
||||
import { filter, map, switchMap } from 'rxjs/operators';
|
||||
@ -33,16 +33,15 @@ export class DossiersListingDetailsComponent {
|
||||
map(stats => this._toChartData(stats)),
|
||||
);
|
||||
|
||||
this.dossiersChartData$ = this.dossiersService.all$.pipe(map(dossiers => this._toDossierChartData(dossiers)));
|
||||
this.dossiersChartData$ = this.dossiersService.all$.pipe(switchMap(dossiers => this._toDossierChartData(dossiers)));
|
||||
}
|
||||
|
||||
private _toDossierChartData(dossiers: Dossier[]): DoughnutChartConfig[] {
|
||||
const activeDossiersCount = dossiers.filter(p => p.status === DossierStatuses.ACTIVE).length;
|
||||
const inactiveDossiersCount = dossiers.length - activeDossiersCount;
|
||||
|
||||
private async _toDossierChartData(dossiers: Dossier[]): Promise<DoughnutChartConfig[]> {
|
||||
// TODO: deleted dossiers count should come with stats
|
||||
const deletedDossiers = await this.dossiersService.getDeleted();
|
||||
return [
|
||||
{ value: activeDossiersCount, color: 'ACTIVE', label: _('active') },
|
||||
{ value: inactiveDossiersCount, color: 'DELETED', label: _('archived') },
|
||||
{ value: dossiers.length, color: 'ACTIVE', label: _('active') },
|
||||
{ value: deletedDossiers.length, color: 'DELETED', label: _('archived') },
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
|
||||
|
||||
return combineLatest([dossier$, stats$]).pipe(
|
||||
map(([updatedDossier]) => new Dossier(updatedDossier)),
|
||||
tap(newDossier => this.replace(newDossier)),
|
||||
tap(newDossier => this.replace([newDossier])),
|
||||
catchError(showToast),
|
||||
);
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ export class UserService extends EntitiesService<User, IUser> {
|
||||
const userId = (<{ sub: string }>decoded).sub;
|
||||
|
||||
const roles = this._keycloakService.getUserRoles(true).filter(role => role.startsWith('RED_'));
|
||||
this.replace(new User(await this._keycloakService.loadUserProfile(true), roles, userId));
|
||||
this.replace([new User(await this._keycloakService.loadUserProfile(true), roles, userId)]);
|
||||
|
||||
this._currentUser$.next(this.find(userId));
|
||||
}
|
||||
|
||||
@ -123,9 +123,7 @@ export class AppStateService {
|
||||
const dossierIds = dossiers.map(dossier => dossier.dossierId);
|
||||
await this._dossierStatsService.getFor(dossierIds).toPromise();
|
||||
|
||||
dossiers.forEach(dossier => {
|
||||
this._dossiersService.replace(new Dossier(dossier));
|
||||
});
|
||||
this._dossiersService.replace(dossiers.map(dossier => new Dossier(dossier)));
|
||||
}
|
||||
|
||||
async reloadFile(dossierId: string, fileId: string) {
|
||||
@ -201,7 +199,7 @@ export class AppStateService {
|
||||
await this._fileAttributesService.getFileAttributesConfig(dossierTemplateId).toPromise();
|
||||
|
||||
const newDossierTemplate = new DossierTemplate(dossierTemplate);
|
||||
this._dossierTemplatesService.replace(newDossierTemplate);
|
||||
this._dossierTemplatesService.replace([newDossierTemplate]);
|
||||
|
||||
await this.refreshDossierTemplateDictionaryData(dossierTemplateId);
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 74fcbf080b593622220bb2c7de08f69163acab04
|
||||
Subproject commit 17c65675b934698a61a2c80435f532e5a77f0c97
|
||||
Loading…
x
Reference in New Issue
Block a user