Skip to content

Commit

Permalink
Merge pull request #2396 from alexandrevryghem/w2p-104312_pass-query-…
Browse files Browse the repository at this point in the history
…to-external-search-tabs_contribute-maintenance-7.6

[Port dspace-7_x] Search query is not set by default when opening an external sources tab
  • Loading branch information
tdonohue authored Sep 7, 2023
2 parents d14e258 + 5062e46 commit b46390c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ <h4 class="modal-title" id="modal-title">{{ ('submission.sections.describe.relat
[collection]="collection"
[relationship]="relationshipOptions"
[context]="context"
[query]="query"
[externalSource]="source"
(importedObject)="imported($event)"
class="d-block pt-3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ export class DsDynamicLookupRelationExternalSourceTabComponent implements OnInit
* The context to displaying lists for
*/
@Input() context: Context;

/**
* The search query
*/
@Input() query: string;

@Input() repeatable: boolean;
/**
* Emit an event when an object has been imported (or selected from similar local entries)
Expand Down Expand Up @@ -149,8 +155,12 @@ export class DsDynamicLookupRelationExternalSourceTabComponent implements OnInit

this.resetRoute();
this.entriesRD$ = this.searchConfigService.paginatedSearchOptions.pipe(
switchMap((searchOptions: PaginatedSearchOptions) =>
this.externalSourceService.getExternalSourceEntries(this.externalSource.id, searchOptions).pipe(startWith(undefined)))
switchMap((searchOptions: PaginatedSearchOptions) => {
if (searchOptions.query === '') {
searchOptions.query = this.query;
}
return this.externalSourceService.getExternalSourceEntries(this.externalSource.id, searchOptions).pipe(startWith(undefined));
})
);
this.currentPagination$ = this.paginationService.getCurrentPagination(this.searchConfigService.paginationID, this.initialPagination);
this.importConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { DsDynamicLookupRelationExternalSourceTabComponent } from './dynamic-loo
})
export class ThemedDynamicLookupRelationExternalSourceTabComponent extends ThemedComponent<DsDynamicLookupRelationExternalSourceTabComponent> {
protected inAndOutputNames: (keyof DsDynamicLookupRelationExternalSourceTabComponent & keyof this)[] = ['label', 'listId',
'item', 'collection', 'relationship', 'context', 'repeatable', 'importedObject', 'externalSource'];
'item', 'collection', 'relationship', 'context', 'query', 'repeatable', 'importedObject', 'externalSource'];

@Input() label: string;

Expand All @@ -29,6 +29,8 @@ export class ThemedDynamicLookupRelationExternalSourceTabComponent extends Theme

@Input() context: Context;

@Input() query: string;

@Input() repeatable: boolean;

@Output() importedObject: EventEmitter<ListableObject> = new EventEmitter();
Expand Down

0 comments on commit b46390c

Please sign in to comment.