mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
55693: Temporary pagination fix (remove url params on tab change)
This commit is contained in:
@@ -15,14 +15,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ngb-tabset>
|
<ngb-tabset (tabChange)="tabChange($event)">
|
||||||
<ngb-tab title="{{'collection.item-mapper.tabs.browse' | translate}}">
|
<ngb-tab title="{{'collection.item-mapper.tabs.browse' | translate}}">
|
||||||
<ng-template ngbTabContent>
|
<ng-template ngbTabContent>
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
<ds-viewable-collection
|
<ds-viewable-collection
|
||||||
[config]="(searchOptions$ | async)?.pagination"
|
[config]="(searchOptions$ | async)?.pagination"
|
||||||
[sortConfig]="(searchOptions$ | async)?.sort"
|
[sortConfig]="(searchOptions$ | async)?.sort"
|
||||||
[objects]="collectionItemsRD$ | async">
|
[objects]="collectionItemsRD$ | async"
|
||||||
|
[hideGear]="true">
|
||||||
</ds-viewable-collection>
|
</ds-viewable-collection>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||||
import { fadeIn, fadeInOut } from '../../shared/animations/fade';
|
import { fadeIn, fadeInOut } from '../../shared/animations/fade';
|
||||||
import { CollectionDataService } from '../../core/data/collection-data.service';
|
|
||||||
import { ActivatedRoute, PRIMARY_OUTLET, Router, UrlSegmentGroup } from '@angular/router';
|
import { ActivatedRoute, PRIMARY_OUTLET, Router, UrlSegmentGroup } from '@angular/router';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
@@ -8,16 +7,14 @@ import { Collection } from '../../core/shared/collection.model';
|
|||||||
import { SearchConfigurationService } from '../../+search-page/search-service/search-configuration.service';
|
import { SearchConfigurationService } from '../../+search-page/search-service/search-configuration.service';
|
||||||
import { PaginatedSearchOptions } from '../../+search-page/paginated-search-options.model';
|
import { PaginatedSearchOptions } from '../../+search-page/paginated-search-options.model';
|
||||||
import { PaginatedList } from '../../core/data/paginated-list';
|
import { PaginatedList } from '../../core/data/paginated-list';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { flatMap, map, switchMap } from 'rxjs/operators';
|
||||||
import { combineLatest, filter, flatMap, map, switchMap, take, tap } from 'rxjs/operators';
|
import { getSucceededRemoteData, toDSpaceObjectListRD } from '../../core/shared/operators';
|
||||||
import { filterSuccessfulResponses, getSucceededRemoteData, toDSpaceObjectListRD } from '../../core/shared/operators';
|
|
||||||
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';
|
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { ItemDataService } from '../../core/data/item-data.service';
|
import { ItemDataService } from '../../core/data/item-data.service';
|
||||||
import { forkJoin } from 'rxjs/observable/forkJoin';
|
|
||||||
import { RestResponse } from '../../core/cache/response-cache.models';
|
import { RestResponse } from '../../core/cache/response-cache.models';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -68,7 +65,6 @@ export class CollectionItemMapperComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
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, {
|
||||||
scope: undefined,
|
scope: undefined,
|
||||||
dsoType: DSpaceObjectType.ITEM,
|
dsoType: DSpaceObjectType.ITEM,
|
||||||
@@ -98,6 +94,15 @@ export class CollectionItemMapperComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tabChange(event) {
|
||||||
|
// TODO: Fix tabs to maintain their own pagination options (once the current pagination system is improved)
|
||||||
|
// Temporary solution: Clear url params when changing tabs
|
||||||
|
if (this.router.url.indexOf('?') > -1) {
|
||||||
|
const url: string = this.router.url.substring(0, this.router.url.indexOf('?'));
|
||||||
|
this.router.navigateByUrl(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getCurrentUrl(): string {
|
getCurrentUrl(): string {
|
||||||
const urlTree = this.router.parseUrl(this.router.url);
|
const urlTree = this.router.parseUrl(this.router.url);
|
||||||
const g: UrlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
|
const g: UrlSegmentGroup = urlTree.root.children[PRIMARY_OUTLET];
|
||||||
|
Reference in New Issue
Block a user