Skip to content

Commit 87e4a33

Browse files
author
Andrea Barbasso
committed
Merge branch 'main' into task/main/DURACOM-309_from-community-main
# Conflicts: # src/app/footer/footer.component.ts
2 parents 9be8a87 + 98da220 commit 87e4a33

116 files changed

Lines changed: 4185 additions & 3135 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.

.github/workflows/build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,37 @@ jobs:
270270
echo "$result"
271271
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental &amp; Architectural Phenomenology Vol. 28, No. 1"
272272
273+
# Verify 301 Handle redirect behavior
274+
# Note: /handle/123456789/260 is the same test Publication used by our e2e tests
275+
- name: Verify 301 redirect from '/handle' URLs
276+
run: |
277+
result=$(wget --server-response --quiet http://127.0.0.1:4000/handle/123456789/260 2>&1 | head -1 | awk '{print $2}')
278+
echo "$result"
279+
[[ "$result" -eq "301" ]]
280+
281+
# Verify 403 error code behavior
282+
- name: Verify 403 error code from '/403'
283+
run: |
284+
result=$(wget --server-response --quiet http://127.0.0.1:4000/403 2>&1 | head -1 | awk '{print $2}')
285+
echo "$result"
286+
[[ "$result" -eq "403" ]]
287+
288+
# Verify 404 error code behavior
289+
- name: Verify 404 error code from '/404' and on invalid pages
290+
run: |
291+
result=$(wget --server-response --quiet http://127.0.0.1:4000/404 2>&1 | head -1 | awk '{print $2}')
292+
echo "$result"
293+
result2=$(wget --server-response --quiet http://127.0.0.1:4000/invalidurl 2>&1 | head -1 | awk '{print $2}')
294+
echo "$result2"
295+
[[ "$result" -eq "404" && "$result2" -eq "404" ]]
296+
297+
# Verify 500 error code behavior
298+
- name: Verify 500 error code from '/500'
299+
run: |
300+
result=$(wget --server-response --quiet http://127.0.0.1:4000/500 2>&1 | head -1 | awk '{print $2}')
301+
echo "$result"
302+
[[ "$result" -eq "500" ]]
303+
273304
- name: Stop running app
274305
run: kill -9 $(lsof -t -i:4000)
275306

config/config.example.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,24 @@ ssr:
2323
# Determining which styles are critical is a relatively expensive operation; this option is
2424
# disabled (false) by default to boost server performance at the expense of loading smoothness.
2525
inlineCriticalCss: false
26-
# Path prefixes to enable SSR for. By default these are limited to paths of primary DSpace objects.
27-
# NOTE: The "/handle/" path ensures Handle redirects work via SSR. The "/reload/" path ensures
28-
# hard refreshes (e.g. after login) trigger SSR while fully reloading the page.
29-
paths: [ '/home', '/items/', '/entities/', '/collections/', '/communities/', '/bitstream/', '/bitstreams/', '/handle/', '/reload/' ]
26+
# Patterns to be run as regexes against the path of the page to check if SSR is allowed.
27+
# If the path match any of the regexes it will be served directly in CSR.
28+
# By default, excludes community and collection browse, global browse, global search, community list, statistics and various administrative tools.
29+
excludePathPatterns:
30+
- pattern: "^/communities/[a-f0-9-]{36}/browse(/.*)?$",
31+
flag: "i"
32+
- pattern: "^/collections/[a-f0-9-]{36}/browse(/.*)?$"
33+
flag: "i"
34+
- pattern: "^/browse/"
35+
- pattern: "^/search$"
36+
- pattern: "^/community-list$"
37+
- pattern: "^/admin/"
38+
- pattern: "^/processes/?"
39+
- pattern: "^/notifications/"
40+
- pattern: "^/statistics/?"
41+
- pattern: "^/access-control/"
42+
- pattern: "^/health$"
43+
3044
# Whether to enable rendering of Search component on SSR.
3145
# If set to true the component will be included in the HTML returned from the server side rendering.
3246
# If set to false the component will not be included in the HTML returned from the server side rendering.

cypress/e2e/header.cy.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ describe('Header', () => {
1515
cy.visit('/');
1616

1717
// Click the language switcher (globe) in header
18-
cy.get('a[data-test="lang-switch"]').click();
18+
cy.get('button[data-test="lang-switch"]').click();
1919
// Click on the "Deusch" language in dropdown
20-
cy.get('#language-menu-list li').contains('Deutsch').click();
20+
cy.get('#language-menu-list div[role="option"]').contains('Deutsch').click();
2121

2222
// HTML "lang" attribute should switch to "de"
2323
cy.get('html').invoke('attr', 'lang').should('eq', 'de');
2424

2525
// Login menu should now be in German
26-
cy.get('a[data-test="login-menu"]').contains('Anmelden');
26+
cy.get('[data-test="login-menu"]').contains('Anmelden');
2727

2828
// Change back to English from language switcher
29-
cy.get('a[data-test="lang-switch"]').click();
30-
cy.get('#language-menu-list li').contains('English').click();
29+
cy.get('button[data-test="lang-switch"]').click();
30+
cy.get('#language-menu-list div[role="option"]').contains('English').click();
3131

3232
// HTML "lang" attribute should switch to "en"
3333
cy.get('html').invoke('attr', 'lang').should('eq', 'en');
3434

3535
// Login menu should now be in English
36-
cy.get('a[data-test="login-menu"]').contains('Log In');
36+
cy.get('[data-test="login-menu"]').contains('Log In');
3737
});
3838
});

cypress/e2e/homepage.cy.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ describe('Homepage', () => {
2626
// Wait for homepage tag to appear
2727
cy.get('ds-home-page').should('be.visible');
2828

29+
// Wait for at least one loading component to show up
30+
cy.get('ds-loading').should('exist');
31+
32+
// Wait until all loading components have disappeared
33+
cy.get('ds-loading').should('not.exist');
34+
2935
// Analyze <ds-home-page> for accessibility issues
3036
testA11y('ds-home-page');
3137
});

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"colors": "^1.4.0",
125125
"compression": "^1.7.5",
126126
"cookie-parser": "1.4.7",
127-
"core-js": "^3.41.0",
127+
"core-js": "^3.42.0",
128128
"date-fns": "^2.29.3",
129129
"date-fns-tz": "^1.3.7",
130130
"deepmerge": "^4.3.1",
@@ -232,12 +232,12 @@
232232
"postcss-loader": "^4.0.3",
233233
"postcss-preset-env": "^7.4.2",
234234
"rimraf": "^3.0.2",
235-
"sass": "~1.87.0",
235+
"sass": "~1.88.0",
236236
"sass-loader": "^12.6.0",
237237
"sass-resources-loader": "^2.2.5",
238238
"ts-node": "^8.10.2",
239239
"typescript": "~5.4.5",
240-
"webpack": "5.99.7",
240+
"webpack": "5.99.8",
241241
"webpack-cli": "^5.1.4",
242242
"webpack-dev-server": "^4.15.1"
243243
}

server.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import {
5858
REQUEST,
5959
RESPONSE,
6060
} from './src/express.tokens';
61+
import { SsrExcludePatterns } from "./src/config/ssr-config.interface";
6162

6263
/*
6364
* Set path for the browser application's dist folder
@@ -221,7 +222,7 @@ export function app() {
221222
* The callback function to serve server side angular
222223
*/
223224
function ngApp(req, res, next) {
224-
if (environment.ssr.enabled && req.method === 'GET' && (req.path === '/' || environment.ssr.paths.some(pathPrefix => req.path.startsWith(pathPrefix)))) {
225+
if (environment.ssr.enabled && req.method === 'GET' && (req.path === '/' || !isExcludedFromSsr(req.path, environment.ssr.excludePathPatterns))) {
225226
// Render the page to user via SSR (server side rendering)
226227
serverSideRender(req, res, next);
227228
} else {
@@ -627,6 +628,21 @@ function start() {
627628
}
628629
}
629630

631+
/**
632+
* Check if SSR should be skipped for path
633+
*
634+
* @param path
635+
* @param excludePathPattern
636+
*/
637+
function isExcludedFromSsr(path: string, excludePathPattern: SsrExcludePatterns[]): boolean {
638+
const patterns = excludePathPattern.map(p =>
639+
new RegExp(p.pattern, p.flag || '')
640+
);
641+
return patterns.some((regex) => {
642+
return regex.test(path)
643+
});
644+
}
645+
630646
/*
631647
* The callback function to serve health check requests
632648
*/

src/app/core/submission/submission-rest.service.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { getTestScheduler } from 'jasmine-marbles';
2+
import { of } from 'rxjs';
23
import { TestScheduler } from 'rxjs/testing';
34

45
import { FormFieldMetadataValueObject } from '../../shared/form/builder/models/form-field-metadata-value.model';
@@ -13,6 +14,7 @@ import {
1314
SubmissionRequest,
1415
} from '../data/request.models';
1516
import { RequestService } from '../data/request.service';
17+
import { RequestEntry } from '../data/request-entry.model';
1618
import { SubmissionRestService } from './submission-rest.service';
1719

1820
describe('SubmissionRestService test suite', () => {
@@ -38,7 +40,9 @@ describe('SubmissionRestService test suite', () => {
3840
}
3941

4042
beforeEach(() => {
41-
requestService = getMockRequestService();
43+
requestService = getMockRequestService(of(Object.assign(new RequestEntry(), {
44+
request: new SubmissionRequest('mock-request-uuid', 'mock-request-href'),
45+
})));
4246
rdbService = getMockRemoteDataBuildService();
4347
scheduler = getTestScheduler();
4448
halService = new HALEndpointServiceStub(resourceEndpointURL);
@@ -62,7 +66,7 @@ describe('SubmissionRestService test suite', () => {
6266
scheduler.schedule(() => service.getDataById(resourceEndpoint, resourceScope).subscribe());
6367
scheduler.flush();
6468

65-
expect(requestService.send).toHaveBeenCalledWith(expected);
69+
expect(requestService.send).toHaveBeenCalledWith(expected, false);
6670
});
6771
});
6872

0 commit comments

Comments
 (0)