Skip to content

Commit eaf23e8

Browse files
committed
Merge branch 'dspace-cris-2023_02_x' into ux-plus-2023_02_x
# Conflicts: # src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/metadata-box.decorator.ts # src/app/cris-layout/cris-layout.module.ts
2 parents 6b342ac + f580a5b commit eaf23e8

56 files changed

Lines changed: 1157 additions & 157 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

config/config.example.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,6 @@ themes:
400400
attributes:
401401
rel: manifest
402402
href: assets/dspace/images/favicons/manifest.webmanifest
403-
- tagName: link
404-
attributes:
405-
rel: stylesheet
406-
href: "https://fonts.googleapis.com/icon?family=Material+Icons"
407403

408404
# The default bundles that should always be displayed as suggestions when you upload a new bundle
409405
bundle:

src/app/audit-page/object-audit-overview/object-audit-overview.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ <h4 class="mt-4 mb-4">{{ object.name }} (<em>{{object.type}}</em>)</h4>
6161

6262
</ng-container>
6363

64-
<h4 class="mt-4 mb-4" *ngIf="(auditsRD$ | async).statusCode === 404">{{'audit.object.overview.disabled.message' | translate}}</h4>
64+
<h4 class="mt-4 mb-4" *ngIf="(auditsRD$ | async)?.statusCode === 404">{{'audit.object.overview.disabled.message' | translate}}</h4>
6565

6666
</ng-container>
6767

src/app/audit-page/object-audit-overview/object-audit-overview.component.ts

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, OnInit } from '@angular/core';
22

3-
import { combineLatest, Observable } from 'rxjs';
4-
import { mergeMap } from 'rxjs/operators';
3+
import { combineLatest, Observable, of, switchMap } from 'rxjs';
4+
import { map, mergeMap, take } from 'rxjs/operators';
55

66
import { RemoteData } from '../../core/data/remote-data';
77
import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model';
@@ -18,6 +18,10 @@ import { AuthService } from '../../core/auth/auth.service';
1818
import { PaginatedList } from '../../core/data/paginated-list.model';
1919
import { PaginationService } from '../../core/pagination/pagination.service';
2020
import { redirectOn4xx } from '../../core/shared/authorized.operators';
21+
import { CollectionDataService } from '../../core/data/collection-data.service';
22+
import { Collection } from '../../core/shared/collection.model';
23+
import { Item } from '../../core/shared/item.model';
24+
import { COLLECTION_PAGE_LINKS_TO_FOLLOW } from '../../collection-page/collection-page.resolver';
2125

2226
/**
2327
* Component displaying a list of all audit about a object in a paginated table
@@ -31,7 +35,7 @@ export class ObjectAuditOverviewComponent implements OnInit {
3135
/**
3236
* The object extracted from the route.
3337
*/
34-
object;
38+
object: Item;
3539

3640
/**
3741
* List of all audits
@@ -62,14 +66,17 @@ export class ObjectAuditOverviewComponent implements OnInit {
6266
*/
6367
dateFormat = 'yyyy-MM-dd HH:mm:ss';
6468

69+
owningCollection$: Observable<Collection>;
70+
6571
constructor(protected authService: AuthService,
6672
protected route: ActivatedRoute,
6773
protected router: Router,
6874
protected auditService: AuditDataService,
6975
protected itemService: ItemDataService,
7076
protected authorizationService: AuthorizationDataService,
71-
protected paginationService: PaginationService) {
72-
}
77+
protected paginationService: PaginationService,
78+
protected collectionDataService: CollectionDataService
79+
) {}
7380

