From 655f0b6203b4fd56125ad7219d214bddd3c0b76a Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Wed, 24 Jul 2024 11:26:05 +0300 Subject: [PATCH] [angular-18 | WIP] upgrade angular core and cli to v18, bring submodules to angular-18 as well --- package.json | 28 ++++----- src/app/app.module.ts | 56 ++++++++--------- .../communityContentProviders.module.ts | 60 +++++++++---------- .../projects/communityProjects.module.ts | 60 +++++++++---------- src/assets/common-assets | 2 +- 5 files changed, 94 insertions(+), 112 deletions(-) diff --git a/package.json b/package.json index 20c78bf..1719674 100644 --- a/package.json +++ b/package.json @@ -17,17 +17,17 @@ }, "private": true, "dependencies": { - "@angular/animations": "^17.3.12", + "@angular/animations": "^18.1.1", "@angular/cdk": "^17.3.10", - "@angular/common": "^17.3.12", - "@angular/compiler": "^17.3.12", - "@angular/core": "^17.3.12", - "@angular/forms": "^17.3.12", - "@angular/localize": "^17.3.12", + "@angular/common": "^18.1.1", + "@angular/compiler": "^18.1.1", + "@angular/core": "^18.1.1", + "@angular/forms": "^18.1.1", + "@angular/localize": "^18.1.1", "@angular/material": "^17.3.10", - "@angular/platform-browser": "^17.3.12", - "@angular/platform-browser-dynamic": "^17.3.12", - "@angular/router": "^17.3.12", + "@angular/platform-browser": "^18.1.1", + "@angular/platform-browser-dynamic": "^18.1.1", + "@angular/router": "^18.1.1", "clipboard": "^1.5.16", "core-js": "^2.5.4", "express": "^4.15.2", @@ -43,10 +43,10 @@ "zone.js": "~0.14.0" }, "devDependencies": { - "@angular-devkit/build-angular": "^17.3.8", - "@angular/cli": "^17.3.8", - "@angular/compiler-cli": "^17.3.12", - "@angular/language-service": "^17.3.12", + "@angular-devkit/build-angular": "^18.1.1", + "@angular/cli": "^18.1.1", + "@angular/compiler-cli": "^18.1.1", + "@angular/language-service": "^18.1.1", "@types/ckeditor": "^4.9.10", "@types/express": "^4.17.0", "@types/jasmine": "~3.6.0", @@ -61,6 +61,6 @@ "karma-jasmine-html-reporter": "^1.6.0", "protractor": "~7.0.0", "ts-node": "~7.0.0", - "typescript": "~5.4.0" + "typescript": "~5.5.4" } } \ No newline at end of file diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 46ebb0b..2236667 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,6 +1,6 @@ import {NgModule} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; -import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http'; +import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {AppComponent} from './app.component'; import {AppRoutingModule} from './app.routing'; import {ReactiveFormsModule} from '@angular/forms'; @@ -23,36 +23,30 @@ import {AdminLoginGuard} from "./openaireLibrary/login/adminLoginGuard.guard"; import {LoginGuard} from "./openaireLibrary/login/loginGuard.guard"; import {InteractiveMiningModule} from 'interactiveminingv3'; -@NgModule({ - imports: [ - AppRoutingModule, - BrowserModule, - HttpClientModule, - ReactiveFormsModule, - BottomModule, NavigationBarModule, - ErrorModule, - SharedModule, - InteractiveMiningModule, - BrowserAnimationsModule, LoadingModule, SideBarModule - ], - declarations: [ - AppComponent, - AdminErrorPageComponent - ], - providers: [ - SubscribeService, - ConnectAdminLoginGuard, AdminLoginGuard, LoginGuard, - IsCommunity, ConnectRIGuard, TitleCasePipe, - { - provide: HTTP_INTERCEPTORS, - useClass: ErrorInterceptorService, - multi: true - }, - [{provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true}], - [{provide: DEFAULT_TIMEOUT, useValue: 30000}] - ], - bootstrap: [AppComponent] -}) +@NgModule({ declarations: [ + AppComponent, + AdminErrorPageComponent + ], + bootstrap: [AppComponent], imports: [AppRoutingModule, + BrowserModule, + ReactiveFormsModule, + BottomModule, NavigationBarModule, + ErrorModule, + SharedModule, + InteractiveMiningModule, + BrowserAnimationsModule, LoadingModule, SideBarModule], providers: [ + SubscribeService, + ConnectAdminLoginGuard, AdminLoginGuard, LoginGuard, + IsCommunity, ConnectRIGuard, TitleCasePipe, + { + provide: HTTP_INTERCEPTORS, + useClass: ErrorInterceptorService, + multi: true + }, + [{ provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true }], + [{ provide: DEFAULT_TIMEOUT, useValue: 30000 }], + provideHttpClient(withInterceptorsFromDi()) + ] }) export class AppModule { } diff --git a/src/app/pages/content-providers/communityContentProviders.module.ts b/src/app/pages/content-providers/communityContentProviders.module.ts index 2de48bb..d6e9449 100644 --- a/src/app/pages/content-providers/communityContentProviders.module.ts +++ b/src/app/pages/content-providers/communityContentProviders.module.ts @@ -1,5 +1,5 @@ import {NgModule} from '@angular/core'; -import {HttpClientModule} from '@angular/common/http'; +import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; @@ -32,38 +32,32 @@ import {MatSlideToggleModule} from "@angular/material/slide-toggle"; import {CKEditorModule} from "ng2-ckeditor"; import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module"; -@NgModule({ - imports: [ - CommonModule, - HttpClientModule, - FormsModule, - ReactiveFormsModule, - RouterModule, - PagingModule, SearchPagingModule, - ErrorMessagesModule, - AlertModalModule, - SearchDataprovidersServiceModule, - PageContentModule, - InputModule, - SearchInputModule, - RouterModule.forChild([ - { - path: '', component: ManageContentProvidersComponent - } - ]), - NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, CriteriaModule, MatSlideToggleModule, CKEditorModule, ReactiveFormsModule, ValidateEnabledPageModule - ], - declarations: [ - ManageContentProvidersComponent, - RemoveContentProvidersComponent, - AddContentProvidersComponent - ], - providers: [ - ManageCommunityContentProvidersService, - SearchDataprovidersService - ], - exports: [ManageContentProvidersComponent] -}) +@NgModule({ declarations: [ + ManageContentProvidersComponent, + RemoveContentProvidersComponent, + AddContentProvidersComponent + ], + exports: [ManageContentProvidersComponent], imports: [CommonModule, + FormsModule, + ReactiveFormsModule, + RouterModule, + PagingModule, SearchPagingModule, + ErrorMessagesModule, + AlertModalModule, + SearchDataprovidersServiceModule, + PageContentModule, + InputModule, + SearchInputModule, + RouterModule.forChild([ + { + path: '', component: ManageContentProvidersComponent + } + ]), + NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, CriteriaModule, MatSlideToggleModule, CKEditorModule, ReactiveFormsModule, ValidateEnabledPageModule], providers: [ + ManageCommunityContentProvidersService, + SearchDataprovidersService, + provideHttpClient(withInterceptorsFromDi()) + ] }) export class CommunityContentProvidersModule { constructor(private iconsService: IconsService) { diff --git a/src/app/pages/projects/communityProjects.module.ts b/src/app/pages/projects/communityProjects.module.ts index 1aee98a..a06f6a5 100644 --- a/src/app/pages/projects/communityProjects.module.ts +++ b/src/app/pages/projects/communityProjects.module.ts @@ -1,5 +1,5 @@ import {NgModule} from '@angular/core'; -import {HttpClientModule} from '@angular/common/http'; +import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; import {ManageProjectsComponent} from './manage-projects.component'; @@ -26,38 +26,32 @@ import {DropdownFilterModule} from "../../openaireLibrary/utils/dropdown-filter/ import {SearchFilterModule} from "../../openaireLibrary/searchPages/searchUtils/searchFilter.module"; import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module"; -@NgModule({ - imports: [ - CommonModule, - HttpClientModule, - FormsModule, - ReactiveFormsModule, - RouterModule, - PagingModule, SearchPagingModule, - ErrorMessagesModule, - AlertModalModule, - SearchProjectsServiceModule, - PageContentModule, - InputModule, - SearchInputModule, - RouterModule.forChild([ - { - path: '', component: ManageProjectsComponent - } - ]), - NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, DropdownFilterModule, SearchFilterModule, ValidateEnabledPageModule - ], - declarations: [ - ManageProjectsComponent, - RemoveProjectsComponent, - AddProjectsComponent - ], - providers: [ - ManageCommunityProjectsService, - SearchProjectsService - ], - exports: [ManageProjectsComponent] -}) +@NgModule({ declarations: [ + ManageProjectsComponent, + RemoveProjectsComponent, + AddProjectsComponent + ], + exports: [ManageProjectsComponent], imports: [CommonModule, + FormsModule, + ReactiveFormsModule, + RouterModule, + PagingModule, SearchPagingModule, + ErrorMessagesModule, + AlertModalModule, + SearchProjectsServiceModule, + PageContentModule, + InputModule, + SearchInputModule, + RouterModule.forChild([ + { + path: '', component: ManageProjectsComponent + } + ]), + NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, DropdownFilterModule, SearchFilterModule, ValidateEnabledPageModule], providers: [ + ManageCommunityProjectsService, + SearchProjectsService, + provideHttpClient(withInterceptorsFromDi()) + ] }) export class CommunityProjectsModule { constructor() {} } diff --git a/src/assets/common-assets b/src/assets/common-assets index ee1a55a..eb0051d 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit ee1a55a529fde844f54761633e59f3be791717e3 +Subproject commit eb0051dc347cdaa44476048dea9f6b61200f257f