mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-11178][CST-11179] fixed pagination for relationship management
This commit is contained in:

committed by
Mykhaylo Boychuk

parent
1a525dfbe7
commit
143916c604
@@ -11,26 +11,28 @@
|
|||||||
[placeholder]="'correction-type.manage-relation.search.placeholder' | translate" aria-label="" aria-describedby="">
|
[placeholder]="'correction-type.manage-relation.search.placeholder' | translate" aria-label="" aria-describedby="">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button type="button" class="btn btn-outline-secondary" [disabled]="projectTitle === ''"
|
<button type="button" class="btn btn-outline-secondary" [disabled]="projectTitle === ''"
|
||||||
(click)="projectTitle = ''">{{('correction-type.manage-relation.search.btn.clear' | translate)}}</button>
|
(click)="projectTitle = ''; search('')">{{('correction-type.manage-relation.search.btn.clear' | translate)}}</button>
|
||||||
<button type="button" class="btn btn-primary" [disabled]="projectTitle === ''"
|
<button type="button" class="btn btn-primary" [disabled]="projectTitle === ''"
|
||||||
(click)="search(projectTitle)">{{('correction-type.manage-relation.search.btn.search' | translate)}}</button>
|
(click)="search(projectTitle)">{{('correction-type.manage-relation.search.btn.search' | translate)}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ds-loading *ngIf="(isLoading$ | async)" message="{{'loading.search-results' | translate}}"></ds-loading>
|
<ds-loading *ngIf="(isLoading$ | async)" message="{{'loading.search-results' | translate}}"></ds-loading>
|
||||||
<ds-search-results *ngIf="(localEntitiesRD$ | async)?.payload?.page?.length > 0 && !(isLoading$ | async)"
|
|
||||||
[searchResults]="(localEntitiesRD$ | async)"
|
<ds-viewable-collection
|
||||||
[sortConfig]="this.searchOptions?.sort"
|
*ngIf="(localEntitiesRD$ | async)?.payload?.page?.length > 0 && !(isLoading$ | async)"
|
||||||
[searchConfig]="this.searchOptions"
|
[config]="pagination"
|
||||||
[selectable]="true"
|
[sortConfig]="searchOptions?.sort"
|
||||||
[disableHeader]="true"
|
[objects]="(localEntitiesRD$ | async)"
|
||||||
[hidePaginationDetail]="false"
|
[hideGear]="true"
|
||||||
[selectionConfig]="{ repeatable: false, listId: entityListId }"
|
[selectable]="true"
|
||||||
[linkType]="linkTypes.ExternalLink"
|
[selectionConfig]="{ repeatable: false, listId: entityListId }"
|
||||||
[context]="context"
|
[linkType]="linkTypes.Link"
|
||||||
(deselectObject)="deselectEntity()"
|
[context]="context"
|
||||||
(selectObject)="selectEntity($event)">
|
[hidePaginationDetail]="false"
|
||||||
</ds-search-results>
|
(deselectObject)="deselectEntity()"
|
||||||
|
(selectObject)="selectEntity($event)">
|
||||||
|
</ds-viewable-collection>
|
||||||
|
|
||||||
<div *ngIf="(localEntitiesRD$ | async)?.payload?.page?.length < 1 && !(isLoading$ | async)">
|
<div *ngIf="(localEntitiesRD$ | async)?.payload?.page?.length < 1 && !(isLoading$ | async)">
|
||||||
<ds-alert [type]="'alert-info'">
|
<ds-alert [type]="'alert-info'">
|
||||||
|
@@ -20,7 +20,7 @@ import { renderCorrectionFor } from '../../correction-suggestion-page.decorator'
|
|||||||
import { CorrectionType } from '../../../../core/submission/models/correction-type-mode.model';
|
import { CorrectionType } from '../../../../core/submission/models/correction-type-mode.model';
|
||||||
import { CorrectionTypeForms } from '../correction-type-forms';
|
import { CorrectionTypeForms } from '../correction-type-forms';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { Observable, of as observableOf, Subscription, switchMap } from 'rxjs';
|
import { finalize, Observable, of as observableOf, Subscription, switchMap } from 'rxjs';
|
||||||
import { hasValue, isNotEmpty } from '../../../empty.util';
|
import { hasValue, isNotEmpty } from '../../../empty.util';
|
||||||
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
@@ -55,9 +55,9 @@ export class ManageRelationCorrectionTypeComponent implements OnInit, OnDestroy
|
|||||||
/**
|
/**
|
||||||
* Pagination options
|
* Pagination options
|
||||||
*/
|
*/
|
||||||
pagination: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
pagination: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||||
id: 'csmr',
|
id: 'csmr',
|
||||||
pageSize: 3,
|
pageSize: 10,
|
||||||
currentPage: 1
|
currentPage: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -99,11 +99,11 @@ export class ManageRelationCorrectionTypeComponent implements OnInit, OnDestroy
|
|||||||
/**
|
/**
|
||||||
* List ID for selecting local entities
|
* List ID for selecting local entities
|
||||||
*/
|
*/
|
||||||
entityListId = 'correction-suggestion-manage-relation';
|
entityListId = 'csmr';
|
||||||
/**
|
/**
|
||||||
* List ID for selecting local authorities
|
* List ID for selecting local authorities
|
||||||
*/
|
*/
|
||||||
authorityListId = 'correction-suggestion-manage-relation-authority';
|
authorityListId = 'csmr-authority';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ImportType enum
|
* ImportType enum
|
||||||
@@ -134,23 +134,33 @@ export class ManageRelationCorrectionTypeComponent implements OnInit, OnDestroy
|
|||||||
* Get the search results
|
* Get the search results
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.searchOptions = Object.assign(new PaginatedSearchOptions(
|
this.getData();
|
||||||
{
|
}
|
||||||
configuration: this.correctionType.discoveryConfiguration,
|
|
||||||
scope: this.itemUuid,
|
|
||||||
pagination: this.pagination
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
this.localEntitiesRD$ = this.searchService.search(this.searchOptions);
|
private getData(){
|
||||||
this.subs.push(
|
this.localEntitiesRD$ = this.aroute.queryParams
|
||||||
this.localEntitiesRD$.pipe(
|
.pipe(
|
||||||
getFirstCompletedRemoteData(),
|
switchMap((params) => {
|
||||||
).subscribe(
|
if (hasValue(params)) {
|
||||||
() => {
|
this.pagination = Object.assign(new PaginationComponentOptions(),{
|
||||||
this.isLoading$ = observableOf(false);
|
...this.pagination,
|
||||||
|
currentPage: params[`${this.pagination.id}.page`] || 1
|
||||||
|
});
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
this.searchOptions = Object.assign(new PaginatedSearchOptions(
|
||||||
|
{
|
||||||
|
configuration: this.correctionType.discoveryConfiguration,
|
||||||
|
scope: this.itemUuid,
|
||||||
|
pagination: this.pagination,
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
return this.searchService.search(this.searchOptions).pipe(
|
||||||
|
getFirstCompletedRemoteData(),
|
||||||
|
finalize(() => this.isLoading$ = observableOf(false))
|
||||||
|
);
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,15 +179,24 @@ export class ManageRelationCorrectionTypeComponent implements OnInit, OnDestroy
|
|||||||
pagination: this.pagination
|
pagination: this.pagination
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
this.localEntitiesRD$ = this.searchService.search(this.searchOptions);
|
} else {
|
||||||
this.subs.push(
|
this.searchOptions = Object.assign(new PaginatedSearchOptions(
|
||||||
this.localEntitiesRD$.pipe(
|
{
|
||||||
getFirstCompletedRemoteData(),
|
configuration: this.correctionType.discoveryConfiguration,
|
||||||
).subscribe(
|
scope: this.itemUuid,
|
||||||
() => this.isLoading$ = observableOf(false)
|
pagination: this.pagination
|
||||||
)
|
}
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.localEntitiesRD$ = this.searchService.search(this.searchOptions);
|
||||||
|
this.subs.push(
|
||||||
|
this.localEntitiesRD$.pipe(
|
||||||
|
getFirstCompletedRemoteData(),
|
||||||
|
).subscribe(
|
||||||
|
() => this.isLoading$ = observableOf(false)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user