Skip to content

Commit

Permalink
97257 findItemsWithEdit now no longer ignores query parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Koen Pauwels committed Dec 14, 2022
1 parent c15481f commit 0625a91
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/app/core/data/item-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ export abstract class BaseItemDataService extends IdentifiableDataService<Item>
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
* {@link HALLink}s should be automatically resolved
*/
public findItemsWithEdit(options: FindListOptions, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Item>[]): Observable<RemoteData<PaginatedList<Item>>> {
public findItemsWithEdit(query: string, options: FindListOptions, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Item>[]): Observable<RemoteData<PaginatedList<Item>>> {
options = { ...options, searchParams: [new RequestParam('query', query)] };
return this.searchBy('findItemsWithEdit', options, useCachedVersionIfAvailable, reRequestOnStale );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ export class DSOSelectorComponent implements OnInit, OnDestroy {
if (rd.hasSucceeded) {
// If it's the first page and no query is entered, add the current DSO to the start of the list
// If no query is entered, filter out the current DSO from the results, as it'll be displayed at the start of the list already
const part1 = ((isEmpty(query) && page === 1) ? currentDSOResult.page : []);
const part2 = rd.payload.page.filter((result) => isNotEmpty(query) || result.indexableObject.id !== this.currentDSOId);
rd.payload.page = [
...((isEmpty(query) && page === 1) ? currentDSOResult.page : []),
...rd.payload.page.filter((result) => isNotEmpty(query) || result.indexableObject.id !== this.currentDSOId)
...part1, ...part2
];
} else if (rd.hasFailed) {
this.notifcationsService.error(this.translate.instant('dso-selector.error.title', { type: this.typesString }), rd.errorMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class EditableItemSelectorComponent extends DSOSelectorComponent {
currentPage: page,
elementsPerPage: this.defaultPagination.pageSize
};
return this.itemDataService.findItemsWithEdit(findOptions, false, false, followLink('owningCollection')).pipe(
return this.itemDataService.findItemsWithEdit(query, findOptions, true, true, followLink('owningCollection')).pipe(
getFirstCompletedRemoteData(),
tap((rdata) => console.log('TAPPEDITAP:', rdata)), // XXX
mapRemoteDataPayload((payload) => hasValue(payload)
Expand Down

0 comments on commit 0625a91

Please sign in to comment.