mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +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> {
|
export class PaginatedList<T> {
|
||||||
|
|
||||||
constructor(private pageInfo: PageInfo,
|
constructor(public pageInfo: PageInfo,
|
||||||
public page: T[]) {
|
public page: T[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,26 @@
|
|||||||
<div>
|
<div class="container">
|
||||||
LOOKUP WINDOW FOR {{relationKey}}
|
<div class="search-page row">
|
||||||
<ds-search-results [searchResults]="resultsRD$ | async"
|
<div class="col-12">
|
||||||
[searchConfig]="{}"
|
<div class="row">
|
||||||
[fixedFilter]="relationKey"
|
<div id="search-body">
|
||||||
[disableHeader]="true"></ds-search-results>
|
<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>
|
</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 { SearchService } from '../../../../../../+search-page/search-service/search.service';
|
||||||
import { PaginatedSearchOptions } from '../../../../../../+search-page/paginated-search-options.model';
|
import { PaginatedSearchOptions } from '../../../../../../+search-page/paginated-search-options.model';
|
||||||
import { DSpaceObject } from '../../../../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../../../../core/shared/dspace-object.model';
|
||||||
|
import { PaginationComponentOptions } from '../../../../../pagination/pagination-component-options.model';
|
||||||
|
|
||||||
const RELATION_TYPE_FILTER_PREFIX = 'f.entityType=';
|
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({
|
@Component({
|
||||||
selector: 'ds-dynamic-lookup-relation-modal',
|
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'
|
templateUrl: './dynamic-lookup-relation-modal.component.html'
|
||||||
})
|
})
|
||||||
export class DsDynamicLookupRelationModalComponent implements OnInit {
|
export class DsDynamicLookupRelationModalComponent implements OnInit {
|
||||||
relationKey: string;
|
relationKey: string;
|
||||||
resultsRD$: Observable<RemoteData<PaginatedList<SearchResult<DSpaceObject>>>>;
|
resultsRD$: Observable<RemoteData<PaginatedList<SearchResult<DSpaceObject>>>>;
|
||||||
|
searchConfig: PaginatedSearchOptions;
|
||||||
|
|
||||||
constructor(private searchService: SearchService) {
|
constructor(private searchService: SearchService) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.resultsRD$ = this.searchService.search(
|
const pagination = Object.assign(new PaginationComponentOptions(), { pageSize: 5 });
|
||||||
new PaginatedSearchOptions({ fixedFilter: RELATION_TYPE_FILTER_PREFIX + this.relationKey }));
|
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