From 58f991aaa1f7245c477381cc117b46b64474255c Mon Sep 17 00:00:00 2001 From: lotte Date: Thu, 27 Jun 2019 13:31:44 +0200 Subject: [PATCH] 62849: added search results to lookup window with checkboxes --- src/app/core/data/paginated-list.ts | 2 +- ...namic-lookup-relation-modal.component.html | 31 +++++++++++++++---- ...namic-lookup-relation-modal.component.scss | 3 ++ ...dynamic-lookup-relation-modal.component.ts | 18 ++++++++--- 4 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.scss diff --git a/src/app/core/data/paginated-list.ts b/src/app/core/data/paginated-list.ts index e1c1b22569..b9de67a34d 100644 --- a/src/app/core/data/paginated-list.ts +++ b/src/app/core/data/paginated-list.ts @@ -3,7 +3,7 @@ import { hasValue } from '../../shared/empty.util'; export class PaginatedList { - constructor(private pageInfo: PageInfo, + constructor(public pageInfo: PageInfo, public page: T[]) { } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.html index 6c8aeb1d95..593f4e543c 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.html @@ -1,7 +1,26 @@ -
- LOOKUP WINDOW FOR {{relationKey}} - +
+
+
+
+
+
+ +
    +
  • + + +
  • +
+
+
+
+
+
+
\ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.scss b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.scss new file mode 100644 index 0000000000..9e748833f9 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.scss @@ -0,0 +1,3 @@ +.result-list-element { + flex: 1; +} \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.ts index 529004c930..0834696641 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup-relation/dynamic-lookup-relation-modal.component.ts @@ -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>>>; + 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