This is an automated email from the ASF dual-hosted git repository. hshpak pushed a commit to branch feat/DATALAB-2881/filter-function-to-Images-page in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit d76950a8e760b5f138cb24bc14a642548c5af915 Author: Hennadii_Shpak <[email protected]> AuthorDate: Tue Aug 2 17:53:49 2022 +0300 fixed pipe for dropdown --- .../normalize-dropdown-multi-value.pipe.ts | 11 ++++++----- .../exploratory/page-filter/page-filter.component.html | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/services/self-service/src/main/resources/webapp/src/app/core/pipes/normalize-dropdown-multi-value/normalize-dropdown-multi-value.pipe.ts b/services/self-service/src/main/resources/webapp/src/app/core/pipes/normalize-dropdown-multi-value/normalize-dropdown-multi-value.pipe.ts index 0f871e1e8..370b0e8b0 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/pipes/normalize-dropdown-multi-value/normalize-dropdown-multi-value.pipe.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/pipes/normalize-dropdown-multi-value/normalize-dropdown-multi-value.pipe.ts @@ -22,17 +22,18 @@ import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'normalizeDropdownMultiValue' }) export class NormalizeDropdownMultiValuePipe implements PipeTransform { - transform(value: string[], meaninglessValue: number = 0): string { + transform(value: string[], meaninglessValue: string = ''): string { if (!value.length) { return ''; } - const [firstValue] = value; - if (value.length === 1) { + const filteredList = value.filter(item => item !== meaninglessValue); + const [firstValue] = filteredList; + if (filteredList.length === 1) { return firstValue; } - return value.length === 1 + return filteredList.length === 1 ? firstValue - : `${firstValue} (+${value.length - meaninglessValue} others)`; + : `${firstValue} (+${filteredList.length - 1} others)`; } } diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/page-filter/page-filter.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/page-filter/page-filter.component.html index 15bcdeeb0..32a6d81b8 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/page-filter/page-filter.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/page-filter/page-filter.component.html @@ -51,7 +51,7 @@ (click)="onSelectClick()" > <mat-select-trigger class="select__value"> - {{statuses.value | normalizeDropdownMultiValue: 2 | titlecase}} + {{statuses.value | normalizeDropdownMultiValue: selectAllValue | titlecase}} </mat-select-trigger> <mat-option *ngIf="($filterDropdownData | async).statuses.length > 1" @@ -90,7 +90,7 @@ (click)="onSelectClick()" > <mat-select-trigger class="select__value"> - {{endpoints.value | normalizeDropdownMultiValue: 2}} + {{endpoints.value | normalizeDropdownMultiValue: selectAllValue}} </mat-select-trigger> <mat-option *ngIf="($filterDropdownData | async).endpoints.length > 1" @@ -129,7 +129,7 @@ (click)="onSelectClick()" > <mat-select-trigger class="select__value"> - {{templateNames.value | normalizeDropdownMultiValue: 2}} + {{templateNames.value | normalizeDropdownMultiValue: selectAllValue}} </mat-select-trigger> <mat-option *ngIf="($filterDropdownData | async).templateNames.length > 1" @@ -168,7 +168,7 @@ (click)="onSelectClick()" > <mat-select-trigger class="select__value"> - {{sharingStatuses.value | normalizeDropdownMultiValue: 2 | titlecase}} + {{sharingStatuses.value | normalizeDropdownMultiValue: selectAllValue | titlecase}} </mat-select-trigger> <mat-option *ngIf="($filterDropdownData | async).sharingStatuses.length > 1" --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
