Skip to content

Commit 13202ad

Browse files
author
Salim Terres
committed
Bug #15299 - [Search + Collect] "ORPHANS_NODE" is displayed when selecting the "No attachment" checkbox.
1 parent 42220fc commit 13202ad

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

ui/ui-frontend/projects/archive-search/src/app/archive/criteria-search/criteria-search.component.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,7 @@
237237
? ('ARCHIVE_SEARCH.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaVal.key | translate)
238238
: criteriaVal.key
239239
}}:{{
240-
criteriaValue.valueTranslated
241-
? ('ARCHIVE_SEARCH.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaValue.label
242-
| translate)
243-
: criteriaVal.key === 'ALL_ARCHIVE_UNIT_TYPES'
244-
? criteriaValue.label
245-
: criteriaValue.value.value
240+
getCriteriaLabel(criteriaVal.key, criteriaValue)
246241
}}"
247242
matTooltipClass="vitamui-tooltip"
248243
[matTooltipShowDelay]="300"

ui/ui-frontend/projects/archive-search/src/app/archive/criteria-search/criteria-search.component.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@
3636
*/
3737
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
3838
import { CriteriaSearchCriteria, CriteriaValue, SearchCriteriaTypeEnum, SearchCriteriaValue } from 'vitamui-library';
39+
import { TranslateService } from '@ngx-translate/core';
3940

4041
@Component({
4142
selector: 'app-criteria-search',
4243
templateUrl: './criteria-search.component.html',
4344
styleUrls: ['./criteria-search.component.scss'],
4445
})
4546
export class CriteriaSearchComponent implements OnInit {
46-
constructor() {}
47+
constructor(private translateService: TranslateService) {}
4748

4849
ngOnInit() {
4950
if (this.criteriaVal) {
@@ -74,6 +75,14 @@ export class CriteriaSearchComponent implements OnInit {
7475
}
7576

7677
getCriteriaLabel(key: string, criteriaValue: SearchCriteriaValue): string {
77-
return key === 'ALL_ARCHIVE_UNIT_TYPES' ? criteriaValue.label : criteriaValue.value.value;
78+
if (key === 'ALL_ARCHIVE_UNIT_TYPES') {
79+
return criteriaValue.keyTranslated
80+
? this.translateService.instant('ARCHIVE_SEARCH.SEARCH_CRITERIA_FILTER.FIELDS.' + criteriaValue.label)
81+
: criteriaValue.label;
82+
}
83+
if (key === 'ORPHANS_NODE') {
84+
return this.translateService.instant('ARCHIVE_SEARCH.FILING_SCHEMA.ORPHANS_NODE');
85+
}
86+
return criteriaValue.value?.value ?? '';
7887
}
7988
}

ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/criteria-search/criteria-search.component.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,7 @@
236236
? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaVal.key | translate)
237237
: criteriaVal.key
238238
}}:{{
239-
criteriaValue.valueTranslated
240-
? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaValue.label | translate)
241-
: criteriaValue.label
239+
getCriteriaLabel(criteriaVal.key, criteriaValue)
242240
}}"
243241
matTooltipClass="vitamui-tooltip"
244242
[matTooltipShowDelay]="300"
@@ -259,7 +257,7 @@
259257
{{
260258
criteriaValue.valueTranslated
261259
? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaValue.label | translate)
262-
: (criteriaValue.label | truncate: 50)
260+
: (getCriteriaLabel(criteriaVal.key, criteriaValue) | truncate: 50)
263261
}}
264262
</div>
265263
<div

ui/ui-frontend/projects/collect/src/app/collect/archive-search-collect/archive-search-criteria/components/criteria-search/criteria-search.component.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@
3636
*/
3737

3838
import { Component, EventEmitter, Input, Output } from '@angular/core';
39-
import { CriteriaSearchCriteria, CriteriaValue, SearchCriteriaTypeEnum } from 'vitamui-library';
39+
import { TranslateService } from '@ngx-translate/core';
40+
import { CriteriaSearchCriteria, CriteriaValue, SearchCriteriaTypeEnum, SearchCriteriaValue } from 'vitamui-library';
4041

4142
@Component({
4243
selector: 'app-criteria-search',
4344
templateUrl: './criteria-search.component.html',
4445
styleUrls: ['./criteria-search.component.scss'],
4546
})
4647
export class CriteriaSearchComponent {
47-
constructor() {}
48+
constructor(private translateService: TranslateService) {}
4849

4950
@Input()
5051
criteriaKey: string;
@@ -67,4 +68,16 @@ export class CriteriaSearchComponent {
6768
this.removeCriteria(keyElt, value.value);
6869
});
6970
}
71+
72+
getCriteriaLabel(key: string, criteriaValue: SearchCriteriaValue): string {
73+
if (key === 'ALL_ARCHIVE_UNIT_TYPES') {
74+
return criteriaValue.keyTranslated
75+
? this.translateService.instant('COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.' + criteriaValue.label)
76+
: criteriaValue.label;
77+
}
78+
if (key === 'ORPHANS_NODE') {
79+
return this.translateService.instant('COLLECT.FILING_SCHEMA.ORPHANS_NODE');
80+
}
81+
return criteriaValue.value?.value ?? '';
82+
}
7083
}

0 commit comments

Comments
 (0)