Skip to content

Commit d6dc5e2

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

File tree

4 files changed

+58
-48
lines changed

4 files changed

+58
-48
lines changed

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

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,7 @@
232232
<ng-container *ngFor="let criteriaValue of criteriaVal.values; let index = index; let isFirst = first; let isLast = last">
233233
<div
234234
class="vitamui-search-criteria-content"
235-
matTooltip="{{
236-
criteriaValue.keyTranslated
237-
? ('ARCHIVE_SEARCH.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaVal.key | translate)
238-
: criteriaVal.key
239-
}}:{{
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
246-
}}"
235+
matTooltip="{{ getCriteriaKeyLabel(criteriaValue) + ' : ' + getCriteriaLabel(criteriaVal.key, criteriaValue) }}"
247236
matTooltipClass="vitamui-tooltip"
248237
[matTooltipShowDelay]="300"
249238
[ngClass]="[
@@ -254,20 +243,10 @@
254243
>
255244
<ng-container *ngIf="isFirst">
256245
<i *ngIf="criteriaKey === 'NODE'" class="vitamui-icon vitamui-icon-radio-checked vitamui-row-icon"></i>
257-
{{
258-
(criteriaValue.keyTranslated
259-
? ('ARCHIVE_SEARCH.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaVal.key
260-
| translate)
261-
: criteriaVal.key) + ' : '
262-
}}
246+
{{ getCriteriaKeyLabel(criteriaValue) + ' : ' }}
263247
</ng-container>
264248

265-
{{
266-
criteriaValue.valueTranslated
267-
? ('ARCHIVE_SEARCH.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaValue.label
268-
| translate)
269-
: (getCriteriaLabel(criteriaVal.key, criteriaValue) | truncate: 50)
270-
}}
249+
{{ getCriteriaLabel(criteriaVal.key, criteriaValue) | truncate: 50 }}
271250
</div>
272251
<div
273252
class="vitamui-remove-search-criteria"

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636
*/
3737
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
3838
import { CriteriaSearchCriteria, CriteriaValue, SearchCriteriaTypeEnum, SearchCriteriaValue } from 'vitamui-library';
39-
39+
import { TranslateService } from '@ngx-translate/core';
4040
@Component({
4141
selector: 'app-criteria-search',
4242
templateUrl: './criteria-search.component.html',
4343
styleUrls: ['./criteria-search.component.scss'],
4444
})
4545
export class CriteriaSearchComponent implements OnInit {
46-
constructor() {}
46+
constructor(private translateService: TranslateService) {}
4747

4848
ngOnInit() {
4949
if (this.criteriaVal) {
@@ -73,7 +73,28 @@ export class CriteriaSearchComponent implements OnInit {
7373
});
7474
}
7575

76+
getCriteriaKeyLabel(criteriaValue: SearchCriteriaValue): string {
77+
if (criteriaValue.keyTranslated) {
78+
const translationKey = `ARCHIVE_SEARCH.SEARCH_CRITERIA_FILTER.${this.getCategoryName(this.criteriaVal.category)}.${this.criteriaVal.key}`;
79+
return this.translateService.instant(translationKey);
80+
}
81+
return this.criteriaVal.key;
82+
}
83+
7684
getCriteriaLabel(key: string, criteriaValue: SearchCriteriaValue): string {
77-
return key === 'ALL_ARCHIVE_UNIT_TYPES' ? criteriaValue.label : criteriaValue.value.value;
85+
if (criteriaValue.valueTranslated) {
86+
return this.translateService.instant(
87+
`ARCHIVE_SEARCH.SEARCH_CRITERIA_FILTER.${this.getCategoryName(this.criteriaVal.category)}.${criteriaValue.label}`,
88+
);
89+
}
90+
if (key === 'ALL_ARCHIVE_UNIT_TYPES') {
91+
return criteriaValue.keyTranslated
92+
? this.translateService.instant(`ARCHIVE_SEARCH.SEARCH_CRITERIA_FILTER.FIELDS.${criteriaValue.label}`)
93+
: criteriaValue.label;
94+
}
95+
if (key === 'ORPHANS_NODE') {
96+
return this.translateService.instant('ARCHIVE_SEARCH.FILING_SCHEMA.ORPHANS_NODE');
97+
}
98+
return criteriaValue.value?.value ?? '';
7899
}
79100
}

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,7 @@
231231
<ng-container *ngFor="let criteriaValue of criteriaVal.values; let index = index; let isFirst = first; let isLast = last">
232232
<div
233233
class="button-content right-button"
234-
matTooltip="{{
235-
criteriaValue.keyTranslated
236-
? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaVal.key | translate)
237-
: criteriaVal.key
238-
}}:{{
239-
criteriaValue.valueTranslated
240-
? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaValue.label | translate)
241-
: criteriaValue.label
242-
}}"
234+
matTooltip="{{ getCriteriaKeyLabel(criteriaValue) + ' : ' + getCriteriaLabel(criteriaVal.key, criteriaValue) }}"
243235
matTooltipClass="vitamui-tooltip"
244236
[matTooltipShowDelay]="300"
245237
[ngClass]="[
@@ -249,18 +241,10 @@
249241
>
250242
<ng-container *ngIf="isFirst">
251243
<i *ngIf="criteriaKey === 'NODE'" class="vitamui-icon vitamui-icon-radio-checked vitamui-row-icon"></i>
252-
{{
253-
(criteriaValue.keyTranslated
254-
? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaVal.key | translate)
255-
: criteriaVal.key) + ' : '
256-
}}
244+
{{ getCriteriaKeyLabel(criteriaValue) + ' : ' }}
257245
</ng-container>
258246