7481
ngOnInit(): void {
7582
this.route.paramMap.pipe(
@@ -78,6 +85,15 @@ export class ObjectAuditOverviewComponent implements OnInit {
7885
redirectOn4xx(this.router, this.authService)
7986
).subscribe((rd) => {
8087
this.object = rd.payload;
88+
this.owningCollection$ = this.collectionDataService.findOwningCollectionFor(
89+
this.object,
90+
true,
91+
false,
92+
...COLLECTION_PAGE_LINKS_TO_FOLLOW
93+
).pipe(
94+
getFirstCompletedRemoteData(),
95+
map(data => data?.payload)
96+
);
8197
this.setAudits();
8298
});
8399
}
@@ -88,17 +104,35 @@ export class ObjectAuditOverviewComponent implements OnInit {
88104
setAudits() {
89105
const config$ = this.paginationService.getFindListOptions(this.pageConfig.id, this.config, this.pageConfig);
90106
const isAdmin$ = this.isCurrentUserAdmin();
91-
this.auditsRD$ = combineLatest([isAdmin$, config$]).pipe(
92-
mergeMap(([isAdmin, config]) => {
107+
const parentCommunity$ = this.owningCollection$.pipe(
108+
switchMap(collection => collection.parentCommunity),
109+
getFirstCompletedRemoteData(),
110+
map(data => data?.payload)
111+
);
112+
113+
114+
this.auditsRD$ = combineLatest([isAdmin$, config$, this.owningCollection$, parentCommunity$]).pipe(
115+
mergeMap(([isAdmin, config, owningCollection, parentCommunity]) => {
93116
if (isAdmin) {
94-
return this.auditService.findByObject(this.object.id, config);
117+
return this.auditService.findByObject(this.object.id, config, owningCollection.id, parentCommunity.id);
95118
}
119+
120+
return of(null);
96121
})
97122
);
98123
}
99124

100125
isCurrentUserAdmin(): Observable<boolean> {
101-
return this.authorizationService.isAuthorized(FeatureID.AdministratorOf, undefined, undefined);
126+
return combineLatest([
127+
this.authorizationService.isAuthorized(FeatureID.IsCollectionAdmin),
128+
this.authorizationService.isAuthorized(FeatureID.IsCommunityAdmin),
129+
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
130+
]).pipe(
131+
map(([isCollectionAdmin, isCommunityAdmin, isSiteAdmin]) => {
132+
return isCollectionAdmin || isCommunityAdmin || isSiteAdmin;
133+
}),
134+
take(1),
135+
);
102136
}
103137

104138
/**

src/app/breadcrumbs/breadcrumbs.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</ng-template>
1515

1616
<ng-template #activeBreadcrumb let-text="text">
17-
<li class="breadcrumb-item active" aria-current="page"><div class="breadcrumb-item-limiter"><div class="text-truncate">{{text | translate}}</div></div></li>
17+
<li class="breadcrumb-item active" aria-current="page"><div class="breadcrumb-item-limiter"><span class="text-truncate" [innerHTML]="text | translate"></span></div></li>
1818
</ng-template>
1919
</ng-container>
2020

src/app/core/audit/audit-data.service.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { SearchDataImpl } from '../data/base/search-data';
2727
import { DeleteDataImpl } from '../data/base/delete-data';
2828
import { FindAllData, FindAllDataImpl } from '../data/base/find-all-data';
2929
import { DSONameService } from '../breadcrumbs/dso-name.service';
30+
import { hasValue } from '../../shared/empty.util';
3031

3132
export const AUDIT_PERSON_NOT_AVAILABLE = 'n/a';
3233

@@ -60,12 +61,23 @@ export class AuditDataService extends IdentifiableDataService<Audit>{
6061
*
6162
* @param objectId The objectId id
6263
* @param options The [[FindListOptions]] object
64+
* @param collUuid The Uuid of the collection
65+
* @param commUuid The Uuid of the community
6366
* @return Observable<RemoteData<PaginatedList<Audit>>>
6467
*/
65-
findByObject(objectId: string, options: FindListOptions = {}): Observable<RemoteData<PaginatedList<Audit>>> {
68+
findByObject(objectId: string, options: FindListOptions = {}, collUuid?: string, commUuid?: string): Observable<RemoteData<PaginatedList<Audit>>> {
6669
const searchMethod = AUDIT_FIND_BY_OBJECT_SEARCH_METHOD;
70+
const searchParams = [new RequestParam('object', objectId)];
71+
72+
if (hasValue(commUuid)) {
73+
searchParams.push(new RequestParam('commUuid', commUuid));
74+
}
75+
76+
if (hasValue(collUuid)) {
77+
searchParams.push(new RequestParam('collUuid', collUuid));
78+
}
6779
const optionsWithObject = Object.assign(new FindListOptions(), options, {
68-
searchParams: [new RequestParam('object', objectId)]
80+
searchParams
6981
});
7082
return this.searchData.searchBy(searchMethod, optionsWithObject, true, true, followLink('eperson'));
7183
}

src/app/core/data/collection-data.service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,12 @@ export class CollectionDataService extends ComColDataService<Collection> {
321321
/**
322322
* Returns {@link RemoteData} of {@link Collection} that is the owning collection of the given item
323323
* @param item Item we want the owning collection of
324+
* @param useCachedVersionIfAvailable
325+
* @param reRequestOnStale
326+
* @param linksToFollow
324327
*/
325-
findOwningCollectionFor(item: Item): Observable<RemoteData<Collection>> {
326-
return this.findByHref(item._links.owningCollection.href);
328+
findOwningCollectionFor(item: Item, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Collection>[]): Observable<RemoteData<Collection>> {
329+
return this.findByHref(item._links.owningCollection.href, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
327330
}
328331

329332
/**

0 commit comments

Comments
 (0)