Translate status outside of doughnut component
This commit is contained in:
parent
72fa0a7f35
commit
bcf20a22e0
@ -29,7 +29,7 @@
|
|||||||
{
|
{
|
||||||
length: val.value,
|
length: val.value,
|
||||||
color: val.color,
|
color: val.color,
|
||||||
label: val.value + ' ' + (val.label.toLowerCase().replace('_', '-') | translate)
|
label: val.value + ' ' + val.label
|
||||||
}
|
}
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -163,7 +163,7 @@
|
|||||||
<div class="right-fixed-container">
|
<div class="right-fixed-container">
|
||||||
<redaction-project-listing-details
|
<redaction-project-listing-details
|
||||||
[projectsChartData]="projectsChartData"
|
[projectsChartData]="projectsChartData"
|
||||||
[documentsChartData]="documentsChartData"
|
[documentsChartData]="translateChartService.translateStatus(documentsChartData)"
|
||||||
[filters]="detailsContainerFilters"
|
[filters]="detailsContainerFilters"
|
||||||
(filtersChanged)="filtersChanged($event)"
|
(filtersChanged)="filtersChanged($event)"
|
||||||
></redaction-project-listing-details>
|
></redaction-project-listing-details>
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import { PermissionsService } from '../../common/service/permissions.service';
|
|||||||
import { ProjectWrapper } from '../../state/model/project.wrapper';
|
import { ProjectWrapper } from '../../state/model/project.wrapper';
|
||||||
import { Subscription, timer } from 'rxjs';
|
import { Subscription, timer } from 'rxjs';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
|
import { TranslateChartService } from '../../utils/translate-chart.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-project-listing-screen',
|
selector: 'redaction-project-listing-screen',
|
||||||
@ -53,7 +54,8 @@ export class ProjectListingScreenComponent implements OnInit, OnDestroy {
|
|||||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||||
private readonly _dialogService: DialogService,
|
private readonly _dialogService: DialogService,
|
||||||
private readonly _translateService: TranslateService,
|
private readonly _translateService: TranslateService,
|
||||||
public readonly sortingService: SortingService
|
public readonly sortingService: SortingService,
|
||||||
|
public readonly translateChartService: TranslateChartService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
@ -85,7 +87,11 @@ export class ProjectListingScreenComponent implements OnInit, OnDestroy {
|
|||||||
const groups = groupBy(this.appStateService.aggregatedFiles, 'status');
|
const groups = groupBy(this.appStateService.aggregatedFiles, 'status');
|
||||||
this.documentsChartData = [];
|
this.documentsChartData = [];
|
||||||
for (const key of Object.keys(groups)) {
|
for (const key of Object.keys(groups)) {
|
||||||
this.documentsChartData.push({ value: groups[key].length, color: key, label: key });
|
this.documentsChartData.push({
|
||||||
|
value: groups[key].length,
|
||||||
|
color: key,
|
||||||
|
label: key
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
<div *ngIf="hasFiles" class="mt-24">
|
<div *ngIf="hasFiles" class="mt-24">
|
||||||
<redaction-simple-doughnut-chart
|
<redaction-simple-doughnut-chart
|
||||||
(toggleFilter)="toggleFilter('statusFilters', $event)"
|
(toggleFilter)="toggleFilter('statusFilters', $event)"
|
||||||
[config]="documentsChartData"
|
[config]="translateChartService.translateStatus(documentsChartData)"
|
||||||
[filter]="filters.statusFilters"
|
[filter]="filters.statusFilters"
|
||||||
[radius]="70"
|
[radius]="70"
|
||||||
[strokeWidth]="15"
|
[strokeWidth]="15"
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { DialogService } from '../../../dialogs/dialog.service';
|
|||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { FilterModel } from '../../../common/filter/model/filter.model';
|
import { FilterModel } from '../../../common/filter/model/filter.model';
|
||||||
import { PermissionsService } from '../../../common/service/permissions.service';
|
import { PermissionsService } from '../../../common/service/permissions.service';
|
||||||
|
import { TranslateChartService } from '../../../utils/translate-chart.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-project-details',
|
selector: 'redaction-project-details',
|
||||||
@ -20,6 +21,7 @@ export class ProjectDetailsComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public readonly appStateService: AppStateService,
|
public readonly appStateService: AppStateService,
|
||||||
|
public readonly translateChartService: TranslateChartService,
|
||||||
public readonly permissionsService: PermissionsService,
|
public readonly permissionsService: PermissionsService,
|
||||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||||
private readonly _dialogService: DialogService,
|
private readonly _dialogService: DialogService,
|
||||||
|
|||||||
14
apps/red-ui/src/app/utils/translate-chart.service.ts
Normal file
14
apps/red-ui/src/app/utils/translate-chart.service.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { DoughnutChartConfig } from '../components/simple-doughnut-chart/simple-doughnut-chart.component';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class TranslateChartService {
|
||||||
|
constructor(private readonly _translateService: TranslateService) {}
|
||||||
|
|
||||||
|
public translateStatus(config: DoughnutChartConfig[]): DoughnutChartConfig[] {
|
||||||
|
return config.map((val) => ({ ...val, label: this._translateService.instant(val.label.toLowerCase().replace('_', '-')) }));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -351,9 +351,9 @@
|
|||||||
"cancel": "Cancel"
|
"cancel": "Cancel"
|
||||||
},
|
},
|
||||||
"unassigned": "Unassigned",
|
"unassigned": "Unassigned",
|
||||||
"under-review": "Under review",
|
"under-review": "Under Review",
|
||||||
"under-approval": "Under approval",
|
"under-approval": "Under Approval",
|
||||||
"efsa": "EFSA approval",
|
"efsa": "EFSA Approval",
|
||||||
"finished": "Finished",
|
"finished": "Finished",
|
||||||
"approved": "Approved",
|
"approved": "Approved",
|
||||||
"submitted": "Submitted",
|
"submitted": "Submitted",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user