Angular 18 upgrade

This commit is contained in:
DominikIwanek 2025-03-14 11:18:02 +01:00
parent c420e1cafe
commit c195b4fe33
10 changed files with 2633 additions and 4562 deletions

7113
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -30,11 +30,11 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@alfresco/adf-content-services": "8.1.0-14225774087", "@alfresco/adf-content-services": "7.0.0-alpha.9-13833690161",
"@alfresco/adf-core": "8.1.0-14225774087", "@alfresco/adf-core": "7.0.0-alpha.9-13833690161",
"@alfresco/adf-extensions": "8.1.0-14225774087", "@alfresco/adf-extensions": "7.0.0-alpha.9-13833690161",
"@alfresco/eslint-plugin-eslint-angular": "8.1.0-14225774087", "@alfresco/eslint-plugin-eslint-angular": "7.0.0-alpha.9-13833690161",
"@alfresco/js-api": "9.1.0-14225774087", "@alfresco/js-api": "8.0.0-alpha.9-13833690161",
"@angular/animations": "18.2.9", "@angular/animations": "18.2.9",
"@angular/cdk": "18.2.9", "@angular/cdk": "18.2.9",
"@angular/common": "18.2.9", "@angular/common": "18.2.9",
@ -49,7 +49,7 @@
"@fontsource/open-sans": "^5.1.0", "@fontsource/open-sans": "^5.1.0",
"@mat-datetimepicker/core": "14.0.0", "@mat-datetimepicker/core": "14.0.0",
"@ngrx/effects": "18.1.1", "@ngrx/effects": "18.1.1",
"@ngrx/operators": "18.1.1", "@ngrx/operators": "^18.0.0",
"@ngrx/router-store": "18.1.1", "@ngrx/router-store": "18.1.1",
"@ngrx/store": "18.1.1", "@ngrx/store": "18.1.1",
"@ngrx/store-devtools": "18.1.1", "@ngrx/store-devtools": "18.1.1",
@ -67,7 +67,7 @@
"zone.js": "0.14.10" "zone.js": "0.14.10"
}, },
"devDependencies": { "devDependencies": {
"@alfresco/adf-cli": "8.1.0-14225774087", "@alfresco/adf-cli": "7.0.0-alpha.9-13833690161",
"@angular-devkit/build-angular": "18.2.9", "@angular-devkit/build-angular": "18.2.9",
"@angular-devkit/core": "18.2.9", "@angular-devkit/core": "18.2.9",
"@angular-devkit/schematics": "18.2.9", "@angular-devkit/schematics": "18.2.9",
@ -76,7 +76,7 @@
"@angular-eslint/eslint-plugin-template": "18.4.3", "@angular-eslint/eslint-plugin-template": "18.4.3",
"@angular-eslint/schematics": "18.4.3", "@angular-eslint/schematics": "18.4.3",
"@angular-eslint/template-parser": "18.4.3", "@angular-eslint/template-parser": "18.4.3",
"@angular/cli": "18.2.15", "@angular/cli": "~18.2.0",
"@angular/compiler-cli": "18.2.9", "@angular/compiler-cli": "18.2.9",
"@angular/language-service": "18.2.9", "@angular/language-service": "18.2.9",
"@cspell/eslint-plugin": "^8.14.1", "@cspell/eslint-plugin": "^8.14.1",

View File

@ -32,7 +32,7 @@ import { NodeEntry } from '@alfresco/js-api';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { ContentActionType } from '@alfresco/adf-extensions'; import { ContentActionType } from '@alfresco/adf-extensions';
import { HttpClientModule } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { StoreModule } from '@ngrx/store'; import { StoreModule } from '@ngrx/store';
const mockNode = { const mockNode = {
@ -59,7 +59,6 @@ describe('DatatableCellBadgesComponent', () => {
imports: [ imports: [
TranslateModule.forRoot(), TranslateModule.forRoot(),
AuthModule.forRoot(), AuthModule.forRoot(),
HttpClientModule,
StoreModule.forRoot( StoreModule.forRoot(
{ app: (state) => state }, { app: (state) => state },
{ {
@ -76,7 +75,7 @@ describe('DatatableCellBadgesComponent', () => {
} }
) )
], ],
providers: [Actions] providers: [Actions, provideHttpClient(withInterceptorsFromDi())]
}); });
fixture = TestBed.createComponent(DatatableCellBadgesComponent); fixture = TestBed.createComponent(DatatableCellBadgesComponent);

View File

@ -26,7 +26,7 @@ import { CustomNameColumnComponent } from './name-column.component';
import { Actions } from '@ngrx/effects'; import { Actions } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store'; import { StoreModule } from '@ngrx/store';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HttpClientModule } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { AuthModule } from '@alfresco/adf-core'; import { AuthModule } from '@alfresco/adf-core';
@ -49,7 +49,6 @@ describe('CustomNameColumnComponent', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
HttpClientModule,
TranslateModule.forRoot(), TranslateModule.forRoot(),
CustomNameColumnComponent, CustomNameColumnComponent,
MockDatatableCellBadgesComponent, MockDatatableCellBadgesComponent,
@ -70,7 +69,7 @@ describe('CustomNameColumnComponent', () => {
} }
) )
], ],
providers: [Actions] providers: [Actions, provideHttpClient(withInterceptorsFromDi())]
}); });
fixture = TestBed.createComponent(CustomNameColumnComponent); fixture = TestBed.createComponent(CustomNameColumnComponent);

