From: Jane Sandberg Date: Fri, 26 Feb 2021 01:04:13 +0000 (-0800) Subject: LP1916949: combobox asyncSupportsEmptyTermClick works again X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=717eb28756fc6d53cd891aefcfd9a9caf83ba8e4;p=working%2FEvergreen.git LP1916949: combobox asyncSupportsEmptyTermClick works again This fixes two lines that were getting in the way of the desired behavior of opening an async combobox (particularly those automagical pcrud ones with an idlClass input) on user click when asyncSupportsEmptyTermClick="true". Basically, the addAsyncEntries method would accept _CLICK_ as a search term. However, it would then return '' instead of _CLICK_ as an Observable value, so the filter method had no idea it was a click event. Additionally, even if _CLICK_ had gotten through to the filter method, it wasn't allowed to display those freshly-fetched pcrud values, since asyncDataSources with searchterm _CLICK_ were needlessly excluded. Also removes some imports that are no longer needed, just to keep things tidy. To test: 1) Apply this patch. 2) Go to Booking > Create Reservation 3) Click inside the Resource Type box. 4) Note that the available resource types display! To make sure that asyncSupportsEmptyTermClick="false" still also works as expected: 5) Go to Acquisitions > General Search. 6) Perform an empty search. 7) In the search results grid, some filter comboboxes have asyncSupportsEmptyTermClick, while others do not. For example, the Status column has it, so if you click in the Status filter, a list of possible statuses will show up. However, the Selecting User column (you have to enable this column) does not have it, so if you click in that filter, it doesn't automatically display a useless list of 100 users. Signed-off-by: Jane Sandberg Signed-off-by: Terran McCanna --- diff --git a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts index d21ad5f916..141850534e 100644 --- a/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts +++ b/Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts @@ -9,9 +9,8 @@ import {Component, OnInit, Input, Output, ViewChild, TemplateRef, EventEmitter, ElementRef, forwardRef} from '@angular/core'; import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms'; import {Observable, of, Subject} from 'rxjs'; -import {map, tap, reduce, mergeMap, mapTo, debounceTime, distinctUntilChanged, merge, filter} from 'rxjs/operators'; +import {map, mergeMap, mapTo, debounceTime, distinctUntilChanged, merge, filter} from 'rxjs/operators'; import {NgbTypeahead, NgbTypeaheadSelectItemEvent} from '@ng-bootstrap/ng-bootstrap'; -import {StoreService} from '@eg/core/store.service'; import {IdlService, IdlObject} from '@eg/core/idl.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {OrgService} from '@eg/core/org.service'; @@ -181,7 +180,6 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie constructor( private elm: ElementRef, - private store: StoreService, private idl: IdlService, private pcrud: PcrudService, private org: OrgService, @@ -457,7 +455,7 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie (entry: ComboboxEntry) => this.addAsyncEntry(entry), err => {}, () => { - observer.next(searchTerm); + observer.next(term); observer.complete(); } ); @@ -487,8 +485,8 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie // click action occurred. if (term === '') { return []; } - // In sync-data mode, a click displays the full list. - if (term === '_CLICK_' && !this.asyncDataSource) { + // A click displays the full list. + if (term === '_CLICK_') { return this.entrylist; }