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