Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to angular 16 #2871

Merged
merged 78 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
a98039c
update typescript
Feb 12, 2024
9b213b6
run ng update @angular/core@16 @angular/cli@16 --force
Feb 12, 2024
2195ca4
update custom-webpack
Feb 12, 2024
4e6d90b
import renderModule instead of renderModuleFactory
Feb 13, 2024
6cdb3d1
provide APP_ID instead of BrowserModule.withServerTransition, remove …
Feb 13, 2024
3794007
do not use componentFactories anymore
Feb 13, 2024
bc29293
change TransferState import
Feb 13, 2024
53e8b69
remove or update libraries
Feb 13, 2024
387f5ee
update missing dependencies
Feb 14, 2024
5ff253e
remove mathjax (it uses the xmldom-sre library, that has a documentEl…
Feb 14, 2024
0ce10b4
Upgrade ng2-file-upload to v5.0.0
Simone-Ramundi Feb 27, 2024
a2e3b08
[DURACOM-238] add missing imports in standalone component
Feb 27, 2024
377b217
[DURACOM-238] add missing imports in standalone component
Feb 27, 2024
6b538fa
Merged DURACOM-191-align-to-angular-16 into DURACOM-238-update-ng2-fi…
Feb 29, 2024
2660601
Merged in DURACOM-238-update-ng2-file-upload (pull request #1413)
Simone-Ramundi Feb 29, 2024
3051fa8
[DURACOM-237] - Added DragDropModule which replaced the SortablejsMod…
Simone-Ramundi Feb 29, 2024
3807a35
[DURACOM-237] - Refactoring ts based on @angular/cdk/drag-drop
Simone-Ramundi Feb 29, 2024
0c80b1a
[DURACOM-237] - Refactoring html based on @angular/cdk/drag-drop
Simone-Ramundi Feb 29, 2024
dbf6b9d
[DURACOM-237] - Refactoring scss based on @angular/cdk/drag-drop
Simone-Ramundi Feb 29, 2024
e092914
[DURACOM-237] - Refactoring html based on @angular/cdk/drag-drop
Simone-Ramundi Feb 29, 2024
9e724f3
[DURACOM-237] - Refactoring scss based on @angular/cdk/drag-drop
Simone-Ramundi Feb 29, 2024
61bf50e
[DURACOM-237] - Refactoring html based on @angular/cdk/drag-drop
Simone-Ramundi Feb 29, 2024
671fa8f
[DURACOM-237] - Refactoring html based on @angular/cdk/drag-drop
Simone-Ramundi Mar 1, 2024
478783f
[DURACOM-237] - Refactoring scss based on @angular/cdk/drag-drop
Simone-Ramundi Mar 1, 2024
4b0bf74
[DURACOM-237] - Refactoring html based on @angular/cdk/drag-drop
Simone-Ramundi Mar 4, 2024
6970f1e
[DURACOM-237] - Refactoring ts based on @angular/cdk/drag-drop
Simone-Ramundi Mar 4, 2024
3907bc1
[DURACOM-237] - Added imports inside ts component
Simone-Ramundi Mar 5, 2024
0c3dd8d
Merge branch 'DURACOM-191' into DURACOM-191-align-to-angular-16
Mar 15, 2024
c75c5f1
[DURACOM-234] lint fix
Mar 15, 2024
4bc7df8
[DURACOM-234] remove useless import
Mar 15, 2024
aa4e4e6
[DURACOM-234] fix build errors
Mar 15, 2024
0db7fff
Merge branch 'DURACOM-191' into DURACOM-234
atarix83 Mar 17, 2024
61d5f49
Merge branch 'DURACOM-234' into DURACOM-237-align-to-angular-16
atarix83 Mar 17, 2024
1e95fdb
[DURACOM-237] Fix lint
atarix83 Mar 17, 2024
3e03b71
[DURACOM-237] Add space before text
atarix83 Mar 17, 2024
083a904
Merged in DURACOM-237-align-to-angular-16 (pull request #1431)
Simone-Ramundi Mar 17, 2024
81b0d76
[DURACOM-240] Improve markdown pipe in order to check for empty values
atarix83 Feb 21, 2024
c6b72f6
[DURACOM-240] pre-tests changes
Feb 26, 2024
825308e
[DURACOM-240] working directive
Feb 26, 2024
68c9ef1
[DURACOM-240] refactor markdownPipe to markdownDirective
Feb 26, 2024
e402ac4
[DURACOM-240] split service into SSR and CSR
Feb 27, 2024
e1ba78c
[DURACOM-240] refactor variable
Feb 27, 2024
3e30f64
[DURACOM-240] add and fix tests
Feb 27, 2024
9e6fe52
[DURACOM-240] use BehaviorSubject
atarix83 Mar 17, 2024
66a9909
Merge branch 'DURACOM-191' into DURACOM-234
atarix83 Mar 18, 2024
4fdbf15
Merge branch 'DURACOM-234' into DURACOM-240-mathjax
atarix83 Mar 18, 2024
b214bb3
Merge branch 'DURACOM-191' into DURACOM-234
atarix83 Mar 20, 2024
9b6b79c
Merge branch 'DURACOM-234' into DURACOM-240-mathjax
atarix83 Mar 20, 2024
bef71a9
[DURACOM-234] Fix merge
atarix83 Mar 20, 2024
cfa2882
Merge branch 'DURACOM-234' into DURACOM-240-mathjax
atarix83 Mar 20, 2024
418f07b
[DURACOM-240] Assure the MathJax script has been registered before re…
atarix83 Mar 21, 2024
c072d5d
Merge branch 'main' into DURACOM-234
atarix83 Mar 21, 2024
152e724
[DURACOM-234] Fix tests
atarix83 Mar 21, 2024
e2bbb43
Merge branch 'DURACOM-234' into DURACOM-240-mathjax
atarix83 Mar 21, 2024
a652600
[DURACOM-234] Remove fdescribe
atarix83 Mar 21, 2024
b325701
[DURACOM-240] Fix test
atarix83 Mar 21, 2024
5d24691
Merged in DURACOM-240-mathjax (pull request #1488)
atarix83 Mar 21, 2024
abb284a
[DURACOM-237] Fix tests
atarix83 Mar 21, 2024
969b42f
[DURACOM-234] Fix tests
atarix83 Mar 21, 2024
e0855a4
[DURACOM-234] Remove unsupported node 16
atarix83 Mar 21, 2024
0c3e9b1
[DURACOM-234] Fix NG0600 error
atarix83 Mar 26, 2024
a8c3af0
[DURACOM-234] Switch to standalone bootstrapping API
atarix83 Mar 26, 2024
549609e
[DURACOM-234] Fix Markdown Config
atarix83 Mar 28, 2024
1f4aca8
[DURACOM-234] Migrate fo functional resolver
atarix83 Mar 28, 2024
5dbc6ce
[DURACOM-237] Fix issue on drag end
atarix83 Mar 29, 2024
29f5a17
[DURACOM-234] Migrate to functional guards WIP
atarix83 Mar 29, 2024
6a4ad7b
[DURACOM-234] Fix resolver name
atarix83 Apr 2, 2024
19548fc
[DURACOM-234] Move resolver dependency to relate functional one
atarix83 Apr 2, 2024
32b816c
[DURACOM-234] Made use of mapToCanActivate for all the guards which a…
atarix83 Apr 2, 2024
026e16f
[DURACOM-234] Fix tests
atarix83 Apr 2, 2024
b8c26a7
[DURACOM-234] Fixes after migrating to functional guards
atarix83 Apr 2, 2024
b49d883
[DURACOM-234] fix my-dspace.guard
atarix83 Apr 2, 2024
660cf7e
[DURACOM-234] Remove assertions on isResponsePending in favour of rem…
atarix83 Apr 2, 2024
aba0491
[DURACOM-234] Replace Observable with BehaviorSubject
atarix83 Apr 2, 2024
f1686d5
[DURACOM-234] rename resolvers in order to be complaint to function n…
atarix83 Apr 3, 2024
35714b7
[DURACOM-234] rename guards in order to be complaint to function name…
atarix83 Apr 3, 2024
32f1d10
Merge branch 'main' into DURACOM-234
atarix83 Apr 4, 2024
c327bf7
[DURACOM-234] Fix merge with main
atarix83 Apr 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
strategy:
# Create a matrix of Node versions to test against (in parallel)
matrix:
node-version: [16.x, 18.x]
node-version: [18.x, 20.x]
# Do NOT exit immediately if one matrix job fails
fail-fast: false
# These are the actual CI steps to perform per job
Expand Down
72 changes: 35 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,28 @@
"ts-node": "10.2.1"
},
"dependencies": {
"@angular/animations": "^15.2.8",
"@angular/cdk": "^15.2.8",
"@angular/common": "^15.2.8",
"@angular/compiler": "^15.2.8",
"@angular/core": "^15.2.8",
"@angular/forms": "^15.2.8",
"@angular/localize": "15.2.8",
"@angular/platform-browser": "^15.2.8",
"@angular/platform-browser-dynamic": "^15.2.8",
"@angular/platform-server": "^15.2.8",
"@angular/router": "^15.2.8",
"@angular/animations": "^16.2.12",
"@angular/cdk": "^16.2.12",
"@angular/common": "^16.2.12",
"@angular/compiler": "^16.2.12",
"@angular/core": "^16.2.12",
"@angular/forms": "^16.2.12",
"@angular/localize": "16.2.12",
"@angular/platform-browser": "^16.2.12",
"@angular/platform-browser-dynamic": "^16.2.12",
"@angular/platform-server": "^16.2.12",
"@angular/router": "^16.2.12",
"@babel/runtime": "7.21.0",
"@kolkov/ngx-gallery": "^2.0.1",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.11.3",
"@ng-bootstrap/ng-bootstrap": "^11.0.0",
"@ng-dynamic-forms/core": "^15.0.0",
"@ng-dynamic-forms/ui-ng-bootstrap": "^15.0.0",
"@ngrx/effects": "^15.4.0",
"@ngrx/router-store": "^15.4.0",
"@ngrx/store": "^15.4.0",
"@nguniversal/express-engine": "^15.2.1",
"@ng-dynamic-forms/core": "^16.0.0",
"@ng-dynamic-forms/ui-ng-bootstrap": "^16.0.0",
"@ngrx/effects": "^16.3.0",
"@ngrx/router-store": "^16.3.0",
"@ngrx/store": "^16.3.0",
"@nguniversal/express-engine": "^16.2.0",
"@ngx-translate/core": "^14.0.0",
"@nicky-lenaers/ngx-scroll-to": "^14.0.0",
"@types/grecaptcha": "^3.0.4",
Expand Down Expand Up @@ -110,17 +110,15 @@
"lodash": "^4.17.21",
"lru-cache": "^7.14.1",
"markdown-it": "^13.0.1",
"markdown-it-mathjax3": "^4.3.2",
"mirador": "^3.3.0",
"mirador-dl-plugin": "^0.13.0",
"mirador-share-plugin": "^0.11.0",
"morgan": "^1.10.0",
"ng-mocks": "^14.10.0",
"ng2-file-upload": "1.4.0",
"ng2-file-upload": "5.0.0",
"ng2-nouislider": "^2.0.0",
"ngx-infinite-scroll": "^15.0.0",
"ngx-infinite-scroll": "^16.0.0",
"ngx-pagination": "6.0.3",
"ngx-sortablejs": "^11.1.0",
"ngx-ui-switch": "^14.1.0",
"nouislider": "^15.7.1",
"pem": "1.14.7",
Expand All @@ -132,24 +130,24 @@
"sortablejs": "1.15.0",
"uuid": "^8.3.2",
"webfontloader": "1.6.28",
"zone.js": "~0.11.5"
"zone.js": "~0.13.3"
},
"devDependencies": {
"@angular-builders/custom-webpack": "~15.0.0",
"@angular-devkit/build-angular": "^15.2.6",
"@angular-eslint/builder": "15.2.1",
"@angular-eslint/eslint-plugin": "15.2.1",
"@angular-eslint/eslint-plugin-template": "15.2.1",
"@angular-eslint/schematics": "15.2.1",
"@angular-eslint/template-parser": "15.2.1",
"@angular/cli": "^16.0.4",
"@angular/compiler-cli": "^15.2.8",
"@angular/language-service": "^15.2.8",
"@angular-builders/custom-webpack": "~16.0.0",
"@angular-devkit/build-angular": "^16.2.12",
"@angular-eslint/builder": "16.3.1",
"@angular-eslint/eslint-plugin": "16.3.1",
"@angular-eslint/eslint-plugin-template": "16.3.1",
"@angular-eslint/schematics": "16.3.1",
"@angular-eslint/template-parser": "16.3.1",
"@angular/cli": "^16.2.12",
"@angular/compiler-cli": "^16.2.12",
"@angular/language-service": "^16.2.12",
"@cypress/schematic": "^1.5.0",
"@fortawesome/fontawesome-free": "^6.4.0",
"@ngrx/store-devtools": "^15.4.0",
"@ngtools/webpack": "^15.2.6",
"@nguniversal/builders": "^15.2.1",
"@ngrx/store-devtools": "^16.3.0",
"@ngtools/webpack": "^16.2.12",
"@nguniversal/builders": "^16.2.0",
"@types/deep-freeze": "0.1.2",
"@types/ejs": "^3.1.2",
"@types/express": "^4.17.17",
Expand Down Expand Up @@ -186,7 +184,7 @@
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"karma-mocha-reporter": "2.2.5",
"ngx-mask": "^13.1.7",
"ngx-mask": "14.2.4",
"nodemon": "^2.0.22",
"postcss": "^8.4",
"postcss-apply": "0.12.0",
Expand All @@ -202,7 +200,7 @@
"sass-loader": "^12.6.0",
"sass-resources-loader": "^2.2.5",
"ts-node": "^8.10.2",
"typescript": "~4.8.4",
"typescript": "~4.9.3",
"webpack": "5.76.1",
"webpack-bundle-analyzer": "^4.8.0",
"webpack-cli": "^4.2.0",
Expand Down
62 changes: 31 additions & 31 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { hasNoValue, hasValue } from './src/app/shared/empty.util';

import { UIServerConfig } from './src/config/ui-server-config.interface';

import { ServerAppModule } from './src/main.server';
import bootstrap from './src/main.server';

import { buildAppConfig } from './src/config/config.server';
import { APP_CONFIG, AppConfig } from './src/config/app-config.interface';
Expand Down Expand Up @@ -130,7 +130,7 @@ export function app() {
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
server.engine('html', (_, options, callback) =>
ngExpressEngine({
bootstrap: ServerAppModule,
bootstrap,
providers: [
{
provide: REQUEST,
Expand All @@ -142,10 +142,10 @@ export function app() {
},
{
provide: APP_CONFIG,
useValue: environment
}
]
})(_, (options as any), callback)
useValue: environment,
},
],
})(_, (options as any), callback),
);

server.engine('ejs', ejs.renderFile);
Expand All @@ -162,7 +162,7 @@ export function app() {
server.get('/robots.txt', (req, res) => {
res.setHeader('content-type', 'text/plain');
res.render('assets/robots.txt.ejs', {
'origin': req.protocol + '://' + req.headers.host
'origin': req.protocol + '://' + req.headers.host,
});
});

Expand All @@ -177,7 +177,7 @@ export function app() {
router.use('/sitemap**', createProxyMiddleware({
target: `${environment.rest.baseUrl}/sitemaps`,
pathRewrite: path => path.replace(environment.ui.nameSpace, '/'),
changeOrigin: true
changeOrigin: true,
}));

/**
Expand All @@ -186,7 +186,7 @@ export function app() {
router.use('/signposting**', createProxyMiddleware({
target: `${environment.rest.baseUrl}`,
pathRewrite: path => path.replace(environment.ui.nameSpace, '/'),
changeOrigin: true
changeOrigin: true,
}));

/**
Expand All @@ -197,7 +197,7 @@ export function app() {
const RateLimit = require('express-rate-limit');
const limiter = new RateLimit({
windowMs: (environment.ui as UIServerConfig).rateLimiter.windowMs,
max: (environment.ui as UIServerConfig).rateLimiter.max
max: (environment.ui as UIServerConfig).rateLimiter.max,
});
server.use(limiter);
}
Expand Down Expand Up @@ -325,7 +325,7 @@ function initCache() {
botCache = new LRU( {
max: environment.cache.serverSide.botCache.max,
ttl: environment.cache.serverSide.botCache.timeToLive,
allowStale: environment.cache.serverSide.botCache.allowStale
allowStale: environment.cache.serverSide.botCache.allowStale,
});
}

Expand All @@ -337,7 +337,7 @@ function initCache() {
anonymousCache = new LRU( {
max: environment.cache.serverSide.anonymousCache.max,
ttl: environment.cache.serverSide.anonymousCache.timeToLive,
allowStale: environment.cache.serverSide.anonymousCache.allowStale
allowStale: environment.cache.serverSide.anonymousCache.allowStale,
});
}
}
Expand Down Expand Up @@ -415,7 +415,7 @@ function checkCacheForRequest(cacheName: string, cache: LRU<string, any>, req, r
const key = getCacheKey(req);

// Check if this page is in our cache
let cachedCopy = cache.get(key);
const cachedCopy = cache.get(key);
if (cachedCopy) {
if (environment.cache.serverSide.debug) { console.log(`CACHE HIT FOR ${key} in ${cacheName} cache`); }

Expand Down Expand Up @@ -529,20 +529,20 @@ function serverStarted() {
function createHttpsServer(keys) {
const listener = createServer({
key: keys.serviceKey,
cert: keys.certificate
cert: keys.certificate,
}, app).listen(environment.ui.port, environment.ui.host, () => {
serverStarted();
});

// Graceful shutdown when signalled
const terminator = createHttpTerminator({server: listener});
const terminator = createHttpTerminator({ server: listener });
process.on('SIGINT', () => {
void (async ()=> {
console.debug('Closing HTTPS server on signal');
await terminator.terminate().catch(e => { console.error(e); });
console.debug('HTTPS server closed');
})();
});
void (async ()=> {
console.debug('Closing HTTPS server on signal');
await terminator.terminate().catch(e => { console.error(e); });
console.debug('HTTPS server closed');
})();
});
}

/**
Expand All @@ -559,14 +559,14 @@ function run() {
});

// Graceful shutdown when signalled
const terminator = createHttpTerminator({server: listener});
const terminator = createHttpTerminator({ server: listener });
process.on('SIGINT', () => {
void (async () => {
console.debug('Closing HTTP server on signal');
await terminator.terminate().catch(e => { console.error(e); });
console.debug('HTTP server closed.');return undefined;
})();
});
void (async () => {
console.debug('Closing HTTP server on signal');
await terminator.terminate().catch(e => { console.error(e); });
console.debug('HTTP server closed.');return undefined;
})();
});
}

function start() {
Expand Down Expand Up @@ -597,7 +597,7 @@ function start() {
if (serviceKey && certificate) {
createHttpsServer({
serviceKey: serviceKey,
certificate: certificate
certificate: certificate,
});
} else {
console.warn('Disabling certificate validation and proceeding with a self-signed certificate. If this is a production server, it is recommended that you configure a valid certificate instead.');
Expand All @@ -606,7 +606,7 @@ function start() {

createCertificate({
days: 1,
selfSigned: true
selfSigned: true,
}, (error, keys) => {
createHttpsServer(keys);
});
Expand All @@ -627,7 +627,7 @@ function healthCheck(req, res) {
})
.catch((error) => {
res.status(error.response.status).send({
error: error.message
error: error.message,
});
});
}
Expand Down
19 changes: 11 additions & 8 deletions src/app/access-control/access-control-routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { AbstractControl } from '@angular/forms';
import { Route } from '@angular/router';
import {
mapToCanActivate,
Route,
} from '@angular/router';
import {
DYNAMIC_ERROR_MESSAGES_MATCHER,
DynamicErrorMessagesMatcher,
Expand Down Expand Up @@ -43,7 +46,7 @@ export const ROUTES: Route[] = [
},
providers,
data: { title: 'admin.access-control.epeople.title', breadcrumbKey: 'admin.access-control.epeople' },
canActivate: [SiteAdministratorGuard],
canActivate: mapToCanActivate([SiteAdministratorGuard]),
},
{
path: `${EPERSON_PATH}/create`,
Expand All @@ -53,7 +56,7 @@ export const ROUTES: Route[] = [
},
providers,
data: { title: 'admin.access-control.epeople.add.title', breadcrumbKey: 'admin.access-control.epeople.add' },
canActivate: [SiteAdministratorGuard],
canActivate: mapToCanActivate([SiteAdministratorGuard]),
},
{
path: `${EPERSON_PATH}/:id/edit`,
Expand All @@ -64,7 +67,7 @@ export const ROUTES: Route[] = [
},
providers,
data: { title: 'admin.access-control.epeople.edit.title', breadcrumbKey: 'admin.access-control.epeople.edit' },
canActivate: [SiteAdministratorGuard],
canActivate: mapToCanActivate([SiteAdministratorGuard]),
},
{
path: GROUP_PATH,
Expand All @@ -74,7 +77,7 @@ export const ROUTES: Route[] = [
},
providers,
data: { title: 'admin.access-control.groups.title', breadcrumbKey: 'admin.access-control.groups' },
canActivate: [GroupAdministratorGuard],
canActivate: mapToCanActivate([GroupAdministratorGuard]),
},
{
path: `${GROUP_PATH}/create`,
Expand All @@ -87,7 +90,7 @@ export const ROUTES: Route[] = [
title: 'admin.access-control.groups.title.addGroup',
breadcrumbKey: 'admin.access-control.groups.addGroup',
},
canActivate: [GroupAdministratorGuard],
canActivate: mapToCanActivate([GroupAdministratorGuard]),
},
{
path: `${GROUP_PATH}/:groupId/edit`,
Expand All @@ -100,7 +103,7 @@ export const ROUTES: Route[] = [
title: 'admin.access-control.groups.title.singleGroup',
breadcrumbKey: 'admin.access-control.groups.singleGroup',
},
canActivate: [GroupPageGuard],
canActivate: mapToCanActivate([GroupPageGuard]),
},
{
path: 'bulk-access',
Expand All @@ -109,6 +112,6 @@ export const ROUTES: Route[] = [
breadcrumb: I18nBreadcrumbResolver,
},
data: { title: 'admin.access-control.bulk-access.title', breadcrumbKey: 'admin.access-control.bulk-access' },
canActivate: [SiteAdministratorGuard],
canActivate: mapToCanActivate([SiteAdministratorGuard]),
},
];
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import {
ActivatedRouteSnapshot,
Resolve,
RouterStateSnapshot,
} from '@angular/router';
import { Store } from '@ngrx/store';
Expand All @@ -27,7 +26,7 @@ export const EPERSON_EDIT_FOLLOW_LINKS: FollowLinkConfig<EPerson>[] = [
@Injectable({
providedIn: 'root',
})
export class EPersonResolver implements Resolve<RemoteData<EPerson>> {
export class EPersonResolver {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about removing the Resolve interface


constructor(
protected ePersonService: EPersonDataService,
Expand Down
Loading
Loading