View File

@ -25,7 +25,7 @@
import { HomeComponent } from './home.component'; import { HomeComponent } from './home.component';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { HttpClientModule } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { AppSettingsService } from '@alfresco/aca-shared'; import { AppSettingsService } from '@alfresco/aca-shared';
@ -36,7 +36,8 @@ describe('HomeComponent', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [HttpClientModule, RouterTestingModule, HomeComponent] imports: [RouterTestingModule, HomeComponent],
providers: [provideHttpClient(withInterceptorsFromDi())]
}); });
appSettings = TestBed.inject(AppSettingsService); appSettings = TestBed.inject(AppSettingsService);
spyOnProperty(appSettings, 'landingPage', 'get').and.returnValue('/my-mock-landing-page'); spyOnProperty(appSettings, 'landingPage', 'get').and.returnValue('/my-mock-landing-page');

View File

@ -25,25 +25,25 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslationService, TranslationMock, AuthenticationService, PageTitleService } from '@alfresco/adf-core'; import { AuthenticationService, PageTitleService, TranslationMock, TranslationService } from '@alfresco/adf-core';
import { AlfrescoApiService, AlfrescoApiServiceMock, DiscoveryApiService, SearchQueryBuilderService } from '@alfresco/adf-content-services'; import { AlfrescoApiService, AlfrescoApiServiceMock, DiscoveryApiService, SearchQueryBuilderService } from '@alfresco/adf-content-services';
import { RepositoryInfo, VersionInfo } from '@alfresco/js-api'; import { RepositoryInfo, VersionInfo } from '@alfresco/js-api';
import { HttpClientModule } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { StoreModule } from '@ngrx/store'; import { StoreModule } from '@ngrx/store';
import { appReducer } from '../store/reducers/app.reducer'; import { appReducer } from '../store/reducers/app.reducer';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { EffectsModule } from '@ngrx/effects'; import { EffectsModule } from '@ngrx/effects';
import { INITIAL_STATE } from '../store/initial-state'; import { INITIAL_STATE } from '../store/initial-state';
import { BehaviorSubject, Observable, Subject, of } from 'rxjs'; import { BehaviorSubject, Observable, of, Subject } from 'rxjs';
import { ContentManagementService } from '../services/content-management.service'; import { ContentManagementService } from '../services/content-management.service';
import { DocumentBasePageService } from '@alfresco/aca-shared'; import { DocumentBasePageService } from '@alfresco/aca-shared';
import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatDialogModule } from '@angular/material/dialog'; import { MatDialogModule } from '@angular/material/dialog';
@NgModule({ @NgModule({
exports: [RouterTestingModule, TranslateModule],
imports: [ imports: [
NoopAnimationsModule, NoopAnimationsModule,
HttpClientModule,
RouterTestingModule, RouterTestingModule,
TranslateModule.forRoot(), TranslateModule.forRoot(),
StoreModule.forRoot( StoreModule.forRoot(
@ -60,7 +60,6 @@ import { MatDialogModule } from '@angular/material/dialog';
MatSnackBarModule, MatSnackBarModule,
MatDialogModule MatDialogModule
], ],
exports: [RouterTestingModule, TranslateModule],
providers: [ providers: [
SearchQueryBuilderService, SearchQueryBuilderService,
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
@ -96,7 +95,8 @@ import { MatDialogModule } from '@angular/material/dialog';
{ {
provide: PageTitleService, provide: PageTitleService,
useValue: {} useValue: {}
} },
provideHttpClient(withInterceptorsFromDi())
] ]
}) })
export class AppTestingModule {} export class AppTestingModule {}

View File

@ -29,7 +29,7 @@ import { FavoritePaging, NodePaging, SharedLinkPaging } from '@alfresco/js-api';
import { ViewerService } from './viewer.service'; import { ViewerService } from './viewer.service';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { HttpClientModule } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
const list = { const list = {
list: { list: {
@ -69,8 +69,14 @@ describe('ViewerService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientModule], imports: [TranslateModule.forRoot()],
providers: [{ provide: TranslationService, useClass: TranslationMock }, ViewerService, UserPreferencesService, ContentApiService] providers: [
{ provide: TranslationService, useClass: TranslationMock },
ViewerService,
UserPreferencesService,
ContentApiService,
provideHttpClient(withInterceptorsFromDi())
]
}); });
preferences = TestBed.inject(UserPreferencesService); preferences = TestBed.inject(UserPreferencesService);

View File

@ -26,7 +26,8 @@ import { AppConfigService } from '@alfresco/adf-core';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { PluginEnabledGuard } from './plugin-enabled.guard'; import { PluginEnabledGuard } from './plugin-enabled.guard';
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router'; import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router';
import { HttpClientTestingModule } from '@angular/common/http/testing'; import { provideHttpClientTesting } from '@angular/common/http/testing';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
describe('PluginEnabledGuard', () => { describe('PluginEnabledGuard', () => {
let getSpy: jasmine.Spy<(key: string, defaultValue?: boolean) => boolean>; let getSpy: jasmine.Spy<(key: string, defaultValue?: boolean) => boolean>;
@ -34,7 +35,8 @@ describe('PluginEnabledGuard', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [HttpClientTestingModule] imports: [],
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
}); });
getSpy = spyOn(TestBed.inject(AppConfigService), 'get'); getSpy = spyOn(TestBed.inject(AppConfigService), 'get');
route = new ActivatedRouteSnapshot(); route = new ActivatedRouteSnapshot();

View File

@ -26,15 +26,15 @@ import { AppService } from './app.service';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { import {
AuthenticationService, AuthenticationService,
NotificationService,
PageTitleService, PageTitleService,
StorageService,
TranslationMock, TranslationMock,
TranslationService, TranslationService,
UserPreferencesService, UserPreferencesService
NotificationService,
StorageService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { BehaviorSubject, Observable, of, Subject } from 'rxjs'; import { BehaviorSubject, Observable, of, Subject } from 'rxjs';
import { HttpClientModule } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { import {
AlfrescoApiService, AlfrescoApiService,
AlfrescoApiServiceMock, AlfrescoApiServiceMock,
@ -73,7 +73,7 @@ describe('AppService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [CommonModule, HttpClientModule, TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), MatDialogModule, MatSnackBarModule], imports: [CommonModule, TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), MatDialogModule, MatSnackBarModule],
providers: [ providers: [
SearchQueryBuilderService, SearchQueryBuilderService,
provideMockStore({}), provideMockStore({}),
@ -121,7 +121,8 @@ describe('AppService', () => {
setStoragePrefix: () => null, setStoragePrefix: () => null,
getPropertyKey: (property: string) => `prefix__${property}` getPropertyKey: (property: string) => `prefix__${property}`
} }
} },
provideHttpClient(withInterceptorsFromDi())
] ]
}); });

View File

@ -27,7 +27,7 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateLoaderService, TranslationMock, TranslationService } from '@alfresco/adf-core'; import { TranslateLoaderService, TranslationMock, TranslationService } from '@alfresco/adf-core';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
import { HttpClientModule } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { RouterTestingModule } from '@angular/router/testing'; import { RouterTestingModule } from '@angular/router/testing';
import { EffectsModule } from '@ngrx/effects'; import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store'; import { StoreModule } from '@ngrx/store';
@ -93,10 +93,10 @@ export class DocumentBasePageServiceMock extends DocumentBasePageService {
} }
@NgModule({ @NgModule({
exports: [TranslateModule],
imports: [ imports: [
NoopAnimationsModule, NoopAnimationsModule,
CommonModule, CommonModule,
HttpClientModule,
RouterTestingModule, RouterTestingModule,
MatIconTestingModule, MatIconTestingModule,
StoreModule, StoreModule,
@ -119,10 +119,10 @@ export class DocumentBasePageServiceMock extends DocumentBasePageService {
} }
}) })
], ],
exports: [TranslateModule],
providers: [ providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: TranslationService, useClass: TranslationMock } { provide: TranslationService, useClass: TranslationMock },
provideHttpClient(withInterceptorsFromDi())
] ]
}) })
export class LibTestingModule {} export class LibTestingModule {}