Skip to content

Commit 54db43a

Browse files
author
Andrea Barbasso
committed
Merged dspace-cris-2024_02_x into task/dspace-cris-2024_02_x/DSC-2668
2 parents 608fa8f + f4f95d6 commit 54db43a

File tree

74 files changed

+949
-342
lines changed

Some content is hidden

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

74 files changed

+949
-342
lines changed

bitbucket-pipelines.yml

Lines changed: 78 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ definitions:
6262
- step: &angular-build
6363
name: angular-build
6464
image:
65-
name: cypress/browsers:node-18.20.3-chrome-125.0.6422.141-1-ff-126.0.1-edge-125.0.2535.85-1
65+
name: cypress/browsers:node-20.18.0-chrome-130.0.6723.69-1-ff-131.0.3-edge-130.0.2849.52-1
6666
run-as-user: 1000
6767
size: 4x
6868
caches:
@@ -78,7 +78,7 @@ definitions:
7878
- step: &unittest-code-checks
7979
name: test-code-checks
8080
image:
81-
name: cypress/browsers:node-18.20.3-chrome-125.0.6422.141-1-ff-126.0.1-edge-125.0.2535.85-1
81+
name: cypress/browsers:node-20.18.0-chrome-130.0.6723.69-1-ff-131.0.3-edge-130.0.2849.52-1
8282
run-as-user: 1000
8383
size: 4x
8484
caches:
@@ -96,7 +96,7 @@ definitions:
9696
- step: &run-e2e-tests
9797
name: Run E2E test
9898
image:
99-
name: cypress/browsers:node-18.20.3-chrome-125.0.6422.141-1-ff-126.0.1-edge-125.0.2535.85-1
99+
name: cypress/browsers:node-20.18.0-chrome-130.0.6723.69-1-ff-131.0.3-edge-130.0.2849.52-1
100100
run-as-user: 0
101101
size: 4x
102102
services:
@@ -105,6 +105,7 @@ definitions:
105105
- node-2024-02-x
106106
- cypress-2024-02-x
107107
script:
108+
- wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | tee /etc/apt/trusted.gpg.d/google.asc >/dev/null
108109
- apt-get update && apt-get install -y curl
109110
- export HASH_COMMIT=${BITBUCKET_COMMIT:0:8}
110111
- echo "Running tests for commit $HASH_COMMIT"
@@ -145,7 +146,7 @@ definitions:
145146
- npx cypress install
146147
- yarn serve:ssr &
147148
- echo "Waiting for server to start..."
148-
- sleep 10
149+
- sleep 60
149150
- echo "Running Cypress tests..."
150151
- yarn cypress:run --env chromeFlags="$CHROME_FLAGS"
151152
- echo "Test execution completed"
@@ -215,7 +216,7 @@ definitions:
215216
- 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)}')
216217
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
217218
- cd dspace-values
218-
- '[ -f "test/${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" "test/${BRANCH_FILE}" && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "test/${BRANCH_FILE}"'
219+
- '[ -f */test/"${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" */test/"${BRANCH_FILE}" && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" */test/"${BRANCH_FILE}"'
219220
- git config --global user.email "${BB_EMAIL}"
220221
- git config --global user.name "${BB_USER}"
221222
- git commit -am "Update TAG with ${BRANCH_NAME}-${HASH_COMMIT}" || echo "No changes to commit"
@@ -260,44 +261,65 @@ definitions:
260261
- 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)}')
261262
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
262263
- cd dspace-values
263-
- '[ -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/" "staging/${BRANCH_FILE}"'
264265
- git config --global user.email "${BB_USER}"
265266
- git config --global user.name "${BB_EMAIL}"
266267
- git commit -am "Enable test environment for ${BRANCH_NAME}" || echo "No changes to commit"
267268
- git push
268269

269-
- step: &find-and-invalidate-cloudfront-dev
270-
name: Invalidate CloudFront Dev Cache
270+
- step: &find-cloudfront-dev
271+
name: Find CloudFront Dev Cache
271272
image: amazon/aws-cli
272273
script:
273274
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
274275
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
275276
- export AWS_DEFAULT_REGION=$AWS_REGION
276277
- export CLOUDFRONT_NAME=$(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)}')
277278
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='dev--${CLOUDFRONT_NAME}'].Id" --output text)
278-
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" || echo "CloudFront distribution $CLOUDFRONT_DISTRIBUTION_ID not found — skipping invalidation."
279+
- echo "cloudfront_distribution=$CLOUDFRONT_DISTRIBUTION_ID" >> $BITBUCKET_PIPELINES_VARIABLES_PATH
280+
output-variables:
281+
- cloudfront_distribution
279282

