Skip to content
Snippets Groups Projects
Commit 58f991aa authored by lotte's avatar lotte
Browse files

62849: added search results to lookup window with checkboxes

parent 96959b40
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ import { hasValue } from '../../shared/empty.util';
export class PaginatedList<T> {
constructor(private pageInfo: PageInfo,
constructor(public pageInfo: PageInfo,
public page: T[]) {
}
......
<div>
LOOKUP WINDOW FOR {{relationKey}}
<ds-search-results [searchResults]="resultsRD$ | async"
[searchConfig]="{}"
[fixedFilter]="relationKey"
[disableHeader]="true"></ds-search-results>
<div class="container">
<div class="search-page row">
<div class="col-12">
<div class="row">
<div id="search-body">
<div id="search-content" class="col-12" *ngVar="(resultsRD$ | async) as resultsRD">
<ds-pagination
[paginationOptions]="searchConfig.pagination"
[collectionSize]="resultsRD?.payload?.totalElements"
[sortOptions]="searchConfig.sort"
[hideGear]="true"
[hidePagerWhenSinglePage]="true"
(paginationChange)="onPaginationChange($event)">
<ul class="lookup-results list-unstyled">
<li *ngFor="let result of resultsRD?.payload?.page; let i = index" class="my-4 d-flex">
<input type="checkbox" [value]="result.indexableObject.uuid"/>
<ds-wrapper-list-element class="result-list-element" [object]="result" [index]="i"></ds-wrapper-list-element>
</li>
</ul>
</ds-pagination>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
.result-list-element {
flex: 1;
}
\ No newline at end of file
......@@ -6,24 +6,34 @@ import { Observable } from 'rxjs';
import { SearchService } from '../../../../../../+search-page/search-service/search.service';
import { PaginatedSearchOptions } from '../../../../../../+search-page/paginated-search-options.model';
import { DSpaceObject } from '../../../../../../core/shared/dspace-object.model';
import { PaginationComponentOptions } from '../../../../../pagination/pagination-component-options.model';
const RELATION_TYPE_FILTER_PREFIX = 'f.entityType=';
/* TODO take a look at this when the REST entities submission is finished: we will probably need to get the fixed filter from the REST instead of filtering is out from the metadata field */
const RELATION_TYPE_METADATA_PREFIX = 'relation.isPublicationOf';
@Component({
selector: 'ds-dynamic-lookup-relation-modal',
// styleUrls: ['./dynamic-lookup-relation-modal.component.scss'],
styleUrls: ['./dynamic-lookup-relation-modal.component.scss'],
templateUrl: './dynamic-lookup-relation-modal.component.html'
})
export class DsDynamicLookupRelationModalComponent implements OnInit {
relationKey: string;
resultsRD$: Observable<RemoteData<PaginatedList<SearchResult<DSpaceObject>>>>;
searchConfig: PaginatedSearchOptions;
constructor(private searchService: SearchService) {
}
ngOnInit(): void {
this.resultsRD$ = this.searchService.search(
new PaginatedSearchOptions({ fixedFilter: RELATION_TYPE_FILTER_PREFIX + this.relationKey }));
const pagination = Object.assign(new PaginationComponentOptions(), { pageSize: 5 });
this.searchConfig = new PaginatedSearchOptions({
pagination: pagination,
fixedFilter: RELATION_TYPE_FILTER_PREFIX + this.relationKey.substring(RELATION_TYPE_METADATA_PREFIX.length)
});
this.resultsRD$ = this.searchService.search(this.searchConfig);
}
onPaginationChange() {}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment