diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen.component.ts index 646b0f020..dde759d49 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/dossier-states-listing/dossier-states-listing-screen.component.ts @@ -111,7 +111,7 @@ export class DossierStatesListingScreenComponent extends ListingComponent d.dossierTemplateId === this.#dossierTemplateId); this.#setStatesCount(dossierStates); - this.chartData = this.dossierStateService.all.map(state => { + this.chartData = dossierStates.map(state => { return { value: state.dossierCount, label: state.name, key: state.name, color: state.color }; }); diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/config.service.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/config.service.ts index df9941b39..86830f0ed 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/config.service.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview/config.service.ts @@ -229,7 +229,7 @@ export class ConfigService { filterGroups.push({ slug: 'statusFilters', - label: this._translateService.instant('filters.status'), + label: this._translateService.instant('filters.documents-status'), icon: 'red:status', filters: statusFilters.sort((a, b) => StatusSorter[a.id] - StatusSorter[b.id]), checker: keyChecker('workflowStatus'), diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossiers-listing/components/dossiers-listing-details/dossiers-listing-details.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossiers-listing/components/dossiers-listing-details/dossiers-listing-details.component.ts index d2626983a..b0fd32ca9 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossiers-listing/components/dossiers-listing-details/dossiers-listing-details.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossiers-listing/components/dossiers-listing-details/dossiers-listing-details.component.ts @@ -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, FileCountPerWorkflowStatus, StatusSorter } from '@red/domain'; +import { 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'; @@ -11,6 +11,12 @@ import { DossierStatsService } from '@services/entity-services/dossier-stats.ser import { DossierStateService } from '../../../../../../services/entity-services/dossier-state.service'; import { TranslateService } from '@ngx-translate/core'; +interface DossierStatusChartConfig { + readonly value: number; + readonly label: string; + readonly color: string; +} + @Component({ selector: 'redaction-dossiers-listing-details', templateUrl: './dossiers-listing-details.component.html', @@ -36,23 +42,35 @@ export class DossiersListingDetailsComponent { map(stats => this._toChartData(stats)), ); - this.dossiersChartData$ = this.dossiersService.all$.pipe(switchMap(dossiers => this._toDossierChartData(dossiers))); + this.dossiersChartData$ = this.dossiersService.all$.pipe(switchMap(dossiers => this._toDossierChartData())); } - private async _toDossierChartData(dossiers: Dossier[]): Promise { - const config: DoughnutChartConfig[] = []; - this._dossierStateService.all.forEach(state => { - state.dossierCount = this.dossiersService.getCountWithState(state.dossierStatusId); - config.push({ value: state.dossierCount, label: state.name, color: state.color }); - }); - const notAssignedLength = this.dossiersService.all.length - config.map(v => v.value).reduce((acc, val) => acc + val, 0); - config.push({ + private async _toDossierChartData(): Promise { + this._dossierStateService.all.forEach( + state => (state.dossierCount = this.dossiersService.getCountWithState(state.dossierStatusId)), + ); + const configArray = [ + ...this._dossierStateService.all + .reduce((acc, s) => { + const key = s.name + '-' + s.color; + + const item = acc.get(key) ?? Object.assign({}, { value: 0, label: s.name, color: s.color }); + + item.value += s.dossierCount; + + return acc.set(key, item); + }, new Map()) + .values(), + ]; + + const notAssignedLength = this.dossiersService.all.length - configArray.map(v => v.value).reduce((acc, val) => acc + val, 0); + configArray.push({ value: notAssignedLength, label: this._translateService.instant('edit-dossier-dialog.general-info.form.dossier-status.placeholder'), color: '#E2E4E9', }); - // TODO: deleted dossiers count should come with stats - return config; + + return configArray; } private _toChartData(stats: DossierStats[]) { diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 197e1b16f..dcda72e72 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,7 +1,7 @@ { "ADMIN_CONTACT_NAME": null, "ADMIN_CONTACT_URL": null, - "API_URL": "https://rosa1.iqser.cloud/redaction-gateway-v1", + "API_URL": "https://dev-04.iqser.cloud/redaction-gateway-v1", "APP_NAME": "RedactManager", "AUTO_READ_TIME": 3, "BACKEND_APP_VERSION": "4.4.40", @@ -17,7 +17,7 @@ "MAX_RETRIES_ON_SERVER_ERROR": 3, "OAUTH_CLIENT_ID": "redaction", "OAUTH_IDP_HINT": null, - "OAUTH_URL": "https://rosa1.iqser.cloud/auth/realms/redaction", + "OAUTH_URL": "https://dev-04.iqser.cloud/auth/realms/redaction", "RECENT_PERIOD_IN_HOURS": 24, "SELECTION_MODE": "structural", "MANUAL_BASE_URL": "https://docs.redactmanager.com/3.0" diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 1eca4a309..45aea39bb 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -733,7 +733,6 @@ "assign-approver": "Assign Approver", "assign-me": "Assign To Me", "assign-reviewer": "Assign User", - "import-redactions": "Import redactions from other file", "bulk": { "delete": "Delete Documents", "reanalyse": "Analyze Documents" @@ -781,6 +780,7 @@ "edit": "Edit Dossier", "upload-document": "Upload Document" }, + "import-redactions": "Import redactions from other file", "new-rule": { "toast": { "actions": { @@ -1289,13 +1289,13 @@ }, "filters": { "assigned-people": "Assignee(s)", + "documents-status": "Documents Status", + "dossier-status": "Dossier Status", "dossier-templates": "Dossier Templates", "empty": "Empty", "filter-by": "Filter:", "needs-work": "Workload", - "people": "Dossier Member(s)", - "documents-status": "Documents Status", - "dossier-status": "Dossier Status" + "people": "Dossier Member(s)" }, "general-config-screen": { "actions": {