mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-4499] Version history - Pagination fixed
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
{{ "item.version.history.selected.alert" | translate : {version: itemVersion.version} }}
|
||||
</ds-alert>
|
||||
<ds-pagination *ngIf="versions?.page?.length > 0"
|
||||
(paginationChange)="onPageChange()"
|
||||
[hideGear]="true"
|
||||
[hidePagerWhenSinglePage]="true"
|
||||
[paginationOptions]="options"
|
||||
|
@@ -99,10 +99,15 @@ export class ItemVersionsComponent implements OnInit {
|
||||
versionRD$: Observable<RemoteData<Version>>;
|
||||
|
||||
/**
|
||||
* The item's full version history
|
||||
* The item's full version history (remote data)
|
||||
*/
|
||||
versionHistoryRD$: Observable<RemoteData<VersionHistory>>;
|
||||
|
||||
/**
|
||||
* The item's full version history
|
||||
*/
|
||||
versionHistory$: Observable<VersionHistory>;
|
||||
|
||||
/**
|
||||
* The version history's list of versions
|
||||
*/
|
||||
@@ -239,7 +244,7 @@ export class ItemVersionsComponent implements OnInit {
|
||||
).subscribe((updatedVersionRD: RemoteData<Version>) => {
|
||||
if (updatedVersionRD.hasSucceeded) {
|
||||
this.notificationsService.success(null, this.translateService.get(successMessageKey, {'version': this.versionBeingEditedNumber}));
|
||||
this.getAllVersions(this.versionHistoryRD$.pipe(getFirstSucceededRemoteDataPayload()));
|
||||
this.getAllVersions(this.versionHistory$);
|
||||
} else {
|
||||
this.notificationsService.warning(null, this.translateService.get(failureMessageKey, {'version': this.versionBeingEditedNumber}));
|
||||
}
|
||||
@@ -396,6 +401,13 @@ export class ItemVersionsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the page
|
||||
*/
|
||||
onPageChange() {
|
||||
this.getAllVersions(this.versionHistory$);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID of the workspace item, if present, otherwise return undefined
|
||||
* @param versionItem the item for which retrieve the workspace item id
|
||||
@@ -446,6 +458,10 @@ export class ItemVersionsComponent implements OnInit {
|
||||
hasValueOperator(),
|
||||
switchMap((version: Version) => version.versionhistory),
|
||||
);
|
||||
this.versionHistory$ = this.versionHistoryRD$.pipe(
|
||||
getFirstSucceededRemoteDataPayload(),
|
||||
hasValueOperator(),
|
||||
);
|
||||
|
||||
this.canCreateVersion$ = this.authorizationService.isAuthorized(FeatureID.CanCreateVersion, this.item.self);
|
||||
|
||||
@@ -460,11 +476,7 @@ export class ItemVersionsComponent implements OnInit {
|
||||
switchMap((res) => of(res ? 'item.version.history.table.action.hasDraft' : 'item.version.history.table.action.newVersion'))
|
||||
);
|
||||
|
||||
const versionHistory$ = this.versionHistoryRD$.pipe(
|
||||
getFirstSucceededRemoteDataPayload(),
|
||||
hasValueOperator(),
|
||||
);
|
||||
this.getAllVersions(versionHistory$);
|
||||
this.getAllVersions(this.versionHistory$);
|
||||
this.hasEpersons$ = this.versionsRD$.pipe(
|
||||
getAllSucceededRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
|
Reference in New Issue
Block a user