280-
- step: &find-and-invalidate-cloudfront-staging
281-
name: Invalidate CloudFront Staging Cache
283+
- step: &find-cloudfront-staging
284+
name: Find CloudFront Staging Cache
282285
image: amazon/aws-cli
283286
script:
284287
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
285288
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
286289
- export AWS_DEFAULT_REGION=$AWS_REGION
287290
- export CLOUDFRONT_NAME=$(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)}')
288291
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='staging--${CLOUDFRONT_NAME}'].Id" --output text)
289-
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" || echo "CloudFront distribution $CLOUDFRONT_DISTRIBUTION_ID not found — skipping invalidation."
292+
- echo "cloudfront_distribution=$CLOUDFRONT_DISTRIBUTION_ID" >> $BITBUCKET_PIPELINES_VARIABLES_PATH
293+
output-variables:
294+
- cloudfront_distribution
290295

291-
- step: &find-and-invalidate-cloudfront-test
292-
name: Invalidate CloudFront Test Cache
296+
- step: &invalidate-cloudfront
297+
name: Invalidate CloudFront Cache
298+
image: amazon/aws-cli
299+
condition:
300+
state: cloudfront_distribution != ""
301+
script:
302+
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
303+
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
304+
- export AWS_DEFAULT_REGION=$AWS_REGION
305+
- |
306+
if ! aws cloudfront create-invalidation --distribution-id $cloudfront_distribution --paths "/*"; then
307+
echo "CloudFront invalidation failed for distribution ID: $cloudfront_distribution"
308+
exit 1
309+
fi
310+
311+
- step: &find-cloudfront-test
312+
name: Find CloudFront Test Cache
293313
image: amazon/aws-cli
294314
script:
295315
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
296316
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
297317
- export AWS_DEFAULT_REGION=$AWS_REGION
298318
- export CLOUDFRONT_NAME=$(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)}')
299319
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='test--${CLOUDFRONT_NAME}'].Id" --output text)
300-
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" || echo "CloudFront distribution $CLOUDFRONT_DISTRIBUTION_ID not found — skipping invalidation."
320+
- echo "cloudfront_distribution=$CLOUDFRONT_DISTRIBUTION_ID" >> $BITBUCKET_PIPELINES_VARIABLES_PATH
321+
output-variables:
322+
- cloudfront_distribution
301323

302324
- step: &check-branch-name-allowed
303325
name: Check allowed branch name
@@ -311,6 +333,23 @@ definitions:
311333
exit 1
312334
fi
313335
336+
- step: &merge-prod-into-test
337+
name: Merge prod into test
338+
image: atlassian/default-image:4
339+
script:
340+
- export PROD_BRANCH="$BITBUCKET_BRANCH"
341+
- export TEST_BRANCH="test/${PROD_BRANCH#prod/}"
342+
- git fetch origin $TEST_BRANCH || true
343+
- if git ls-remote --exit-code --heads origin $TEST_BRANCH; then
344+
git remote set-branches --add origin $TEST_BRANCH;
345+
git fetch origin $TEST_BRANCH;
346+
git checkout -b $TEST_BRANCH origin/$TEST_BRANCH;
347+
git merge --no-ff origin/$PROD_BRANCH -m "Merge $PROD_BRANCH into $TEST_BRANCH";
348+
git push https://${DSPACE_REPO_USER}:${DSPACE_REPO_TOKEN}@${DSPACE_ANGULAR_REPO} $TEST_BRANCH;
349+
else
350+
echo "Branch $TEST_BRANCH does not exist, no merge performed.";
351+
fi
352+
314353
pipelines:
315354
custom:
316355
e2e-on-custom-backend:
@@ -323,13 +362,22 @@ pipelines:
323362
- step: *angular-build
324363
- step: *build-and-push
325364
- step: *deploy-on-dev
326-
- step: *find-and-invalidate-cloudfront-dev
365+
- step: *find-cloudfront-dev
366+
- step: *invalidate-cloudfront
327367
deploy-on-staging:
328368
- step: *check-branch-name-allowed
329369
- step: *angular-build
330370
- step: *build-and-push
331371
- step: *deploy-on-staging
332-
- step: *find-and-invalidate-cloudfront-staging
372+
- step: *find-cloudfront-staging
373+
- step: *invalidate-cloudfront
374+
deploy-on-test:
375+
- step: *check-branch-name-allowed
376+
- step: *angular-build
377+
- step: *build-and-push
378+
- step: *deploy-on-test
379+
- step: *find-cloudfront-test
380+
- step: *invalidate-cloudfront
333381
turn-on-dev:
334382
- step: *turn-on-dev
335383
turn-on-staging:
@@ -349,27 +397,33 @@ pipelines:
349397
- parallel: *parallel-run-tests
350398
- step: *build-and-push
351399
- step: *deploy-on-dev
352-
- step: *find-and-invalidate-cloudfront-dev
400+
- step: *find-cloudfront-dev
401+
- step: *invalidate-cloudfront
353402
- step: *deploy-on-staging
354-
- step: *find-and-invalidate-cloudfront-staging
355-
'prod/**':
403+
- step: *find-cloudfront-staging
404+
- step: *invalidate-cloudfront
405+
"prod/**":
356406
- step: *check-branch-name-allowed
357407
- step: *preliminary-operation
358408
- step: *angular-build
359409
- parallel: *parallel-run-tests
360410
- step: *build-and-push
361411
- step: *deploy-on-dev
362-
- step: *find-and-invalidate-cloudfront-dev
412+
- step: *find-cloudfront-dev
413+
- step: *invalidate-cloudfront
363414
- step: *deploy-on-staging
364-
- step: *find-and-invalidate-cloudfront-staging
365-
'test/**':
415+
- step: *find-cloudfront-staging
416+
- step: *invalidate-cloudfront
417+
- step: *merge-prod-into-test
418+
"test/**":
366419
- step: *check-branch-name-allowed
367420
- step: *preliminary-operation
368421
- step: *angular-build
369422
- parallel: *parallel-run-tests
370423
- step: *build-and-push
371424
- step: *deploy-on-test
372-
- step: *find-and-invalidate-cloudfront-test
425+
- step: *find-cloudfront-test
426+
- step: *invalidate-cloudfront
373427

