UI: Angular 14 migration

This commit is contained in:
Igor Kulikov 2023-02-02 16:09:49 +02:00
parent 1b51b38466
commit 28a48c3fc5
7 changed files with 38 additions and 38 deletions

View File

@ -35,9 +35,9 @@
"@material-ui/core": "4.12.3", "@material-ui/core": "4.12.3",
"@material-ui/icons": "4.11.2", "@material-ui/icons": "4.11.2",
"@material-ui/pickers": "3.3.10", "@material-ui/pickers": "3.3.10",
"@ngrx/effects": "^12.5.1", "@ngrx/effects": "^14.3.3",
"@ngrx/store": "^12.5.1", "@ngrx/store": "^14.3.3",
"@ngrx/store-devtools": "^12.5.1", "@ngrx/store-devtools": "^14.3.3",
"@ngx-translate/core": "^13.0.0", "@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0", "@ngx-translate/http-loader": "^6.0.0",
"ace-builds": "1.4.13", "ace-builds": "1.4.13",

View File

@ -21,7 +21,7 @@ import { AuthState } from './auth.models';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
import { AuthUser } from '@shared/models/user.model'; import { AuthUser } from '@shared/models/user.model';
export const selectAuthState = createFeatureSelector<AppState, AuthState>( export const selectAuthState = createFeatureSelector< AuthState>(
'auth' 'auth'
); );

View File

@ -20,7 +20,7 @@ import { AppState } from '../core.state';
import { LoadState } from './load.models'; import { LoadState } from './load.models';
import { take } from 'rxjs/operators'; import { take } from 'rxjs/operators';
export const selectLoadState = createFeatureSelector<AppState, LoadState>( export const selectLoadState = createFeatureSelector< LoadState>(
'load' 'load'
); );

View File

@ -15,7 +15,7 @@
/// ///
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Actions, Effect, ofType } from '@ngrx/effects'; import { Actions, createEffect, ofType } from '@ngrx/effects';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { NotificationActions, NotificationActionTypes } from '@app/core/notification/notification.actions'; import { NotificationActions, NotificationActionTypes } from '@app/core/notification/notification.actions';
@ -29,23 +29,23 @@ export class NotificationEffects {
) { ) {
} }
@Effect({dispatch: false})
dispatchNotification = this.actions$.pipe( dispatchNotification = createEffect(() => this.actions$.pipe(
ofType( ofType(
NotificationActionTypes.SHOW_NOTIFICATION, NotificationActionTypes.SHOW_NOTIFICATION,
), ),
map(({ notification }) => { map(({ notification }) => {
this.notificationService.dispatchNotification(notification); this.notificationService.dispatchNotification(notification);
}) })
); ), {dispatch: false});
@Effect({dispatch: false})
hideNotification = this.actions$.pipe( hideNotification = createEffect(() => this.actions$.pipe(
ofType( ofType(
NotificationActionTypes.HIDE_NOTIFICATION, NotificationActionTypes.HIDE_NOTIFICATION,
), ),
map(({ hideNotification }) => { map(({ hideNotification }) => {
this.notificationService.hideNotification(hideNotification); this.notificationService.hideNotification(hideNotification);
}) })
); ), {dispatch: false});
} }

View File

@ -17,7 +17,7 @@
import { ActivationEnd, Router } from '@angular/router'; import { ActivationEnd, Router } from '@angular/router';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { select, Store } from '@ngrx/store'; import { select, Store } from '@ngrx/store';
import { Actions, Effect, ofType } from '@ngrx/effects'; import { Actions, createEffect, ofType } from '@ngrx/effects';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { merge } from 'rxjs'; import { merge } from 'rxjs';
import { distinctUntilChanged, filter, map, tap, withLatestFrom } from 'rxjs/operators'; import { distinctUntilChanged, filter, map, tap, withLatestFrom } from 'rxjs/operators';
@ -49,8 +49,8 @@ export class SettingsEffects {
) { ) {
} }
@Effect({dispatch: false})
persistSettings = this.actions$.pipe( persistSettings = createEffect(() => this.actions$.pipe(
ofType( ofType(
SettingsActionTypes.CHANGE_LANGUAGE, SettingsActionTypes.CHANGE_LANGUAGE,
), ),
@ -58,18 +58,18 @@ export class SettingsEffects {
tap(([action, settings]) => tap(([action, settings]) =>
this.localStorageService.setItem(SETTINGS_KEY, settings) this.localStorageService.setItem(SETTINGS_KEY, settings)
) )
); ), {dispatch: false});
@Effect({dispatch: false})
setTranslateServiceLanguage = this.store.pipe( setTranslateServiceLanguage = createEffect(() => this.store.pipe(
select(selectSettingsState), select(selectSettingsState),
map(settings => settings.userLang), map(settings => settings.userLang),
distinctUntilChanged(), distinctUntilChanged(),
tap(userLang => updateUserLang(this.translate, userLang)) tap(userLang => updateUserLang(this.translate, userLang))
); ), {dispatch: false});
@Effect({dispatch: false})
setTitle = merge( setTitle = createEffect(() => merge(
this.actions$.pipe(ofType(SettingsActionTypes.CHANGE_LANGUAGE)), this.actions$.pipe(ofType(SettingsActionTypes.CHANGE_LANGUAGE)),
this.router.events.pipe(filter(event => event instanceof ActivationEnd)) this.router.events.pipe(filter(event => event instanceof ActivationEnd))
).pipe( ).pipe(
@ -79,10 +79,10 @@ export class SettingsEffects {
this.translate this.translate
); );
}) })
); ), {dispatch: false});
@Effect({dispatch: false})
setPublicId = merge( setPublicId = createEffect(() => merge(
this.router.events.pipe(filter(event => event instanceof ActivationEnd)) this.router.events.pipe(filter(event => event instanceof ActivationEnd))
).pipe( ).pipe(
tap((event) => { tap((event) => {
@ -95,5 +95,5 @@ export class SettingsEffects {
{ lastPublicDashboardId: snapshot.params.dashboardId})); { lastPublicDashboardId: snapshot.params.dashboardId}));
} }
}) })
); ), {dispatch: false});
} }

