From: Fiete Ostkamp Date: Mon, 23 Sep 2024 11:39:16 +0000 (+0200) Subject: Upgrade packages to current Angular 13 level X-Git-Tag: 0.1.2~3 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=e964f1c1be44ef74877531870c119aa110555ca1;p=portal-ng%2Fui.git Upgrade packages to current Angular 13 level - upgrade angular-oauth2-oidc (12.1.0 -> 13.0.1) - upgrade ngx-translate (13.0.0 -> 14.0.0) - upgrade rxjs (6.6.7 -> 7.4.0) - remove ng-bootstrap - bump version to 0.1.1 Issue-ID: PORTALNG-120 Change-Id: I0672a7e794e965677ef5d818163ec080734e11e0 Signed-off-by: Fiete Ostkamp --- diff --git a/package.json b/package.json index 34fe7ff..08edc45 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "private": true, "dependencies": { "@angular/animations": "13.3.10", - "@angular/cdk": "13.3.8", + "@angular/cdk": "13.3.9", "@angular/common": "13.3.10", "@angular/compiler": "13.3.10", "@angular/core": "13.3.10", @@ -32,26 +32,25 @@ "@angular/platform-browser-dynamic": "13.3.10", "@angular/router": "13.3.10", "@ng-bootstrap/ng-bootstrap": "12.1.2", - "@ngx-translate/core": "13.0.0", - "@ngx-translate/http-loader": "6.0.0", + "@ngx-translate/core": "14.0.0", + "@ngx-translate/http-loader": "7.0.0", "@popperjs/core": "2.11.5", - "angular-oauth2-oidc": "12.1.0", + "angular-oauth2-oidc": "13.0.1", "bootstrap": "5.1.3", "license-report": "5.0.2", "lodash": "4.17.21", - "ng-bootstrap": "1.6.3", - "rxjs": "6.6.7", - "tslib": "2.2.0", + "rxjs": "~7.4.0", + "tslib": "2.3.0", "zone.js": "0.11.5" }, "devDependencies": { - "@angular-devkit/build-angular": "13.3.7", - "@angular-eslint/builder": "13.2.1", - "@angular-eslint/eslint-plugin": "13.2.1", - "@angular-eslint/eslint-plugin-template": "13.2.1", - "@angular-eslint/schematics": "13.2.1", - "@angular-eslint/template-parser": "13.2.1", - "@angular/cli": "13.3.7", + "@angular-devkit/build-angular": "13.3.10", + "@angular-eslint/builder": "13.5.0", + "@angular-eslint/eslint-plugin": "13.5.0", + "@angular-eslint/eslint-plugin-template": "13.5.0", + "@angular-eslint/schematics": "13.5.0", + "@angular-eslint/template-parser": "13.5.0", + "@angular/cli": "13.3.10", "@angular/compiler-cli": "13.3.10", "@openapitools/openapi-generator-cli": "^2.6.0", "@types/jasmine": "~3.6.0", diff --git a/src/app/modules/dashboard/apps/user-last-action-tile/user-last-action-tile.component.ts b/src/app/modules/dashboard/apps/user-last-action-tile/user-last-action-tile.component.ts index c03016f..ee477b5 100644 --- a/src/app/modules/dashboard/apps/user-last-action-tile/user-last-action-tile.component.ts +++ b/src/app/modules/dashboard/apps/user-last-action-tile/user-last-action-tile.component.ts @@ -61,12 +61,12 @@ export class UserLastActionTileComponent implements OnInit { .pipe(shareReplay({ refCount: true, bufferSize: 1 })); public actionFilterType$ = this.userActionsSettings$.pipe( - selectDistinctState(STATE_KEYS.FILTER_TYPE), + selectDistinctState(STATE_KEYS.FILTER_TYPE as keyof LastUserActionSettings), shareReplay({ refCount: true, bufferSize: 1 }), ); public actionIntervalType$ = this.userActionsSettings$.pipe( - selectDistinctState(STATE_KEYS.INTERVAL), + selectDistinctState(STATE_KEYS.INTERVAL as keyof LastUserActionSettings), shareReplay({ refCount: true, bufferSize: 1 }), ); diff --git a/src/app/modules/i18n/i18n.module.ts b/src/app/modules/i18n/i18n.module.ts index 52bedbe..a6a1da6 100644 --- a/src/app/modules/i18n/i18n.module.ts +++ b/src/app/modules/i18n/i18n.module.ts @@ -41,7 +41,7 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader'; export class I18nModule { constructor(translate: TranslateService) { translate.addLangs(['en', 'de']); - const browserLang = translate.getBrowserLang(); + const browserLang = translate.getBrowserLang() ?? 'en'; translate.use(browserLang.match(/en|de/) ? browserLang : 'en'); } } diff --git a/src/app/services/tileservice/tiles.service.ts b/src/app/services/tileservice/tiles.service.ts index 167e42a..acdce5b 100644 --- a/src/app/services/tileservice/tiles.service.ts +++ b/src/app/services/tileservice/tiles.service.ts @@ -19,7 +19,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; +import { firstValueFrom, Observable } from 'rxjs'; import { environment } from 'src/environments/environment'; import { Tile, TilesListResponse } from '../../model/tile'; import { map } from 'rxjs/operators'; @@ -50,8 +50,8 @@ export class TilesService { * GET tile by id * @param id to get specific tile */ - getTileById(id: number): Promise { - return this.httpClient.get(urlTileApi + '/' + id).toPromise(); + getTileById(id: number): Promise { + return firstValueFrom(this.httpClient.get(urlTileApi + '/' + id)); } /** @@ -59,11 +59,11 @@ export class TilesService { * @param tile * @returns the new saved tile */ - saveTiles(tile: Tile): Promise { + saveTiles(tile: Tile): Promise { const options = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }), }; - return this.httpClient.post(urlTileApi, tile, options).toPromise(); + return firstValueFrom(this.httpClient.post(urlTileApi, tile, options)); } /** @@ -71,11 +71,11 @@ export class TilesService { * @returns the updated hero * @param tile */ - updateTiles(tile: Tile): Promise { + updateTiles(tile: Tile): Promise { const options = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }), }; - return this.httpClient.put(urlTileApi + '/' + tile.id, tile, options).toPromise(); + return firstValueFrom(this.httpClient.put(urlTileApi + '/' + tile.id, tile, options)); } /** diff --git a/src/app/services/user-settings.service.ts b/src/app/services/user-settings.service.ts index cbaa992..2f7e578 100644 --- a/src/app/services/user-settings.service.ts +++ b/src/app/services/user-settings.service.ts @@ -49,14 +49,14 @@ export class UserSettingsService { } selectDashboard = () => - this.getPreferences$().pipe(selectDistinctState(STATE_KEYS.DASHBOARD)); + this.getPreferences$().pipe(selectDistinctState(STATE_KEYS.DASHBOARD as keyof UserPreferencesModel)); selectDashboardApps = () => - this.selectDashboard().pipe(selectDistinctState(STATE_KEYS.APPS)); + this.selectDashboard().pipe(selectDistinctState(STATE_KEYS.APPS as keyof DashboardModel)); selectDashboardAvailableTiles = () => - this.selectDashboardApps().pipe(selectDistinctState(STATE_KEYS.TILES)); + this.selectDashboardApps().pipe(selectDistinctState(STATE_KEYS.TILES as keyof DashboardAppsModel)); selectLastUserAction = () => this.selectDashboardApps().pipe( - selectDistinctState(STATE_KEYS.USER_ACTIONS), + selectDistinctState(STATE_KEYS.USER_ACTIONS as keyof DashboardAppsModel), ); getPreferences(): void { @@ -106,6 +106,8 @@ export class UserSettingsService { } } -export function selectDistinctState(key: string): UnaryFunction, Observable> { - return pipe(pluck(key), distinctUntilChanged()); +export function selectDistinctState(key: keyof T): UnaryFunction, Observable> { + // return pipe(map(x => x[key] as I), distinctUntilChanged()); + return pipe(pluck(key), map(value => value as unknown as I), distinctUntilChanged()); + // return pipe(pluck(key), distinctUntilChanged()); } diff --git a/tsconfig.json b/tsconfig.json index 536748b..b38eb86 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,7 @@ "moduleResolution": "node", "importHelpers": true, "target": "es2017", - "lib": ["es2018", "dom"], + "lib": ["es2020", "dom"], "resolveJsonModule": true, "esModuleInterop": true }, diff --git a/version.properties b/version.properties index b179fec..30ce569 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=0 minor=1 -patch=1 +patch=2 base_version=${major}.${minor}.${patch}