Skip to content

Commit 14d2730

Browse files
author
Davide Negretti
committed
Merged dspace-cris-2023_02_x into task/dspace-cris-2023_02_x/DSC-884
2 parents 3f1b15f + f2e9450 commit 14d2730

File tree

198 files changed

+97695
-29250
lines changed

Some content is hidden

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

198 files changed

+97695
-29250
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dspace-angular",
3-
"version": "2023.02.04-SNAPSHOT",
3+
"version": "2023.02.05-SNAPSHOT",
44
"scripts": {
55
"ng": "ng",
66
"config:watch": "nodemon",
@@ -84,6 +84,7 @@
8484
"@angular/platform-server": "^15.2.8",
8585
"@angular/router": "^15.2.8",
8686
"@babel/runtime": "7.21.0",
87+
"@datadog/browser-rum": "^5.7.0",
8788
"@kolkov/ngx-gallery": "^2.0.1",
8889
"@material-ui/core": "^4.11.0",
8990
"@material-ui/icons": "^4.11.3",
@@ -112,6 +113,7 @@
112113
"date-fns": "^2.29.3",
113114
"date-fns-tz": "^1.3.7",
114115
"deepmerge": "^4.3.1",
116+
"domino": "^2.1.6",
115117
"ejs": "^3.1.9",
116118
"express": "^4.18.2",
117119
"express-rate-limit": "^5.1.3",

server.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import * as express from 'express';
2525
import * as ejs from 'ejs';
2626
import * as compression from 'compression';
2727
import * as expressStaticGzip from 'express-static-gzip';
28+
import * as domino from 'domino';
2829
/* eslint-enable import/no-namespace */
2930
import axios from 'axios';
3031
import LRU from 'lru-cache';
@@ -79,6 +80,15 @@ let anonymousCache: LRU<string, any>;
7980
// extend environment with app config for server
8081
extendEnvironmentWithAppConfig(environment, appConfig);
8182

83+
// Create a DOM window object based on the template
84+
const _window = domino.createWindow(indexHtml);
85+
86+
// Assign the DOM window and document objects to the global object
87+
(_window as any).screen = {deviceXDPI: 0, logicalXDPI: 0};
88+
(global as any).window = _window;
89+
(global as any).document = _window.document;
90+
(global as any).navigator = _window.navigator;
91+
8292
// The Express app is exported so that it can be used by serverless Functions.
8393
export function app() {
8494

src/app/access-control/bulk-access/bulk-access.component.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
<hr>
77

88
<div class="d-flex justify-content-end">
9-
<button class="btn btn-outline-primary mr-3" (click)="reset()">
10-
{{ 'access-control-cancel' | translate }}
11-
</button>
9+
<a routerLink="/home" class="btn btn-outline-primary mr-3">
10+
<i class="fas fa-arrow-left mr-1"></i>
11+
{{ 'access-control-back' | translate }}
12+
</a>
1213
<button class="btn btn-primary" [disabled]="!canExport()" (click)="submit()">
14+
<i class="fas fa-cogs mr-1"></i>
1315
{{ 'access-control-execute' | translate }}
1416
</button>
1517
</div>

src/app/access-control/bulk-access/bulk-access.component.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { Process } from '../../process-page/processes/process.model';
1313
import { RouterTestingModule } from '@angular/router/testing';
1414
import { NotificationsService } from '../../shared/notifications/notifications.service';
1515
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
16+
import { By } from '@angular/platform-browser';
1617

1718
describe('BulkAccessComponent', () => {
1819
let component: BulkAccessComponent;
@@ -141,11 +142,6 @@ describe('BulkAccessComponent', () => {
141142
expect(component.canExport()).toBe(true);
142143
});
143144

144-
it('should call the settings reset method when reset is called', () => {
145-
component.reset();
146-
expect(component.settings.reset).toHaveBeenCalled();
147-
});
148-
149145
it('should call the bulkAccessControlService executeScript method when submit is called', () => {
150146
(component.settings as any).getValue.and.returnValue(mockFormState);
151147
bulkAccessControlService.createPayloadFile.and.returnValue(mockFile);
@@ -154,5 +150,11 @@ describe('BulkAccessComponent', () => {
154150
component.submit();
155151
expect(bulkAccessControlService.executeScript).toHaveBeenCalled();
156152
});
153+
154+
it('should have a link to /home', () => {
155+
const link = fixture.debugElement.query(By.css('a.btn-outline-primary'));
156+
expect(link).toBeTruthy();
157+
expect(link.properties.href).toContain('/home');
158+
});
157159
});
158160
});

src/app/access-control/bulk-access/bulk-access.component.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ export class BulkAccessComponent implements OnInit {
5454
return this.objectsSelected$.value?.length > 0;
5555
}
5656

57-
/**
58-
* Reset the form to its initial state
59-
* This will also reset the state of the child components (bitstream and item access)
60-
*/
61-
reset(): void {
62-
this.settings.reset();
63-
}
64-
6557
/**
6658
* Submit the form
6759
* This will create a payload file and execute the script

src/app/access-control/bulk-access/settings/bulk-access-settings.component.spec.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ describe('BulkAccessSettingsComponent', () => {
3636

3737
const mockControl: any = jasmine.createSpyObj('AccessControlFormContainerComponent', {
3838
getFormValue: jasmine.createSpy('getFormValue'),
39-
reset: jasmine.createSpy('reset')
4039
});
4140

4241
beforeEach(async () => {
@@ -62,20 +61,11 @@ describe('BulkAccessSettingsComponent', () => {
6261
expect(component.getValue).toBeDefined();
6362
});
6463

65-
it('should have a method to reset the form', () => {
66-
expect(component.reset).toBeDefined();
67-
});
68-
6964
it('should return the correct form value', () => {
7065
const expectedValue = mockFormState;
7166
(component.controlForm as any).getFormValue.and.returnValue(mockFormState);
7267
const actualValue = component.getValue();
7368
// @ts-ignore
7469
expect(actualValue).toEqual(expectedValue);
7570
});
76-
77-
it('should call reset on the control form', () => {
78-
component.reset();
79-
expect(component.controlForm.reset).toHaveBeenCalled();
80-
});
8171
});

src/app/access-control/bulk-access/settings/bulk-access-settings.component.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,4 @@ export class BulkAccessSettingsComponent {
2222
getValue() {
2323
return this.controlForm.getFormValue();
2424
}
25-
26-
/**
27-
* Reset the form to its initial state
28-
* This will also reset the state of the child components (bitstream and item access)
29-
*/
30-
reset() {
31-
this.controlForm.reset();
32-
}
33-
3425
}

src/app/access-control/epeople-registry/epeople-registry.component.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import { RequestService } from '../../core/data/request.service';
2727
import { PaginationService } from '../../core/pagination/pagination.service';
2828
import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub';
2929
import { FindListOptions } from '../../core/data/find-list-options.model';
30-
import { UUIDService } from '../../core/shared/uuid.service';
31-
import { getMockUUIDService } from '../../shared/mocks/uuid.service.mock';
3230

3331
describe('EPeopleRegistryComponent', () => {
3432
let component: EPeopleRegistryComponent;
@@ -141,8 +139,7 @@ describe('EPeopleRegistryComponent', () => {
141139
{ provide: FormBuilderService, useValue: builderService },
142140
{ provide: Router, useValue: new RouterStub() },
143141
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
144-
{ provide: PaginationService, useValue: paginationService },
145-
{ provide: UUIDService, useValue: getMockUUIDService() }
142+
{ provide: PaginationService, useValue: paginationService }
146143
],
147144
schemas: [NO_ERRORS_SCHEMA]
148145
}).compileComponents();

src/app/access-control/epeople-registry/epeople-registry.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { NoContent } from '../../core/shared/NoContent.model';
2323
import { PaginationService } from '../../core/pagination/pagination.service';
2424
import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
2525
import { getEPersonEditRoute, getEPersonsRoute } from '../access-control-routing-paths';
26-
import { UUIDService } from '../../core/shared/uuid.service';
2726

2827
@Component({
2928
selector: 'ds-epeople-registry',
@@ -61,7 +60,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
6160
* Pagination config used to display the list of epeople
6261
*/
6362
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
64-
id: this.uuidService.generate(),
63+
id: 'elp',
6564
pageSize: 5,
6665
currentPage: 1
6766
});
@@ -92,8 +91,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
9291
private modalService: NgbModal,
9392
private paginationService: PaginationService,
9493
public requestService: RequestService,
95-
public dsoNameService: DSONameService,
96-
private uuidService: UUIDService) {
94+
public dsoNameService: DSONameService) {
9795
this.currentSearchQuery = '';
9896
this.currentSearchScope = 'metadata';
9997
this.searchForm = this.formBuilder.group(({

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h2 class="border-bottom pb-2">{{messagePrefix + '.edit' | translate}}</h2>
1616
[formModel]="formModel"
1717
[formGroup]="formGroup"
1818
[formLayout]="formLayout"
19-
[displayCancel]="false"
19+
[displayReset]="false"
2020
[submitLabel]="submitLabel"
2121
(submitForm)="onSubmit()">
2222
<div before class="btn-group">

0 commit comments

Comments
 (0)