374428
pull-requests:
375429
'**':

cypress/e2e/my-dspace.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('My DSpace page', () => {
119119
// Open the New Import dropdown
120120
cy.get('button[data-test="import-dropdown"]').click();
121121
// Click on the "Item" type in that dropdown
122-
cy.get('#importControlsDropdownMenu button[title="Equipment"]').click();
122+
cy.get('#importControlsDropdownMenu button[title="Funding"]').click();
123123

124124
// New URL should include /import-external, as we've moved to the import page
125125
cy.url().should('include', '/import-external');

cypress/support/e2e.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ import 'cypress-axe';
2121

2222
import { DSPACE_XSRF_COOKIE } from 'src/app/core/xsrf/xsrf.constants';
2323

24+
// We might receive uncaught exceptions from external libraries (e.g. it happened before with a broken
25+
// version of the addToAny plugin). These should not cause our tests to fail, so we catch them here.
26+
Cypress.on('uncaught:exception', (err, runnable) => {
27+
// returning false here prevents Cypress from failing the test
28+
return false;
29+
});
30+
2431
// Runs once before all tests
2532
before(() => {
2633
// Cypress doesn't have access to the running application in Node.js.

src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class AdminSidebarSectionComponent extends MenuSectionComponent implement
5353
}
5454

5555
ngOnInit(): void {
56-
this.isDisabled = this.itemModel?.disabled || isEmpty(this.itemModel?.link);
56+
this.isDisabled = this.itemModel?.disabled || (isEmpty(this.itemModel?.link) && isEmpty(this.itemModel?.href));
5757
super.ngOnInit();
5858
}
5959

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,69 @@
11
<div class="container">
2-
<div class="d-flex">
3-
<h2 class="flex-grow-1">{{'audit.object.overview.title' | translate}}</h2>
4-
</div>
2+
<div class="d-flex">
3+
<h2 class="flex-grow-1">{{ 'audit.object.overview.title' | translate }}</h2>
4+
</div>
55

6-
<ng-container *ngIf="object">
7-
<h4 class="mt-4 mb-4">{{ object.name }} (<em>{{object.type}}</em>)</h4>
6+
<ng-container *ngIf="object">
7+
<h4 class="mt-4 mb-4">{{ object.name }} (<em>{{ object.type }}</em>)</h4>
88

9-
<ng-container *ngIf="(auditsRD$ | async)?.payload as audits">
9+
<ng-container *ngIf="(auditsRD$ | async)?.payload as audits">
1010

11-
<div *ngIf="audits.totalElements === 0">
12-
No audits found.
13-
</div>
14-
15-
<ds-pagination *ngIf="audits.totalElements > 0"
16-
[paginationOptions]="pageConfig"
17-
[collectionSize]="audits.totalElements"
18-
[hideGear]="true"
19-
[hidePagerWhenSinglePage]="true">
11+
<div *ngIf="audits.totalElements === 0">
12+
No audits found.
13+
</div>
2014

21-
<div class="table-responsive">
22-
<table class="table table-striped table-hover">
23-
<thead>
24-
<tr>
25-
<!-- <th>{{ 'audit.overview.table.id' | translate }}</th> -->
26-
<th>{{ 'audit.overview.table.entityType' | translate }}</th>
27-
<th>{{ 'audit.overview.table.eperson' | translate }}</th>
28-
<th>{{ 'audit.overview.table.timestamp' | translate }}</th>
29-
<th>Other Object</th>
30-
</tr>
31-
</thead>
32-
<tbody>
33-
<tr *ngFor="let audit of audits.page">
34-
<!-- <td><a [routerLink]="['/auditlogs/', audit.id]">{{audit.id}}</a></td> -->
35-
<td>{{ audit.eventType }}</td>
36-
<td *ngVar="(getEpersonName(audit) | async) as ePersonName">{{ePersonName}}</td>
37-
<td>{{ audit.timeStamp | date:dateFormat}}</td>
38-
<td>
39-
<span *ngIf="object.id === audit.objectUUID">
40-
<!-- object.id === audit.objectUUID -->
41-
<ng-container *ngIf="(getOtherObject(audit, object.id) | async) as subject">
42-
<ng-container *ngIf="subject">
43-
{{ subject.name }} <em>({{ subject.type }})</em>
44-
</ng-container>
45-
</ng-container>
46-
</span>
15+
<ds-pagination *ngIf="audits.totalElements > 0"
16+
[paginationOptions]="pageConfig"
17+
[collectionSize]="audits.totalElements"
18+
[hideGear]="true"
19+
[hidePagerWhenSinglePage]="true">
4720

48-
<span *ngIf="object.id === audit.subjectUUID">
49-
<!-- object.id === audit.subjectUUID -->
50-
</span>
51-
</td>
52-
</tr>
53-
</tbody>
54-
</table>
55-
</div>
56-
</ds-pagination>
21+
<div class="table-responsive">
22+
<table class="table table-striped table-hover">
23+
<thead>
24+
<tr>
25+
<!-- <th>{{ 'audit.overview.table.id' | translate }}</th> -->
26+
<th>{{ 'audit.overview.table.entityType' | translate }}</th>
27+
<th>{{ 'audit.overview.table.eperson' | translate }}</th>
28+
<th>{{ 'audit.overview.table.timestamp' | translate }}</th>
29+
<th>Other Object</th>
30+
</tr>
31+
</thead>
32+
<tbody>
33+
<tr *ngFor="let audit of audits?.page; trackBy: trackById">
34+
<!-- <td><a [routerLink]="['/auditlogs/', audit.id]">{{audit.id}}</a></td> -->
35+
<td>{{ audit.eventType }}</td>
36+
<td>
37+
<span *ngIf="(audit.epersonName | async) as epersonName; else noEperson">{{epersonName}}</span>
38+
<ng-template #noEperson><em>{{ 'audit.overview.table.eperson.anonymous' | translate }}</em></ng-template>
39+
</td>
40+
<td>{{ audit.timeStamp | date:dateFormat }}</td>
41+
<td>
42+
<span *ngIf="object.id === audit.objectUUID">
43+
<!-- object.id === audit.objectUUID -->
44+
<ng-container *ngIf="(audit.subject | async) as subject">
45+
{{ subject.name }} <em>({{ subject.type }})</em>
46+
</ng-container>
47+
</span>
48+
<span *ngIf="object.id === audit.subjectUUID">
49+
<!-- object.id === audit.subjectUUID -->
50+
</span>
51+
</td>
52+
</tr>
53+
</tbody>
54+
</table>
55+
</div>
56+
</ds-pagination>
5757

58-
<a class="btn btn-light mt-3" [routerLink]="['/items', object.id]"><i class="fas fa-arrow-left"></i> Back to Item</a>
58+
<a class="btn btn-light mt-3" [routerLink]="['/items', object.id]"><i class="fas fa-arrow-left"></i> Back to Item</a>
5959

60-
<!-- <a class="btn btn-light mt-3" [routerLink]="'/auditlogs'">{{'audit.detail.back' | translate}}</a> -->
60+
<!-- <a class="btn btn-light mt-3" [routerLink]="'/auditlogs'">{{'audit.detail.back' | translate}}</a> -->
6161

62-
</ng-container>
62+
</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"
65+
*ngIf="(auditsRD$ | async)?.statusCode === 404">{{ 'audit.object.overview.disabled.message' | translate }}</h4>
6566

66-
</ng-container>
67+
</ng-container>
6768

6869
</div>

0 commit comments

Comments
 (0)