mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
62849: added search results to lookup window with checkboxes
This commit is contained in:
@@ -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[]) {
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,26 @@
|
||||
<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>
|
@@ -0,0 +1,3 @@
|
||||
.result-list-element {
|
||||
flex: 1;
|
||||
}
|
@@ -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() {}
|
||||
}
|
Reference in New Issue
Block a user