Skip to content

Commit ae9e455

Browse files
Merged dspace-cris-2024_02_x into task/dspace-cris-2024_02_x/DSC-2734
2 parents b90781b + 2caf1fa commit ae9e455

157 files changed

Lines changed: 3248 additions & 1718 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.

bitbucket-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ definitions:
261261
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
262262
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
263263
- cd dspace-values
264-
- '[ -f */test/"${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "staging/${BRANCH_FILE}"'
264+
- '[ -f */test/"${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" */test/"${BRANCH_FILE}"'
265265
- git config --global user.email "${BB_USER}"
266266
- git config --global user.name "${BB_EMAIL}"
267267
- git commit -am "Enable test environment for ${BRANCH_NAME}" || echo "No changes to commit"

cypress/support/e2e.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ before(() => {
5757
cy.task('saveRestBaseDomain', baseDomain);
5858

5959
});
60+
61+
// We might receive uncaught exceptions from external libraries (e.g. it happened before with a broken
62+
// version of the addToAny plugin). These should not cause our tests to fail, so we catch them here.
63+
Cypress.on('uncaught:exception', (err, runnable) => {
64+
// returning false here prevents Cypress from failing the test
65+
return false;
66+
});
6067
});
6168

6269
// Runs once before the first test in each "block"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
"ng2-google-charts": "^7.0.0",
146146
"ng2-nouislider": "^2.0.0",
147147
"ngx-infinite-scroll": "^17.0.0",
148+
"ngx-matomo-client": "^6.4.1",
148149
"ngx-pagination": "6.0.3",
149150
"ngx-skeleton-loader": "^9.0.0",
150151
"nouislider": "^15.8.1",

src/app/admin/admin-edit-user-agreement/admin-edit-user-agreement.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="container">
22
<h2>{{'admin.edit-user-agreement.header' | translate}}</h2>
3-
<ds-alert [type]="'alert-info'" [dismissible]="true" [content]="'admin.edit-user-agreement.markdown' | translate"></ds-alert>
3+
<ds-alert *ngIf="showMarkdownInfo" [type]="'alert-info'" [dismissible]="true" [content]="'admin.edit-user-agreement.markdown' | translate"></ds-alert>
44
<div *ngFor="let userAgreementText of (userAgreementTexts | keyvalue)" class="form-group">
55
<label>{{userAgreementText.value.languageLabel}}</label>
66
<textarea class="col-md-12 m-2" [(ngModel)]="userAgreementText.value.text" rows="10"></textarea>

