Skip to content

Commit 2ead58a

Browse files
author
abhinav
committed
Merge branch 'dspace-8_x' into cache-bust-dynamic-configuration-8.x
2 parents e10d7b5 + b8732f8 commit 2ead58a

File tree

360 files changed

+156080
-24566
lines changed

Some content is hidden

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

360 files changed

+156080
-24566
lines changed

.eslintrc.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"eslint-plugin-rxjs",
1313
"eslint-plugin-simple-import-sort",
1414
"eslint-plugin-import-newlines",
15-
"eslint-plugin-jsonc",
1615
"dspace-angular-ts",
1716
"dspace-angular-html"
1817
],
@@ -302,10 +301,13 @@
302301
"*.json5"
303302
],
304303
"extends": [
305-
"plugin:jsonc/recommended-with-jsonc"
304+
"plugin:jsonc/recommended-with-json5"
306305
],
307306
"rules": {
308-
"no-irregular-whitespace": "error",
307+
// The ESLint core no-irregular-whitespace rule doesn't work well in JSON
308+
// See: https://ota-meshi.github.io/eslint-plugin-jsonc/rules/no-irregular-whitespace.html
309+
"no-irregular-whitespace": "off",
310+
"jsonc/no-irregular-whitespace": "error",
309311
"no-trailing-spaces": "error",
310312
"jsonc/comma-dangle": [
311313
"error",

.github/workflows/build.yml

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
DSPACE_CACHE_SERVERSIDE_ANONYMOUSCACHE_MAX: 0
3030
# Tell Cypress to run e2e tests using the same UI URL
3131
CYPRESS_BASE_URL: http://127.0.0.1:4000
32+
# Disable the cookie consent banner in e2e tests to avoid errors because of elements hidden by it
33+
DSPACE_INFO_ENABLECOOKIECONSENTPOPUP: false
3234
# When Chrome version is specified, we pin to a specific version of Chrome
3335
# Comment this out to use the latest release
3436
#CHROME_VERSION: "90.0.4430.212-1"
@@ -190,12 +192,115 @@ jobs:
190192
# Get homepage and verify that the <meta name="title"> tag includes "DSpace".
191193
# If it does, then SSR is working, as this tag is created by our MetadataService.
192194
# This step also prints entire HTML of homepage for easier debugging if grep fails.
193-
- name: Verify SSR (server-side rendering)
195+
- name: Verify SSR (server-side rendering) on Homepage
194196
run: |
195197
result=$(wget -O- -q http://127.0.0.1:4000/home)
196198
echo "$result"
197199
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep DSpace
198200
201+
# Get a specific community in our test data and verify that the "<h1>" tag includes "Publications" (the community name).
202+
# If it does, then SSR is working.
203+
- name: Verify SSR on a Community page
204+
run: |
205+
result=$(wget -O- -q http://127.0.0.1:4000/communities/0958c910-2037-42a9-81c7-dca80e3892b4)
206+
echo "$result"
207+
echo "$result" | grep -oE "<h1 [^>]*>[^><]*</h1>" | grep Publications
208+
209+
# Get a specific collection in our test data and verify that the "<h1>" tag includes "Articles" (the collection name).
210+
# If it does, then SSR is working.
211+
- name: Verify SSR on a Collection page
212+
run: |
213+
result=$(wget -O- -q http://127.0.0.1:4000/collections/282164f5-d325-4740-8dd1-fa4d6d3e7200)
214+
echo "$result"
215+
echo "$result" | grep -oE "<h1 [^>]*>[^><]*</h1>" | grep Articles
216+
217+
# Get a specific publication in our test data and verify that the <meta name="title"> tag includes
218+
# the title of this publication. If it does, then SSR is working.
219+
- name: Verify SSR on a Publication page
220+
run: |
221+
result=$(wget -O- -q http://127.0.0.1:4000/entities/publication/6160810f-1e53-40db-81ef-f6621a727398)
222+
echo "$result"
223+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "An Economic Model of Mortality Salience"
224+
225+
# Get a specific person in our test data and verify that the <meta name="title"> tag includes
226+
# the name of the person. If it does, then SSR is working.
227+
- name: Verify SSR on a Person page
228+
run: |
229+
result=$(wget -O- -q http://127.0.0.1:4000/entities/person/b1b2c768-bda1-448a-a073-fc541e8b24d9)
230+
echo "$result"
231+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Simmons, Cameron"
232+
233+
# Get a specific project in our test data and verify that the <meta name="title"> tag includes
234+
# the name of the project. If it does, then SSR is working.
235+
- name: Verify SSR on a Project page
236+
run: |
237+
result=$(wget -O- -q http://127.0.0.1:4000/entities/project/46ccb608-a74c-4bf6-bc7a-e29cc7defea9)
238+
echo "$result"
239+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "University Research Fellowship"
240+
241+
# Get a specific orgunit in our test data and verify that the <meta name="title"> tag includes
242+
# the name of the orgunit. If it does, then SSR is working.
243+
- name: Verify SSR on an OrgUnit page
244+
run: |
245+
result=$(wget -O- -q http://127.0.0.1:4000/entities/orgunit/9851674d-bd9a-467b-8d84-068deb568ccf)
246+
echo "$result"
247+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Law and Development"
248+
249+
# Get a specific journal in our test data and verify that the <meta name="title"> tag includes
250+
# the name of the journal. If it does, then SSR is working.
251+
- name: Verify SSR on a Journal page
252+
run: |
253+
result=$(wget -O- -q http://127.0.0.1:4000/entities/journal/d4af6c3e-53d0-4757-81eb-566f3b45d63a)
254+
echo "$result"
255+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental &amp; Architectural Phenomenology"
256+
257+
# Get a specific journal volume in our test data and verify that the <meta name="title"> tag includes
258+
# the name of the volume. If it does, then SSR is working.
259+
- name: Verify SSR on a Journal Volume page
260+
run: |
261+
result=$(wget -O- -q http://127.0.0.1:4000/entities/journalvolume/07c6249f-4bf7-494d-9ce3-6ffdb2aed538)
262+
echo "$result"
263+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental &amp; Architectural Phenomenology Volume 28 (2017)"
264+
265+
# Get a specific journal issue in our test data and verify that the <meta name="title"> tag includes
266+
# the name of the issue. If it does, then SSR is working.
267+
- name: Verify SSR on a Journal Issue page
268+
run: |
269+
result=$(wget -O- -q http://127.0.0.1:4000/entities/journalissue/44c29473-5de2-48fa-b005-e5029aa1a50b)
270+
echo "$result"
271+
echo "$result" | grep -oE "<meta name=\"title\" [^>]*>" | grep "Environmental &amp; Architectural Phenomenology Vol. 28, No. 1"
272+
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+
199304
- name: Stop running app
200305
run: kill -9 $(lsof -t -i:4000)
201306

.github/workflows/codescan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ jobs:
4040
# Initializes the CodeQL tools for scanning.
4141
# https://github.com/github/codeql-action
4242
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@v2
43+
uses: github/codeql-action/init@v3
4444
with:
4545
languages: javascript
4646

4747
# Autobuild attempts to build any compiled languages
4848
- name: Autobuild
49-
uses: github/codeql-action/autobuild@v2
49+
uses: github/codeql-action/autobuild@v3
5050

5151
# Perform GitHub Code Scanning.
5252
- name: Perform CodeQL Analysis
53-
uses: github/codeql-action/analyze@v2
53+
uses: github/codeql-action/analyze@v3

config/config.example.yml

Lines changed: 31 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.
@@ -356,12 +370,20 @@ item:
356370

357371
# Community Page Config
358372
community:
373+
# Default tab to be shown when browsing a Community. Valid values are: comcols, search, or browse_<field>
374+
# <field> must be any of the configured "browse by" fields, e.g., dateissued, author, title, or subject
375+
# When the default tab is not the 'search' tab, the search tab is moved to the last position
376+
defaultBrowseTab: search
359377
# Search tab config
360378
searchSection:
361379
showSidebar: true
362380

363381
# Collection Page Config
364382
collection:
383+
# Default tab to be shown when browsing a Collection. Valid values are: search, or browse_<field>
384+
# <field> must be any of the configured "browse by" fields, e.g., dateissued, author, title, or subject
385+
# When the default tab is not the 'search' tab, the search tab is moved to the last position
386+
defaultBrowseTab: search
365387
# Search tab config
366388
searchSection:
367389
showSidebar: true
@@ -554,3 +576,8 @@ liveRegion:
554576
messageTimeOutDurationMs: 30000
555577
# The visibility of the live region. Setting this to true is only useful for debugging purposes.
556578
isVisible: false
579+
580+
# Configuration for storing accessibility settings, used by the AccessibilitySettingsService
581+
accessibility:
582+
# The duration in days after which the accessibility settings cookie expires
583+
cookieExpirationDuration: 7

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
});

0 commit comments

Comments
 (0)