Skip to content

Commit 8bcddd2

Browse files
committed
Merged dspace-cris-2023_02_x into task/dspace-cris-2023_02_x/DSC-1988
2 parents ad9d674 + 29a111a commit 8bcddd2

93 files changed

Lines changed: 1524 additions & 222 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:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dspace-angular",
3-
"version": "2023.02.06-SNAPHOT",
3+
"version": "2023.02.07-SNAPSHOT",
44
"scripts": {
55
"ng": "ng",
66
"config:watch": "nodemon",

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/collection-page/collection-page.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ import { RouterStub } from '../shared/testing/router.stub';
1414
import { environment } from 'src/environments/environment.test';
1515
import { createSuccessfulRemoteDataObject$ } from '../shared/remote-data.utils';
1616
import { Collection } from '../core/shared/collection.model';
17-
import { SearchService } from '../core/shared/search/search.service';
1817
import { By } from '@angular/platform-browser';
1918
import { FormsModule } from '@angular/forms';
2019
import { RouterTestingModule } from '@angular/router/testing';
2120
import { TranslateModule } from '@ngx-translate/core';
2221
import { VarDirective } from '../shared/utils/var.directive';
2322
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
2423
import { Bitstream } from '../core/shared/bitstream.model';
24+
import { SearchManager } from '../core/browse/search-manager';
2525

2626
describe('CollectionPageComponent', () => {
2727
let component: CollectionPageComponent;
@@ -33,7 +33,7 @@ describe('CollectionPageComponent', () => {
3333
let paginationServiceSpy: jasmine.SpyObj<PaginationService>;
3434
let authorizationDataServiceSpy: jasmine.SpyObj<AuthorizationDataService>;
3535
let dsoNameServiceSpy: jasmine.SpyObj<DSONameService>;
36-
let searchServiceSpy: jasmine.SpyObj<SearchService>;
36+
let searchServiceSpy: jasmine.SpyObj<SearchManager>;
3737
let aroute = new ActivatedRouteStub();
3838
let router = new RouterStub();
3939

@@ -44,7 +44,7 @@ describe('CollectionPageComponent', () => {
4444
paginationServiceSpy = jasmine.createSpyObj('PaginationService', ['getCurrentPagination', 'getCurrentSort', 'clearPagination']);
4545
authorizationDataServiceSpy = jasmine.createSpyObj('AuthorizationDataService', ['isAuthorized']);
4646
collectionDataServiceSpy = jasmine.createSpyObj('CollectionDataService', ['findById', 'getAuthorizedCollection']);
47-
searchServiceSpy = jasmine.createSpyObj('SearchService', ['search']);
47+
searchServiceSpy = jasmine.createSpyObj('SearchManager', ['search']);
4848
dsoNameServiceSpy = jasmine.createSpyObj('DSONameService', ['getName']);
4949

5050
await TestBed.configureTestingModule({
@@ -58,7 +58,7 @@ describe('CollectionPageComponent', () => {
5858
{ provide: PaginationService, useValue: paginationServiceSpy },
5959
{ provide: AuthorizationDataService, useValue: authorizationDataServiceSpy },
6060
{ provide: DSONameService, useValue: dsoNameServiceSpy },
61-
{ provide: SearchService, useValue: searchServiceSpy },
61+
{ provide: SearchManager, useValue: searchServiceSpy },
6262
{ provide: APP_CONFIG, useValue: environment },
6363
{ provide: PLATFORM_ID, useValue: 'browser' },
6464
]

src/app/collection-page/collection-page.component.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { ActivatedRoute, Router } from '@angular/router';
44
import { BehaviorSubject, combineLatest as observableCombineLatest, Observable, Subject } from 'rxjs';
55
import { filter, map, mergeMap, startWith, switchMap, take } from 'rxjs/operators';
66
import { PaginatedSearchOptions } from '../shared/search/models/paginated-search-options.model';
7-
import { SearchService } from '../core/shared/search/search.service';
87
import { SortDirection, SortOptions } from '../core/cache/models/sort-options.model';
9-
import { CollectionDataService } from '../core/data/collection-data.service';
108
import { PaginatedList } from '../core/data/paginated-list.model';
119
import { RemoteData } from '../core/data/remote-data';
1210
import { Bitstream } from '../core/shared/bitstream.model';
@@ -30,6 +28,7 @@ import { redirectOn4xx } from '../core/shared/authorized.operators';
3028
import { BROWSE_LINKS_TO_FOLLOW } from '../core/browse/browse.service';
3129
import { DSONameService } from '../core/breadcrumbs/dso-name.service';
3230
import { APP_CONFIG, AppConfig } from '../../../src/config/app-config.interface';
31+
import { SearchManager } from '../core/browse/search-manager';
3332

3433
@Component({
3534
selector: 'ds-collection-page',
@@ -64,8 +63,7 @@ export class CollectionPageComponent implements OnInit {
6463

6564
constructor(
6665
@Inject(PLATFORM_ID) private platformId: Object,
67-
private collectionDataService: CollectionDataService,
68-
private searchService: SearchService,
66+
private searchManager: SearchManager,
6967
private route: ActivatedRoute,
7068
private router: Router,
7169
private authService: AuthService,
@@ -113,13 +111,13 @@ export class CollectionPageComponent implements OnInit {
113111
getFirstSucceededRemoteData(),
114112
map((rd) => rd.payload.id),
115113
switchMap((id: string) => {
116-
return this.searchService.search<Item>(
114+
return this.searchManager.search<Item>(
117115
new PaginatedSearchOptions({
118116
scope: id,
119117
pagination: currentPagination,
120118
sort: currentSort,
121119
dsoTypes: [DSpaceObjectType.ITEM],
122-
forcedEmbeddedKeys: ['metrics']
120+
forcedEmbeddedKeys: ['metrics'],
123121
}), null, true, true, ...BROWSE_LINKS_TO_FOLLOW)
124122
.pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>;
125123
}),

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/browse/browse-entry-search-options.model.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export class BrowseEntrySearchOptions {
1616
public sort?: SortOptions,
1717
public startsWith?: string,
1818
public scope?: string,
19-
public fetchThumbnail?: boolean) {
19+
public fetchThumbnail?: boolean,
20+
public projection?: string,
21+
) {
2022
}
2123
}

src/app/core/browse/browse.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ export class BrowseService {
148148
if (isNotEmpty(filterAuthority)) {
149149
args.push(`filterAuthority=${encodeURIComponent(filterAuthority)}`);
150150
}
151+
if (isNotEmpty(options.projection)) {
152+
args.push(`projection=${options.projection}`);
153+
}
151154
if (isNotEmpty(args)) {
152155
href = new URLCombiner(href, `?${args.join('&')}`).toString();
153156
}

0 commit comments

Comments
 (0)