mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
55693: Fixed scope being passed between tabs
This commit is contained in:
@@ -18,16 +18,20 @@
|
|||||||
<ngb-tabset>
|
<ngb-tabset>
|
||||||
<ngb-tab title="{{'collection.item-mapper.tabs.browse' | translate}}">
|
<ngb-tab title="{{'collection.item-mapper.tabs.browse' | translate}}">
|
||||||
<ng-template ngbTabContent>
|
<ng-template ngbTabContent>
|
||||||
<ds-viewable-collection
|
<div class="mt-2">
|
||||||
[config]="(searchOptions$ | async)?.pagination"
|
<ds-viewable-collection
|
||||||
[sortConfig]="(searchOptions$ | async)?.sort"
|
[config]="(searchOptions$ | async)?.pagination"
|
||||||
[objects]="collectionItemsRD$ | async">
|
[sortConfig]="(searchOptions$ | async)?.sort"
|
||||||
</ds-viewable-collection>
|
[objects]="collectionItemsRD$ | async">
|
||||||
|
</ds-viewable-collection>
|
||||||
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ngb-tab>
|
</ngb-tab>
|
||||||
<ngb-tab title="{{'collection.item-mapper.tabs.map' | translate}}">
|
<ngb-tab title="{{'collection.item-mapper.tabs.map' | translate}}">
|
||||||
<ng-template ngbTabContent>
|
<ng-template ngbTabContent>
|
||||||
<ds-item-select [itemsRD$]="mappingItemsRD$" [paginationOptions]="(searchOptions$ | async)?.pagination"></ds-item-select>
|
<div class="mt-2">
|
||||||
|
<ds-item-select class="mt-2" [itemsRD$]="mappingItemsRD$" [paginationOptions]="(searchOptions$ | async)?.pagination"></ds-item-select>
|
||||||
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ngb-tab>
|
</ngb-tab>
|
||||||
</ngb-tabset>
|
</ngb-tabset>
|
||||||
|
@@ -14,6 +14,7 @@ import { getSucceededRemoteData, toDSpaceObjectListRD } from '../../core/shared/
|
|||||||
import { SearchService } from '../../+search-page/search-service/search.service';
|
import { SearchService } from '../../+search-page/search-service/search.service';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
import { DSpaceObjectType } from '../../core/shared/dspace-object-type.model';
|
import { DSpaceObjectType } from '../../core/shared/dspace-object-type.model';
|
||||||
|
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-collection-item-mapper',
|
selector: 'ds-collection-item-mapper',
|
||||||
@@ -32,6 +33,8 @@ export class CollectionItemMapperComponent implements OnInit {
|
|||||||
collectionItemsRD$: Observable<RemoteData<PaginatedList<DSpaceObject>>>;
|
collectionItemsRD$: Observable<RemoteData<PaginatedList<DSpaceObject>>>;
|
||||||
mappingItemsRD$: Observable<RemoteData<PaginatedList<DSpaceObject>>>;
|
mappingItemsRD$: Observable<RemoteData<PaginatedList<DSpaceObject>>>;
|
||||||
|
|
||||||
|
defaultSortOptions: SortOptions = new SortOptions('dc.title', SortDirection.ASC);
|
||||||
|
|
||||||
constructor(private collectionDataService: CollectionDataService,
|
constructor(private collectionDataService: CollectionDataService,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@@ -48,15 +51,19 @@ export class CollectionItemMapperComponent implements OnInit {
|
|||||||
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
|
dsoType: DSpaceObjectType.ITEM,
|
||||||
|
sort: this.defaultSortOptions
|
||||||
}));
|
}));
|
||||||
}),
|
}),
|
||||||
toDSpaceObjectListRD()
|
toDSpaceObjectListRD()
|
||||||
);
|
);
|
||||||
this.mappingItemsRD$ = this.searchOptions$.pipe(
|
this.mappingItemsRD$ = this.searchOptions$.pipe(
|
||||||
flatMap((options: PaginatedSearchOptions) => {
|
flatMap((options: PaginatedSearchOptions) => {
|
||||||
|
options.sort.field = 'dc.title';
|
||||||
return this.searchService.search(Object.assign(options, {
|
return this.searchService.search(Object.assign(options, {
|
||||||
dsoType: DSpaceObjectType.ITEM
|
scope: undefined,
|
||||||
|
dsoType: DSpaceObjectType.ITEM,
|
||||||
|
sort: this.defaultSortOptions
|
||||||
}));
|
}));
|
||||||
}),
|
}),
|
||||||
toDSpaceObjectListRD()
|
toDSpaceObjectListRD()
|
||||||
|
@@ -3,7 +3,8 @@
|
|||||||
[paginationOptions]="paginationOptions"
|
[paginationOptions]="paginationOptions"
|
||||||
[pageInfoState]="(itemsRD$ | async)?.payload"
|
[pageInfoState]="(itemsRD$ | async)?.payload"
|
||||||
[collectionSize]="(itemsRD$ | async)?.payload?.totalElements"
|
[collectionSize]="(itemsRD$ | async)?.payload?.totalElements"
|
||||||
[hidePagerWhenSinglePage]="true">
|
[hidePagerWhenSinglePage]="true"
|
||||||
|
[hideGear]="true">
|
||||||
<div class="table-responsive">
|
<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>
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
<tr *ngFor="let item of (itemsRD$ | 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 *ngIf="item.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0" [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>
|
<td><a [routerLink]="['/items', item.id]">{{item.findMetadata("dc.title")}}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Reference in New Issue
Block a user