src/app/admin/admin-edit-user-agreement/admin-edit-user-agreement.component.spec.ts

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { CommonModule } from '@angular/common';
2-
import { NO_ERRORS_SCHEMA } from '@angular/core';
32
import {
4-
async,
53
ComponentFixture,
64
inject,
75
TestBed,
6+
waitForAsync,
87
} from '@angular/core/testing';
98
import {
109
FormsModule,
1110
ReactiveFormsModule,
1211
} from '@angular/forms';
1312
import { BrowserModule } from '@angular/platform-browser';
13+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
1414
import { RouterTestingModule } from '@angular/router/testing';
1515
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
1616
import {
@@ -22,6 +22,7 @@ import {
2222
of,
2323
} from 'rxjs';
2424

25+
import { APP_CONFIG } from '../../../config/app-config.interface';
2526
import { ScriptDataService } from '../../core/data/processes/script-data.service';
2627
import { SiteDataService } from '../../core/data/site-data.service';
2728
import { Site } from '../../core/shared/site.model';
@@ -39,6 +40,7 @@ describe('AdminEditUserAgreementComponent', () => {
3940
let notificationService: NotificationsServiceStub;
4041
let siteService: any;
4142
let scriptDataService: any;
43+
let mockAppConfig: any;
4244

4345
const site: Site = Object.assign(new Site(), {
4446
metadata: {
@@ -53,7 +55,7 @@ describe('AdminEditUserAgreementComponent', () => {
5355
},
5456
});
5557

56-
beforeEach(async(() => {
58+
beforeEach(waitForAsync(() => {
5759

5860
scriptDataService = {};
5961
notificationService = new NotificationsServiceStub();
@@ -62,21 +64,38 @@ describe('AdminEditUserAgreementComponent', () => {
6264
return of(site);
6365
},
6466
};
67+
mockAppConfig = {
68+
markdown: {
69+
showInfoOnCMSMetadataEditPages: true,
70+
},
71+
};
6572

6673
TestBed.configureTestingModule({
67-
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, RouterTestingModule,
74+
imports: [
75+
CommonModule,
76+
NgbModule,
77+
FormsModule,
78+
ReactiveFormsModule,
79+
BrowserModule,
80+
NoopAnimationsModule,
81+
RouterTestingModule,
6882
TranslateModule.forRoot({
6983
loader: {
7084
provide: TranslateLoader,
7185
useClass: TranslateLoaderMock,
7286
},
73-
}), AdminEditUserAgreementComponent],
74-
providers: [AdminEditUserAgreementComponent,
87+
}),
88+
AdminEditUserAgreementComponent,
89+
AlertComponent,
90+
],
91+
providers: [
92+
AdminEditUserAgreementComponent,
7593
{ provide: NotificationsService, useValue: notificationService },
7694
{ provide: SiteDataService, useValue: siteService },
77-
{ provide: ScriptDataService, useValue: scriptDataService }],
78-
schemas: [NO_ERRORS_SCHEMA],
79-
}).overrideComponent(AdminEditUserAgreementComponent, { remove: { imports: [AlertComponent] } }).compileComponents();
95+
{ provide: ScriptDataService, useValue: scriptDataService },
96+
{ provide: APP_CONFIG, useValue: mockAppConfig },
97+
],
98+
}).compileComponents();
8099
}));
81100

82101
beforeEach(() => {
@@ -89,7 +108,7 @@ describe('AdminEditUserAgreementComponent', () => {
89108
expect(comp).toBeDefined();
90109
}));
91110

92-
it('should fill the text areas with the dc.rights values', async(() => {
111+
it('should fill the text areas with the dc.rights values', waitForAsync(() => {
93112
expect(component.userAgreementTexts.get('en').text).toEqual('This is the End User Agreement text for this test');
94113
expect(component.userAgreementTexts.get('de').text).toEqual('Dies ist der Text der Endbenutzervereinbarung für diesen Test');
95114
}));

src/app/admin/admin-edit-user-agreement/admin-edit-user-agreement.component.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
} from '@angular/common';
55
import {
66
Component,
7+
Inject,
78
OnDestroy,
89
OnInit,
910
} from '@angular/core';
@@ -16,6 +17,10 @@ import {
1617
import { Operation } from 'fast-json-patch';
1718
import { Subscription } from 'rxjs';
1819

20+
import {
21+
APP_CONFIG,
22+
AppConfig,
23+
} from '../../../config/app-config.interface';
1924
import { environment } from '../../../environments/environment';
2025
import { ScriptDataService } from '../../core/data/processes/script-data.service';
2126
import { SiteDataService } from '../../core/data/site-data.service';
@@ -50,12 +55,18 @@ export class AdminEditUserAgreementComponent implements OnInit, OnDestroy {
5055

5156
USER_AGREEMENT_METADATA = 'dspace.agreements.end-user';
5257

58+
/**
59+
* show markdown info alert box
60+
*/
61+
showMarkdownInfo = this.appConfig.markdown.showInfoOnCMSMetadataEditPages;
62+
5363
constructor(private siteService: SiteDataService,
5464
private modalService: NgbModal,
5565
private translateService: TranslateService,
5666
private notificationsService: NotificationsService,
57-
private scriptDataService: ScriptDataService ) {
58-
67+
private scriptDataService: ScriptDataService,
68+
@Inject(APP_CONFIG) protected appConfig: AppConfig,
69+
) {
5970
}
6071

6172
ngOnInit(): void {

src/app/admin/edit-cms-metadata/edit-cms-metadata.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ <h3 class="mb-4">{{'menu.section.cms.edit.metadata.head' | translate}}</h3>
2222
<ng-template #editMetadataTemplate>
2323
<div class="container">
2424
<h2 class=" mb-5">{{'admin.edit-cms-metadata.title' | translate}} '{{selectedMetadata}}'</h2>
25+
<ds-alert *ngIf="showMarkdownInfo" [type]="'alert-info'" [dismissible]="true" [content]="'admin.edit-cms-metadata.markdown' | translate"></ds-alert>
2526
<div class="row">
2627
<div class="col-md">
2728
<div *ngFor="let lang of languageList" class="form-group">

src/app/admin/edit-cms-metadata/edit-cms-metadata.component.spec.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ import {
66
} from '@angular/core/testing';
77
import { FormsModule } from '@angular/forms';
88
import { By } from '@angular/platform-browser';
9+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
910
import {
1011
TranslateLoader,
1112
TranslateModule,
1213
} from '@ngx-translate/core';
1314
import { of } from 'rxjs';
1415

16+
import { APP_CONFIG } from '../../../config/app-config.interface';
1517
import { environment } from '../../../environments/environment.test';
1618
import { SiteDataService } from '../../core/data/site-data.service';
1719
import { Site } from '../../core/shared/site.model';
20+
import { AlertComponent } from '../../shared/alert/alert.component';
1821
import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock';
1922
import { NotificationsService } from '../../shared/notifications/notifications.service';
2023
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
@@ -33,6 +36,12 @@ describe('EditCmsMetadataComponent', () => {
3336
patch: jasmine.createSpy('patch'),
3437
});
3538

39+
const mockAppConfig = {
40+
markdown: {
41+
showInfoOnCMSMetadataEditPages: true,
42+
},
43+
};
44+
3645
const metadataValueMap = new Map([
3746
['en', ''],
3847
['de', ''],
@@ -48,17 +57,20 @@ describe('EditCmsMetadataComponent', () => {
4857
TestBed.configureTestingModule({
4958
imports: [
5059
FormsModule,
60+
NoopAnimationsModule,
5161
TranslateModule.forRoot({
5262
loader: {
5363
provide: TranslateLoader,
5464
useClass: TranslateLoaderMock,
5565
},
5666
}),
5767
EditCmsMetadataComponent,
68+
AlertComponent,
5869
],
5970
providers: [
6071
{ provide: NotificationsService, useValue: NotificationsServiceStub },
6172
{ provide: SiteDataService, useValue: siteServiceStub },
73+
{ provide: APP_CONFIG, useValue: mockAppConfig },
6274
],
6375
schemas: [NO_ERRORS_SCHEMA],
6476
}).compileComponents();
@@ -157,4 +169,30 @@ describe('EditCmsMetadataComponent', () => {
157169

158170
});
159171
});
172+
173+
describe('showMarkdownInfo property', () => {
174+
beforeEach(() => {
175+
fixture.detectChanges();
176+
});
177+
178+
it('should initialize showMarkdownInfo from appConfig.markdown.showInfoOnCMSMetadataEditPages', () => {
179+
expect(component.showMarkdownInfo).toBe(true);
180+
});
181+
182+
it('should show markdown info alert box when showMarkdownInfo is true', () => {
183+
component.editMode.next(true);
184+
component.showMarkdownInfo = true;
185+
fixture.detectChanges();
186+
const alertElement = fixture.debugElement.query(By.directive(AlertComponent));
187+
expect(alertElement).toBeTruthy();
188+
});
189+
190+
it('should hide markdown info alert box when showMarkdownInfo is false', () => {
191+
component.editMode.next(true);
192+
component.showMarkdownInfo = false;
193+
fixture.detectChanges();
194+
const alertElement = fixture.debugElement.query(By.directive(AlertComponent));
195+
expect(alertElement).toBeFalsy();
196+
});
197+
});
160198
});

src/app/admin/edit-cms-metadata/edit-cms-metadata.component.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from '@angular/common';
77
import {
88
Component,
9+
Inject,
910
OnInit,
1011
} from '@angular/core';
1112
import { FormsModule } from '@angular/forms';
@@ -17,10 +18,15 @@ import { Operation } from 'fast-json-patch';
1718
import { BehaviorSubject } from 'rxjs';
1819
import { BtnDisabledDirective } from 'src/app/shared/btn-disabled.directive';
1920

21+
import {
22+
APP_CONFIG,
23+
AppConfig,
24+
} from '../../../config/app-config.interface';
2025
import { environment } from '../../../environments/environment';
2126
import { SiteDataService } from '../../core/data/site-data.service';
2227
import { getFirstCompletedRemoteData } from '../../core/shared/operators';
2328
import { Site } from '../../core/shared/site.model';
29+
import { AlertComponent } from '../../shared/alert/alert.component';
2430
import { NotificationsService } from '../../shared/notifications/notifications.service';
2531

2632
/**
@@ -31,6 +37,9 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
3137
templateUrl: './edit-cms-metadata.component.html',
3238
styleUrls: ['./edit-cms-metadata.component.scss'],
3339
imports: [
40+
AlertComponent,
41+
AsyncPipe,
42+
BtnDisabledDirective,
3443
FormsModule,
3544
NgForOf,
3645
TranslateModule,
@@ -70,11 +79,16 @@ export class EditCmsMetadataComponent implements OnInit {
7079
* list of the metadata to be edited by the user
7180
*/
7281
metadataList: string[] = [];
82+
/**
83+
* show markdown info alert box
84+
*/
85+
showMarkdownInfo = this.appConfig.markdown.showInfoOnCMSMetadataEditPages;
7386

7487
constructor(
7588
private siteService: SiteDataService,
7689
private notificationsService: NotificationsService,
7790
private translateService: TranslateService,
91+
@Inject(APP_CONFIG) protected appConfig: AppConfig,
7892
) {
7993
}
8094

0 commit comments

Comments
 (0)