tobias-istvan closed pull request #50: [AMBARI-24975] Log Search UI: if there are multiple clusters - selecting one of it does not do anything URL: https://github.com/apache/ambari-logsearch/pull/50
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/ambari-logsearch-web/src/app/modules/shared/components/dropdown-list/dropdown-list.component.html b/ambari-logsearch-web/src/app/modules/shared/components/dropdown-list/dropdown-list.component.html index 6cea2a114a..cc790aba03 100644 --- a/ambari-logsearch-web/src/app/modules/shared/components/dropdown-list/dropdown-list.component.html +++ b/ambari-logsearch-web/src/app/modules/shared/components/dropdown-list/dropdown-list.component.html @@ -19,7 +19,7 @@ [attr.role]="item.isDivider ? 'separator' : null" [ngClass]="(item.cssClass || '')" (click)="onItemClick($event)"> <ng-container *ngIf="!item.isDivider"> <span class="list-item-label" *ngIf="isMultipleChoice"> - <input type="checkbox" [attr.id]="(instanceId) + '-' + (item.id || item.value)" [(ngModel)]="item.isChecked" + <input type="checkbox" [attr.id]="(instanceId) + '-' + (item.id || item.value)" [ngModel]="item.isChecked" (change)="changeSelectedItem({value: item.value, isChecked: $event.currentTarget.checked}, $event)"> <label [attr.for]="(instanceId) + '-' + (item.id || item.value)" class="label-container"> <span *ngIf="item.iconClass" [ngClass]="item.iconClass"></span> diff --git a/ambari-logsearch-web/src/app/modules/shared/components/dropdown-list/dropdown-list.component.ts b/ambari-logsearch-web/src/app/modules/shared/components/dropdown-list/dropdown-list.component.ts index 8be7e648ae..4db1bc58e1 100644 --- a/ambari-logsearch-web/src/app/modules/shared/components/dropdown-list/dropdown-list.component.ts +++ b/ambari-logsearch-web/src/app/modules/shared/components/dropdown-list/dropdown-list.component.ts @@ -175,20 +175,17 @@ export class DropdownListComponent implements OnInit, OnChanges, AfterViewChecke } selectAll() { - this.items.forEach((item: ListItem) => { - item.isChecked = true; - if (item.onSelect) { - item.onSelect(...this.actionArguments); - } - }); - this.selectedItemChange.emit(this.items); + this.changeSelectedItem(this.items.map((item: ListItem) => ({ + ...item, + isChecked: true + }))); } unSelectAll() { - this.items.forEach((item: ListItem) => { - item.isChecked = false; - }); - this.selectedItemChange.emit(this.items); + this.changeSelectedItem(this.items.map((item: ListItem) => ({ + ...item, + isChecked: false + }))); } private onFilterInputKeyUp(event) { @@ -223,10 +220,12 @@ export class DropdownListComponent implements OnInit, OnChanges, AfterViewChecke } } - changeSelectedItem(item: ListItem, event?: MouseEvent): void { - if (item.onSelect) { - item.onSelect(...this.actionArguments); - } + changeSelectedItem(item: ListItem | ListItem[], event?: MouseEvent): void { + (Array.isArray(item) ? item : [item]).forEach((currentItem: ListItem) => { + if (currentItem.onSelect) { + currentItem.onSelect(...this.actionArguments) + } + }); this.selectedItemChange.emit(item); } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services