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,20 +1,27 @@
<div class="table-responsive"> <ds-pagination
<table id="item-select" class="table table-striped table-hover"> *ngIf="(itemsRD$ | async)?.payload?.totalElements > 0"
<thead> [paginationOptions]="paginationOptions"
<tr> [pageInfoState]="(itemsRD$ | async)?.payload"
<th></th> [collectionSize]="(itemsRD$ | async)?.payload?.totalElements"
<th scope="col">{{'item.select.table.collection' | translate}}</th> [hidePagerWhenSinglePage]="true">
<th scope="col">{{'item.select.table.author' | translate}}</th> <div class="table-responsive">
<th scope="col">{{'item.select.table.title' | translate}}</th> <table id="item-select" class="table table-striped table-hover">
</tr> <thead>
</thead> <tr>
<tbody> <th></th>
<tr *ngFor="let item of (items$ | async)?.payload?.page ; let i = index"> <th scope="col">{{'item.select.table.collection' | translate}}</th>
<td><input [(ngModel)]="checked[i]" type="checkbox"></td> <th scope="col">{{'item.select.table.author' | translate}}</th>
<td><a [routerLink]="['/items', item.id]">{{(item.owningCollection | async)?.payload?.name}}</a></td> <th scope="col">{{'item.select.table.title' | translate}}</th>
<td><a [routerLink]="['/items', item.id]">{{item.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])[0].value}}</a></td> </tr>
<td><a [routerLink]="['/items', item.id]">{{item.findMetadata("dc.title")}}</a></td> </thead>
</tr> <tbody>
</tbody> <tr *ngFor="let item of (itemsRD$ | async)?.payload?.page ; let i = index">
</table> <td><input [(ngModel)]="checked[i]" type="checkbox"></td>
</div> <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.findMetadata("dc.title")}}</a></td>
</tr>
</tbody>
</table>
</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));
} }
} }