Skip to content

Commit 7500ea8

Browse files
authored
Merge branch 'main' into w2p-96062_theme-collection-dropdown-component
2 parents c6fd55b + dc4b4ff commit 7500ea8

50 files changed

Lines changed: 1103 additions & 1491 deletions

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ name: Build
66
# Run this Build for all pushes / PRs to current branch
77
on: [push, pull_request]
88

9+
permissions:
10+
contents: read # to fetch code (actions/checkout)
11+
912
jobs:
1013
tests:
1114
runs-on: ubuntu-latest

.github/workflows/docker.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- 'dspace-**'
1313
pull_request:
1414

15+
permissions:
16+
contents: read # to fetch code (actions/checkout)
17+
1518
jobs:
1619
docker:
1720
# Ensure this job never runs on forked repos. It's only executed for 'dspace/dspace-angular'

.github/workflows/issue_opened.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
issues:
66
types: [opened]
77

8+
permissions: {}
89
jobs:
910
automation:
1011
runs-on: ubuntu-latest

.github/workflows/label_merge_conflicts.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ on:
1111
pull_request_target:
1212
types: [ synchronize ]
1313

14+
permissions: {}
15+
1416
jobs:
1517
triage:
1618
# Ensure this job never runs on forked repos. It's only executed for 'dspace/dspace-angular'
1719
if: github.repository == 'dspace/dspace-angular'
1820
runs-on: ubuntu-latest
1921
permissions:
20-
issues: write
2122
pull-requests: write
2223
steps:
2324
# See: https://github.com/prince-chrismc/label-merge-conflicts-action

src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.html

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,34 @@ <h2 id="header" class="border-bottom pb-2 ">{{'admin.registries.bitstream-format
1313
[paginationOptions]="pageConfig"
1414
[pageInfoState]="(bitstreamFormats | async)?.payload"
1515
[collectionSize]="(bitstreamFormats | async)?.payload?.totalElements"
16-
[hideGear]="true"
16+
[hideGear]="false"
1717
[hidePagerWhenSinglePage]="true">
1818
<div class="table-responsive">
1919
<table id="formats" class="table table-striped table-hover">
2020
<thead>
21-
<tr>
22-
<th scope="col"></th>
23-
<th scope="col">{{'admin.registries.bitstream-formats.table.name' | translate}}</th>
24-
<th scope="col">{{'admin.registries.bitstream-formats.table.mimetype' | translate}}</th>
25-
<th scope="col">{{'admin.registries.bitstream-formats.table.supportLevel.head' | translate}}</th>
26-
</tr>
21+
<tr>
22+
<th scope="col"></th>
23+
<th scope="col">{{'admin.registries.bitstream-formats.table.id' | translate}}</th>
24+
<th scope="col">{{'admin.registries.bitstream-formats.table.name' | translate}}</th>
25+
<th scope="col">{{'admin.registries.bitstream-formats.table.mimetype' | translate}}</th>
26+
<th scope="col">{{'admin.registries.bitstream-formats.table.supportLevel.head' | translate}}</th>
27+
</tr>
2728
</thead>
2829
<tbody>
29-
<tr *ngFor="let bitstreamFormat of (bitstreamFormats | async)?.payload?.page">
30-
<td>
31-
<label>
32-
<input type="checkbox"
33-
[checked]="isSelected(bitstreamFormat) | async"
34-
(change)="selectBitStreamFormat(bitstreamFormat, $event)"
35-
>
36-
</label>
37-
</td>
38-
<td><a [routerLink]="['/admin/registries/bitstream-formats', bitstreamFormat.id, 'edit']">{{bitstreamFormat.shortDescription}}</a></td>
39-
<td><a [routerLink]="['/admin/registries/bitstream-formats', bitstreamFormat.id, 'edit']">{{bitstreamFormat.mimetype}} <span *ngIf="bitstreamFormat.internal">({{'admin.registries.bitstream-formats.table.internal' | translate}})</span></a></td>
40-
<td><a [routerLink]="['/admin/registries/bitstream-formats', bitstreamFormat.id, 'edit']">{{'admin.registries.bitstream-formats.table.supportLevel.'+bitstreamFormat.supportLevel | translate}}</a></td>
41-
</tr>
30+
<tr *ngFor="let bitstreamFormat of (bitstreamFormats | async)?.payload?.page">
31+
<td>
32+
<label>
33+
<input type="checkbox"
34+
[checked]="isSelected(bitstreamFormat) | async"
35+
(change)="selectBitStreamFormat(bitstreamFormat, $event)"
36+
>
37+
</label>
38+
</td>
39+
<td><a [routerLink]="['/admin/registries/bitstream-formats', bitstreamFormat.id, 'edit']">{{bitstreamFormat.id}}</a></td>
40+
<td><a [routerLink]="['/admin/registries/bitstream-formats', bitstreamFormat.id, 'edit']">{{bitstreamFormat.shortDescription}}</a></td>
41+
<td><a [routerLink]="['/admin/registries/bitstream-formats', bitstreamFormat.id, 'edit']">{{bitstreamFormat.mimetype}} <span *ngIf="bitstreamFormat.internal">({{'admin.registries.bitstream-formats.table.internal' | translate}})</span></a></td>
42+
<td><a [routerLink]="['/admin/registries/bitstream-formats', bitstreamFormat.id, 'edit']">{{'admin.registries.bitstream-formats.table.supportLevel.'+bitstreamFormat.supportLevel | translate}}</a></td>
43+
</tr>
4244
</tbody>
4345
</table>
4446
</div>

src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,19 @@ describe('BitstreamFormatsComponent', () => {
129129
});
130130

131131
it('should contain the correct formats', () => {
132-
const unknownName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(1) td:nth-child(2)')).nativeElement;
132+
const unknownName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(1) td:nth-child(3)')).nativeElement;
133133
expect(unknownName.textContent).toBe('Unknown');
134134

135-
const licenseName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(2) td:nth-child(2)')).nativeElement;
135+
const UUID: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(1) td:nth-child(2)')).nativeElement;
136+
expect(UUID.textContent).toBe('test-uuid-1');
137+
138+
const licenseName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(2) td:nth-child(3)')).nativeElement;
136139
expect(licenseName.textContent).toBe('License');
137140

138-
const ccLicenseName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(3) td:nth-child(2)')).nativeElement;
141+
const ccLicenseName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(3) td:nth-child(3)')).nativeElement;
139142
expect(ccLicenseName.textContent).toBe('CC License');
140143

141-
const adobeName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(4) td:nth-child(2)')).nativeElement;
144+
const adobeName: HTMLElement = fixture.debugElement.query(By.css('#formats tr:nth-child(4) td:nth-child(3)')).nativeElement;
142145
expect(adobeName.textContent).toBe('Adobe PDF');
143146
});
144147
});

