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 -->
<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>

View File

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

View File

@@ -1,20 +1,27 @@
<div class="table-responsive">
<table id="item-select" class="table table-striped table-hover">
<thead>
<tr>
<th></th>
<th scope="col">{{'item.select.table.collection' | translate}}</th>
<th scope="col">{{'item.select.table.author' | translate}}</th>
<th scope="col">{{'item.select.table.title' | translate}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of (items$ | async)?.payload?.page ; let i = index">
<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.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
*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">
<thead>
<tr>
<th></th>
<th scope="col">{{'item.select.table.collection' | translate}}</th>
<th scope="col">{{'item.select.table.author' | translate}}</th>
<th scope="col">{{'item.select.table.title' | translate}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of (itemsRD$ | async)?.payload?.page ; let i = index">
<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.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 { PaginatedList } from '../../core/data/paginated-list';
import { RemoteData } from '../../core/data/remote-data';
import { Observable } from 'rxjs/Observable';
import { Item } from '../../core/shared/item.model';
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
@Component({
selector: 'ds-item-select',
@@ -14,7 +15,10 @@ import { Item } from '../../core/shared/item.model';
export class ItemSelectComponent implements OnInit {
@Input()
items$: Observable<RemoteData<PaginatedList<Item>>>;
itemsRD$: Observable<RemoteData<PaginatedList<Item>>>;
@Input()
paginationOptions: PaginationComponentOptions;
checked: boolean[] = [];
@@ -22,7 +26,7 @@ export class ItemSelectComponent implements OnInit {
}
ngOnInit(): void {
this.items$ = this.itemDataService.findAll({});
this.itemsRD$.subscribe((value) => console.log(value));
}
}