RED-7699 - Hint types in Edit Dossier effective dictionary list

This commit is contained in:
Valentin Mihai 2023-10-04 23:23:01 +03:00
parent b7432d19a5
commit d133070e00
4 changed files with 19 additions and 9 deletions

View File

@ -6,7 +6,11 @@
[class.active]="dictionary.label === selectedDictionary.label" [class.active]="dictionary.label === selectedDictionary.label"
(click)="selectDictionary(dictionary)" (click)="selectDictionary(dictionary)"
> >
<redaction-annotation-icon [color]="dictionary.hexColor" label="R" type="square"></redaction-annotation-icon> <redaction-annotation-icon
[color]="dictionary.hexColor"
[label]="dictionary.hint ? 'H' : 'R'"
type="square"
></redaction-annotation-icon>
<div class="details"> <div class="details">
<span> {{ dictionary.label }} </span> <span> {{ dictionary.label }} </span>
<div class="small-label stats-subtitle"> <div class="small-label stats-subtitle">
@ -34,25 +38,27 @@
<div> <div>
<mat-icon svgIcon="red:entries"></mat-icon> <mat-icon svgIcon="red:entries"></mat-icon>
<ng-container *ngIf="activeEntryType === entryTypes.ENTRY"> <ng-container *ngIf="activeEntryType === entryTypes.ENTRY">
{{ 'edit-dossier-dialog.dictionary.entries' | translate : { length: entriesToDisplay.length } }} {{
'edit-dossier-dialog.dictionary.entries'
| translate: { length: entriesToDisplay.length, hint: selectedDictionary.hint }
}}
</ng-container> </ng-container>
<ng-container *ngIf="activeEntryType === entryTypes.FALSE_POSITIVE"> <ng-container *ngIf="activeEntryType === entryTypes.FALSE_POSITIVE">
{{ {{
'edit-dossier-dialog.dictionary.false-positive-entries' 'edit-dossier-dialog.dictionary.false-positive-entries' | translate: { length: entriesToDisplay.length }
| translate : { length: entriesToDisplay.length }
}} }}
</ng-container> </ng-container>
<ng-container *ngIf="activeEntryType === entryTypes.FALSE_RECOMMENDATION"> <ng-container *ngIf="activeEntryType === entryTypes.FALSE_RECOMMENDATION">
{{ {{
'edit-dossier-dialog.dictionary.false-recommendation-entries' 'edit-dossier-dialog.dictionary.false-recommendation-entries'
| translate : { length: entriesToDisplay.length } | translate: { length: entriesToDisplay.length }
}} }}
</ng-container> </ng-container>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="header-right flex" [class.read-only]="!canEdit"> <div class="header-right flex" [class.read-only]="!canEdit" *ngIf="!selectedDictionary.hint">
<iqser-icon-button <iqser-icon-button
[label]="'edit-dossier-dialog.dictionary.to-redact' | translate" [label]="'edit-dossier-dialog.dictionary.to-redact' | translate"
[active]="activeEntryType === entryTypes.ENTRY" [active]="activeEntryType === entryTypes.ENTRY"

View File

@ -101,13 +101,17 @@ export class EditDossierDictionaryComponent implements OnInit {
async #updateDossierDictionary() { async #updateDossierDictionary() {
const { dossierId, dossierTemplateId } = this.dossier; const { dossierId, dossierTemplateId } = this.dossier;
let dictionaryTypes = this._dictionaryService.getRedactTextDictionaries(dossierTemplateId, true).map(d => d.type); let dictionaryTypes = [
...this._dictionaryService.getRedactTextDictionaries(dossierTemplateId, true),
...this._dictionaryService.getAddHintDictionaries(dossierTemplateId, false, true),
].map(d => d.type);
dictionaryTypes = [...new Set(dictionaryTypes)]; dictionaryTypes = [...new Set(dictionaryTypes)];
this.dictionaries = await firstValueFrom( this.dictionaries = await firstValueFrom(
this._dictionaryService.loadDictionaryEntriesByType(dictionaryTypes, dossierTemplateId, dossierId), this._dictionaryService.loadDictionaryEntriesByType(dictionaryTypes, dossierTemplateId, dossierId),
); );
//TODO remove this when backend will send also the type //TODO remove this when backend will send also the type
this.#setType(dictionaryTypes); this.#setType(dictionaryTypes);
this.dictionaries = this.dictionaries.sort((a, b) => a.label.localeCompare(b.label));
let dictionaryToSelect = this.dictionaries[0]; let dictionaryToSelect = this.dictionaries[0];
if (this.selectedDictionary) { if (this.selectedDictionary) {
dictionaryToSelect = this.dictionaries.find(d => d.type === this.selectedDictionary.type); dictionaryToSelect = this.dictionaries.find(d => d.type === this.selectedDictionary.type);

View File

@ -1187,7 +1187,7 @@
"change-successful": "Dossier {dossierName} was updated.", "change-successful": "Dossier {dossierName} was updated.",
"delete-successful": "Dossier {dossierName} was deleted.", "delete-successful": "Dossier {dossierName} was deleted.",
"dictionary": { "dictionary": {
"entries": "{length} {length, plural, one{entry} other{entries}} to redact", "entries": "{length} {length, plural, one{entry} other{entries}} to {hint, select, true{annotate} other{redact}}",
"false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}", "false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}",
"false-positives": "False Positives", "false-positives": "False Positives",
"false-recommendation-entries": "{length} false recommendation {length, plural, one{entry} other{entries}}", "false-recommendation-entries": "{length} false recommendation {length, plural, one{entry} other{entries}}",

View File

@ -1187,7 +1187,7 @@
"change-successful": "Dossier {dossierName} was updated.", "change-successful": "Dossier {dossierName} was updated.",
"delete-successful": "Dossier {dossierName} was deleted.", "delete-successful": "Dossier {dossierName} was deleted.",
"dictionary": { "dictionary": {
"entries": "{length} {length, plural, one{entry} other{entries}} to redact", "entries": "{length} {length, plural, one{entry} other{entries}} to {hint, select, true{annotate} other{redact}}",
"false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}", "false-positive-entries": "{length} false positive {length, plural, one{entry} other{entries}}",
"false-positives": "False Positives", "false-positives": "False Positives",
"false-recommendation-entries": "{length} false recommendation {length, plural, one{entry} other{entries}}", "false-recommendation-entries": "{length} false recommendation {length, plural, one{entry} other{entries}}",