259-
{{
260-
criteriaValue.valueTranslated
261-
? ('COLLECT.SEARCH_CRITERIA_FILTER.' + getCategoryName(criteriaVal.category) + '.' + criteriaValue.label | translate)
262-
: (criteriaValue.label | truncate: 50)
263-
}}
247+
{{ getCriteriaLabel(criteriaVal.key, criteriaValue) | truncate: 50 }}
264248
</div>
265249
<div
266250
class="vitamui-remove-search-criteria"

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

Lines changed: 28 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,29 @@ export class CriteriaSearchComponent {
6768
this.removeCriteria(keyElt, value.value);
6869
});
6970
}
71+
72+
getCriteriaKeyLabel(criteriaValue: SearchCriteriaValue): string {
73+
if (criteriaValue.keyTranslated) {
74+
const translationKey = `COLLECT.SEARCH_CRITERIA_FILTER.${this.getCategoryName(this.criteriaVal.category)}.${this.criteriaVal.key}`;
75+
return this.translateService.instant(translationKey);
76+
}
77+
return this.criteriaVal.key;
78+
}
79+
80+
getCriteriaLabel(key: string, criteriaValue: SearchCriteriaValue): string {
81+
if (criteriaValue.valueTranslated) {
82+
return this.translateService.instant(
83+
`COLLECT.SEARCH_CRITERIA_FILTER.${this.getCategoryName(this.criteriaVal.category)}.${criteriaValue.label}`,
84+
);
85+
}
86+
if (key === 'ALL_ARCHIVE_UNIT_TYPES') {
87+
return criteriaValue.keyTranslated
88+
? this.translateService.instant(`COLLECT.SEARCH_CRITERIA_FILTER.FIELDS.${criteriaValue.label}`)
89+
: criteriaValue.label;
90+
}
91+
if (key === 'ORPHANS_NODE') {
92+
return this.translateService.instant('COLLECT.FILING_SCHEMA.ORPHANS_NODE');
93+
}
94+
return criteriaValue.value?.value ?? '';
95+
}
7096
}

0 commit comments

Comments
 (0)