55693: Intermediate commit

This commit is contained in:
Kristof De Langhe
2018-09-26 11:02:11 +02:00
parent 6b986c8c91
commit 315b6a9690
4 changed files with 42 additions and 26 deletions

View File

@@ -35,7 +35,7 @@
<!-- Map Tab --> <!-- Map Tab -->
<div *ngIf="activeTab == 1" id="tab-map"> <div *ngIf="activeTab == 1" id="tab-map">
<ds-item-select [items$]="mappingItemsRD$"></ds-item-select> <ds-item-select [itemsRD$]="mappingItemsRD$" [paginationOptions]="(searchOptions$ | async)?.pagination"></ds-item-select>
</div> </div>
</div> </div>

View File

@@ -49,13 +49,18 @@ export class CollectionItemMapperComponent implements OnInit {
combineLatest(this.searchOptions$), combineLatest(this.searchOptions$),
flatMap(([collectionRD, options]) => { flatMap(([collectionRD, options]) => {
return this.searchService.search(Object.assign(options, { return this.searchService.search(Object.assign(options, {
scope: collectionRD.payload.id scope: collectionRD.payload.id,
dsoType: DSpaceObjectType.ITEM
})); }));
}), }),
toDSpaceObjectListRD() toDSpaceObjectListRD()
); );
this.mappingItemsRD$ = this.searchOptions$.pipe( this.mappingItemsRD$ = this.searchOptions$.pipe(
flatMap((options: PaginatedSearchOptions) => this.searchService.search(options)), flatMap((options: PaginatedSearchOptions) => {
return this.searchService.search(Object.assign(options, {
dsoType: DSpaceObjectType.ITEM
}));
}),
toDSpaceObjectListRD() toDSpaceObjectListRD()
); );
} }

View File

@@ -1,4 +1,10 @@
<div class="table-responsive"> <ds-pagination
*ngIf="(itemsRD$ | async)?.payload?.totalElements > 0"
[paginationOptions]="paginationOptions"
[pageInfoState]="(itemsRD$ | async)?.payload"
[collectionSize]="(itemsRD$ | async)?.payload?.totalElements"
[hidePagerWhenSinglePage]="true">
<div class="table-responsive">
<table id="item-select" class="table table-striped table-hover"> <table id="item-select" class="table table-striped table-hover">
<thead> <thead>
<tr> <tr>
@@ -9,7 +15,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let item of (items$ | async)?.payload?.page ; let i = index"> <tr *ngFor="let item of (itemsRD$ | async)?.payload?.page ; let i = index">
<td><input [(ngModel)]="checked[i]" type="checkbox"></td> <td><input [(ngModel)]="checked[i]" type="checkbox"></td>
<td><a [routerLink]="['/items', item.id]">{{(item.owningCollection | async)?.payload?.name}}</a></td> <td><a [routerLink]="['/items', item.id]">{{(item.owningCollection | async)?.payload?.name}}</a></td>
<td><a [routerLink]="['/items', item.id]">{{item.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])[0].value}}</a></td> <td><a [routerLink]="['/items', item.id]">{{item.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])[0].value}}</a></td>
@@ -17,4 +23,5 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</ds-pagination>

View File

@@ -1,9 +1,10 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ItemDataService } from '../../core/data/item-data.service'; import { ItemDataService } from '../../core/data/item-data.service';
import { PaginatedList } from '../../core/data/paginated-list'; import { PaginatedList } from '../../core/data/paginated-list';
import { RemoteData } from '../../core/data/remote-data'; import { RemoteData } from '../../core/data/remote-data';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { Item } from '../../core/shared/item.model'; import { Item } from '../../core/shared/item.model';
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
@Component({ @Component({
selector: 'ds-item-select', selector: 'ds-item-select',
@@ -14,7 +15,10 @@ import { Item } from '../../core/shared/item.model';
export class ItemSelectComponent implements OnInit { export class ItemSelectComponent implements OnInit {
@Input() @Input()
items$: Observable<RemoteData<PaginatedList<Item>>>; itemsRD$: Observable<RemoteData<PaginatedList<Item>>>;
@Input()
paginationOptions: PaginationComponentOptions;
checked: boolean[] = []; checked: boolean[] = [];
@@ -22,7 +26,7 @@ export class ItemSelectComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.items$ = this.itemDataService.findAll({}); this.itemsRD$.subscribe((value) => console.log(value));
} }
} }