Merge branch 'fix-broken-item-mapper-pagination_contribute-7.6' into fix-broken-item-mapper-pagination_contribute-main

# Conflicts:
#	src/app/access-control/bulk-access/browse/bulk-access-browse.component.html
#	src/app/access-control/epeople-registry/epeople-registry.component.html
#	src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html
#	src/app/access-control/group-registry/group-form/members-list/members-list.component.html
#	src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.html
#	src/app/process-page/overview/process-overview.component.html
#	src/app/shared/object-select/collection-select/collection-select.component.html
#	src/app/shared/object-select/collection-select/collection-select.component.ts
#	src/app/shared/object-select/item-select/item-select.component.html
#	src/app/shared/object-select/item-select/item-select.component.ts
#	src/app/shared/object-select/object-select/object-select.component.ts
#	src/app/shared/pagination/pagination.component.ts
This commit is contained in:
Alexandre Vryghem
2024-04-18 21:28:53 +02:00
25 changed files with 100 additions and 113 deletions

View File

@@ -1,12 +1,12 @@
import {
Component,
Input,
OnInit,
} from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
import { PaginatedList } from '../../../core/data/paginated-list.model';
import { Item } from '../../../core/shared/item.model';
import { getAllSucceededRemoteDataPayload } from '../../../core/shared/operators';
import { getItemPageRoute } from '../../../item-page/item-page-routing-paths';
@@ -14,7 +14,7 @@ import {
hasValueOperator,
isNotEmpty,
} from '../../empty.util';
import { ObjectSelectService } from '../object-select.service';
import { DSpaceObjectSelect } from '../object-select.model';
import { ObjectSelectComponent } from '../object-select/object-select.component';
@Component({
@@ -25,7 +25,7 @@ import { ObjectSelectComponent } from '../object-select/object-select.component'
/**
* A component used to select items from a specific list and returning the UUIDs of the selected items
*/
export class ItemSelectComponent extends ObjectSelectComponent<Item> {
export class ItemSelectComponent extends ObjectSelectComponent<Item> implements OnInit {
/**
* Whether or not to hide the collection column
@@ -34,35 +34,25 @@ export class ItemSelectComponent extends ObjectSelectComponent<Item> {
hideCollection = false;
/**
* The routes to the items their pages
* Key: Item ID
* Value: Route to item page
* Collection of all the data that is used to display the {@link Item} in the HTML.
* By collecting this data here it doesn't need to be recalculated on evey change detection.
*/
itemPageRoutes$: Observable<{
[itemId: string]: string
}>;
constructor(
protected objectSelectService: ObjectSelectService,
protected authorizationService: AuthorizationDataService,
public dsoNameService: DSONameService,
) {
super(objectSelectService, authorizationService);
}
selectItems$: Observable<DSpaceObjectSelect<Item>[]>;
ngOnInit(): void {
super.ngOnInit();
if (!isNotEmpty(this.confirmButton)) {
this.confirmButton = 'item.select.confirm';
}
this.itemPageRoutes$ = this.dsoRD$.pipe(
this.selectItems$ = this.dsoRD$.pipe(
hasValueOperator(),
getAllSucceededRemoteDataPayload(),
map((items) => {
const itemPageRoutes = {};
items.page.forEach((item) => itemPageRoutes[item.uuid] = getItemPageRoute(item));
return itemPageRoutes;
}),
map((items: PaginatedList<Item>) => items.page.map((item: Item) => Object.assign(new DSpaceObjectSelect<Item>(), {
dso: item,
canSelect$: this.canSelect(item),
selected$: this.getSelected(item.id),
route: getItemPageRoute(item),
} as DSpaceObjectSelect<Item>))),
);
}