src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnDestroy, OnInit } from '@angular/core';
2-
import { combineLatest as observableCombineLatest, Observable, zip } from 'rxjs';
2+
import {combineLatest, combineLatest as observableCombineLatest, Observable, of as observableOf, zip} from 'rxjs';
33
import { RemoteData } from '../../../core/data/remote-data';
44
import { PaginatedList } from '../../../core/data/paginated-list.model';
55
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
@@ -29,29 +29,22 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
2929
*/
3030
bitstreamFormats: Observable<RemoteData<PaginatedList<BitstreamFormat>>>;
3131

32-
/**
33-
* The current pagination configuration for the page used by the FindAll method
34-
* Currently simply renders all bitstream formats
35-
*/
36-
config: FindListOptions = Object.assign(new FindListOptions(), {
37-
elementsPerPage: 20
38-
});
39-
4032
/**
4133
* The current pagination configuration for the page
4234
* Currently simply renders all bitstream formats
4335
*/
4436
pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
4537
id: 'rbp',
46-
pageSize: 20
38+
pageSize: 20,
39+
pageSizeOptions: [20, 40, 60, 80, 100]
4740
});
4841

4942
constructor(private notificationsService: NotificationsService,
5043
private router: Router,
5144
private translateService: TranslateService,
5245
private bitstreamFormatService: BitstreamFormatDataService,
5346
private paginationService: PaginationService,
54-
) {
47+
) {
5548
}
5649

5750

@@ -149,7 +142,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
149142