View File

@ -19,7 +19,7 @@ import { createFeatureSelector, createSelector } from '@ngrx/store';
import { SettingsState } from './settings.models'; import { SettingsState } from './settings.models';
import { AppState } from '@app/core/core.state'; import { AppState } from '@app/core/core.state';
export const selectSettingsState = createFeatureSelector<AppState, SettingsState>( export const selectSettingsState = createFeatureSelector< SettingsState>(
'settings' 'settings'
); );

View File

@ -2370,24 +2370,24 @@
prop-types "^15.7.2" prop-types "^15.7.2"
react-is "^16.8.0 || ^17.0.0" react-is "^16.8.0 || ^17.0.0"
"@ngrx/effects@^12.5.1": "@ngrx/effects@^14.3.3":
version "12.5.1" version "14.3.3"
resolved "https://registry.yarnpkg.com/@ngrx/effects/-/effects-12.5.1.tgz#acd0ff86d8db514e47337508dde83cc98f7a3416" resolved "https://registry.yarnpkg.com/@ngrx/effects/-/effects-14.3.3.tgz#5c9e43e4dc5e1d544f4604fc6a32feec2380c413"
integrity sha512-fVNGIIntYLRWW1XWe0os2XOv03L22S4WTkX0OPZ9O6ztwuaNq0yzxWN7UeAC6H385F+g0k76KwRV78zHyP0bfQ== integrity sha512-bP7rIHlu1KAj5Wm0TWR7Q8VlOQOBu8uiN/fDP3Lqi8FwVW6HOq9eBGcFwJGyqwVAmulsvLFB68MhpMYg2W78+w==
dependencies: dependencies:
tslib "^2.0.0" tslib "^2.0.0"
"@ngrx/store-devtools@^12.5.1": "@ngrx/store-devtools@^14.3.3":
version "12.5.1" version "14.3.3"
resolved "https://registry.yarnpkg.com/@ngrx/store-devtools/-/store-devtools-12.5.1.tgz#75f8ef9a4bf4a40d5343ff437651f0f3092914b5" resolved "https://registry.yarnpkg.com/@ngrx/store-devtools/-/store-devtools-14.3.3.tgz#ffffb154a63d468331e20c90e486c9b0de008d5d"
integrity sha512-SXMxVO3KzQUfB9G20gdNT5t/RcbtbaUySXLuH+b69z/eb34wH9AOYifdSdcEi8oqPjDrWYBq6a8Uh+yDHf9IfA== integrity sha512-YQFFKYRnmREHCUb0aAaAgSXWKjZqV+5pmzsjW6HZ0GTKoy9R3JI7Miw0gplwkJpLO7Z3AFCuLQIpTs5ryAOwPQ==
dependencies: dependencies:
tslib "^2.0.0" tslib "^2.0.0"
"@ngrx/store@^12.5.1": "@ngrx/store@^14.3.3":
version "12.5.1" version "14.3.3"
resolved "https://registry.yarnpkg.com/@ngrx/store/-/store-12.5.1.tgz#a7c21d7df1d017d2cb7e77804b210cc14bcf8786" resolved "https://registry.yarnpkg.com/@ngrx/store/-/store-14.3.3.tgz#397d7fe54fb6c580282240c149f76f6f48ebf2a3"
integrity sha512-NLVkHLVeZc7IboXSDZlFoq1QrupmwYTYKRHS6se7ZasAv/lrIjHWsVVdICKSVRBsHZYu3+dmCXmu+YgulP7iHw== integrity sha512-VhPDR2a5OQJfrVRah3vdJgL/F6UC8NU/X7lxKFqBW3NC+pmlIeFO/y8jLrZOKBXwG45tY9wrg15S70nEGoZtHA==
dependencies: dependencies:
tslib "^2.0.0" tslib "^2.0.0"