150143
ngOnInit(): void {
151144

152-
this.bitstreamFormats = this.paginationService.getFindListOptions(this.pageConfig.id, this.config).pipe(
145+
this.bitstreamFormats = this.paginationService.getFindListOptions(this.pageConfig.id, this.pageConfig).pipe(
153146
switchMap((findListOptions: FindListOptions) => {
154147
return this.bitstreamFormatService.findAll(findListOptions);
155148
})

src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ <h4>{{ 'collection.source.controls.head' | translate }}</h4>
1111
</div>
1212
<div>
1313
<span class="font-weight-bold">{{'collection.source.controls.harvest.last' | translate}}</span>
14-
<span>{{contentSource?.message ? contentSource?.message : 'collection.source.controls.harvest.no-information'|translate }}</span>
14+
<span>{{contentSource?.lastHarvested ? contentSource?.lastHarvested : 'collection.source.controls.harvest.no-information'|translate }}</span>
1515
</div>
1616
<div>
1717
<span class="font-weight-bold">{{'collection.source.controls.harvest.message' | translate}}</span>
18-
<span>{{contentSource?.lastHarvested ? contentSource?.lastHarvested : 'collection.source.controls.harvest.no-information'|translate }}</span>
18+
<span>{{contentSource?.message ? contentSource?.message: 'collection.source.controls.harvest.no-information'|translate }}</span>
1919
</div>
2020

2121
<button *ngIf="!(testConfigRunning$ |async)" class="btn btn-secondary"

src/app/core/shared/search/search.service.spec.ts

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import { SearchConfigurationService } from './search-configuration.service';
2626
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
2727
import { RequestEntry } from '../../data/request-entry.model';
2828
import { Angulartics2 } from 'angulartics2';
29+
import { SearchFilterConfig } from '../../../shared/search/models/search-filter-config.model';
30+
import anything = jasmine.anything;
2931

3032
@Component({ template: '' })
3133
class DummyComponent {
@@ -36,7 +38,7 @@ describe('SearchService', () => {
3638
let searchService: SearchService;
3739
const router = new RouterStub();
3840
const route = new ActivatedRouteStub();
39-
const searchConfigService = {paginationID: 'page-id'};
41+
const searchConfigService = { paginationID: 'page-id' };
4042
beforeEach(() => {
4143
TestBed.configureTestingModule({
4244
imports: [
@@ -103,7 +105,8 @@ describe('SearchService', () => {
103105
};
104106

105107
const paginationService = new PaginationServiceStub();
106-
const searchConfigService = {paginationID: 'page-id'};
108+
const searchConfigService = { paginationID: 'page-id' };
109+
const requestService = getMockRequestService();
107110

108111
beforeEach(() => {
109112
TestBed.configureTestingModule({
@@ -119,7 +122,7 @@ describe('SearchService', () => {
119122
providers: [
120123
{ provide: Router, useValue: router },
121124
{ provide: RouteService, useValue: routeServiceStub },
122-
{ provide: RequestService, useValue: getMockRequestService() },
125+
{ provide: RequestService, useValue: requestService },
123126
{ provide: RemoteDataBuildService, useValue: remoteDataBuildService },
124127
{ provide: HALEndpointService, useValue: halService },
125128
{ provide: CommunityDataService, useValue: {} },
@@ -138,13 +141,13 @@ describe('SearchService', () => {
138141

139142
it('should call the navigate method on the Router with view mode list parameter as a parameter when setViewMode is called', () => {
140143
searchService.setViewMode(ViewMode.ListElement);
141-
expect(paginationService.updateRouteWithUrl).toHaveBeenCalledWith('page-id', ['/search'], {page: 1}, { view: ViewMode.ListElement }
144+
expect(paginationService.updateRouteWithUrl).toHaveBeenCalledWith('page-id', ['/search'], { page: 1 }, { view: ViewMode.ListElement }
142145
);
143146
});
144147

145148
it('should call the navigate method on the Router with view mode grid parameter as a parameter when setViewMode is called', () => {
146149
searchService.setViewMode(ViewMode.GridElement);
147-
expect(paginationService.updateRouteWithUrl).toHaveBeenCalledWith('page-id', ['/search'], {page: 1}, { view: ViewMode.GridElement }
150+
expect(paginationService.updateRouteWithUrl).toHaveBeenCalledWith('page-id', ['/search'], { page: 1 }, { view: ViewMode.GridElement }
148151
);
149152
});
150153

@@ -191,5 +194,23 @@ describe('SearchService', () => {
191194
expect((searchService as any).rdb.buildFromHref).toHaveBeenCalledWith(endPoint);
192195
});
193196
});
197+
198+
describe('when getFacetValuesFor is called with a filterQuery', () => {
199+
it('should add the encoded filterQuery to the args list', () => {
200+
jasmine.getEnv().allowRespy(true);
201+
const spyRequest = spyOn((searchService as any), 'request').and.stub();
202+
spyOn(requestService, 'send').and.returnValue(true);
203+
const searchFilterConfig = new SearchFilterConfig();
204+
searchFilterConfig._links = {
205+
self: {
206+
href: 'https://demo.dspace.org/',
207+
},
208+
};
209+
210+
searchService.getFacetValuesFor(searchFilterConfig, 1, undefined, 'filter&Query');
211+
212+
expect(spyRequest).toHaveBeenCalledWith(anything(), 'https://demo.dspace.org?page=0&size=5&prefix=filter%26Query');
213+
});
214+
});
194215
});
195216
});

src/app/core/shared/search/search.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export class SearchService implements OnDestroy {
271271
let href;
272272
let args: string[] = [];
273273
if (hasValue(filterQuery)) {
274-
args.push(`prefix=${filterQuery}`);
274+
args.push(`prefix=${encodeURIComponent(filterQuery)}`);
275275
}
276276
if (hasValue(searchOptions)) {
277277
searchOptions = Object.assign(new PaginatedSearchOptions({}), searchOptions, {

0 commit comments

Comments
 (0)